Posts by gmsantos • 17,221 points
395 posts
-
1
votes1
answer52
viewsA: SQL base import to Azure
Yes, it is possible and can be done in many ways. One of them is to use the SQL Database Migration Wizard. That one article of the MSDNen shows some other possible forms of migration. Note that for…
-
3
votes3
answers301
viewsA: What is the advantage of using include de array vs configuration file?
1 - What is the advantage and advantage of each method? The advantage of the first approach is simplicity: you do not need to open the file Resource, read the data, convert to array, close to use…
-
1
votes1
answer784
viewsA: How to delete all records of a belongsToMany
To delete all relationships, just run the method detach() with no parameter: $role = Role::find(1); $role->actions()->detach();
-
3
votes1
answer1076
viewsA: Field SUM of two MSSQL Sub-consultations
You can use OVER(PARTITION BY ... ) in your query for this: SELECT CodCliente ,DataVenda ,Vendedor ,Valor ,DataPagamento ,SUM(Valor) As TotalCliente OVER (PARTITION BY CodCliente) FROM ((SELECT…
-
3
votes1
answer624
viewsA: Get values from $request
In the query, the field idSoftware is repeated twice:…
-
3
votes3
answers165
viewsA: Catching value created at runtime
Why complicate using Regex to parse HTML? Use DOM and Xpath: <?php $doc = new DOMDocument(); $doc->loadHTML(file_get_contents("http://link.com.br")); $xpath = new DOMXpath($doc); $spans =…
-
13
votes7
answers552
viewsA: What is the difference between these parameters (array) in these methods?
Two important concepts you need to understand are the hinting type and default value of the parameter. The hinting type obliges which argument has passed a specific type (in case a array). From PHP…
-
3
votes2
answers6648
viewsA: How to change the language of R?
Two other ways to change the language of R sane: Run the command below on the R, then close and open again (here it worked like this) Sys.setenv(LANGUAGE = "en") Add to shortcut of R the argument…
-
7
votes2
answers6648
viewsQ: How to change the language of R?
When installing the r on my machine I realized that the menus and console outputs were all in English. How do I change to English? Inside the RGui I couldn’t find any option to change the language…
-
4
votes1
answer1390
viewsA: How to insert into a database with special characters?
It is necessary to escape the special characters in your query. In your case, use mysql_real_escape_string $titulo = mysql_real_escape_string($titulo); $autor_livro =…
-
3
votes1
answer85
views -
4
votes2
answers4604
viewsA: How to insert by selecting from two different tables?
Can make a INSERT SELECT with the data: INSERT INTO `TABELA 3` (ID, IMOVEL, CODIGO, IMAGEM_G, IMAGEM_P) SELECT t1.ID, t1.IMOVEL, t1,codigo, t2.IMAGEM_G, t1.IMAGEM_P FROM `TABELA 1` t1 INNER JOIN…
-
2
votes1
answer102
viewsA: Access certain line of the variable
The return of the method query() of the object DomXPath is an object of the type DOMNodeList. You can access the items in this list through the method item(): <?php $dom = new DomDocument;…
-
9
votes3
answers10221
viewsA: Identify browser and its version
The information about the client’s browser is in the variable $_SERVER['HTTP_USER_AGENT']. Other details can be found by the function get_browser(). When using the $_SERVER['HTTP_USER_AGENT'] we…
-
4
votes1
answer442
viewsA: Extend Phpword class in CI - class not found
The problem you are having is basically calling a file that does not exist. Phpword has undergone several changes since the date this tutorial was created (2012). He started supporting PSR-0 for…
-
6
votes2
answers2082
viewsA: How to improve the process of generating unrepeated random numbers?
With some functions for arrays I got the same result, follows explanation of what makes each function: range() - Create an array from a minimum and maximum. array_rand() - Randomly returns a key…
-
4
votes1
answer144
viewsA: Display subquery result and use it for calculation
You can use a TEC (Common Table Expression) WITH CounterTable(columnA, Counter) AS ( SELECT [tableTest].[columnA], COUNT(*) FROM [tableTest] WHERE [tableTest].[columnA] = [tableA].[columnA] ) SELECT…
-
2
votes1
answer64
viewsA: Composer.lock accessible via web
The archives composer.lock is a generated version of your file composer.json which contains the exact versions of the dependencies your application is running. It is updated with a composer update…
-
5
votes1
answer1351
viewsA: ERROR syntax error, Unexpected T_VARIABLE
The problem here is in the use of the keyword global. global serves to reference within the scope of a function a variable in the global scope: <?php $a = 5; $b = 3; function soma(){ $a = 1; $b =…
-
3
votes1
answer1170
viewsA: How to fetch a value between a past range
Of PHP documentation, more specifically in the description of the parameter $step: Description array range ( mixed $low , mixed $high [, number $step ] ) Create an array containing a range of…
-
1
votes2
answers2097
viewsA: Mysql connection failed via VBA
Try updating the Connector version. As per documentation it works with any version of Mysql above 4.1.1. You just need to change your string Connection: Set Cn = New ADODB.Connection With Cn…
-
2
votes3
answers780
viewsA: JSON data capture with PHP
PHP has functions to work with JSON. What you’re looking for is json_decode. To get the desired key, just navigate between the array indexes <?php $content = file_get_contents('myJson.json'); //…
-
3
votes2
answers164
viewsA: My Sessionhandler does not allow me to log in
Instead of reinventing the wheel, why not use a Handler ready? An example would be to use the PdoSessionHandler of Symfony, one Handler working with several databases that can be finding within the…
-
2
votes3
answers1579
viewsA: Select the two highest values of a tuple
Mysql has a function called GREATEST which returns the highest value in a series of columns. The problem in this case is to find the second highest value. My idea was to exchange the highest value…
-
3
votes3
answers1471
viewsA: How do I use a constant within a class method?
Generally, to use your constant in the application just do this: <?php echo FOO; This works because the define remains constant in the overall scope of the application. In the case of your class,…
-
6
votes2
answers13586
viewsA: Use of $_REQUEST instead of $_GET, $_POST and $_COOKIE
TL:DR In efficiency issues, there is no gain for PHP when accessing one variable or another, but its use can generate unexpected results. The harm in using the $_REQUEST always use the $_REQUEST for…
-
20
votes1
answer9649
viewsA: Which UTF-8 "collate" is the most suitable for Web (multi-language)
The main difference is in how the utf8_general_ci and utf8_unicode_ci make comparisons similar to some phonemes. For example, in the German language the character "ß" would be equivalent to "ss".…
-
1
votes1
answer108
viewsA: Autoload error when using Highchartsphp
Check your Poser and the file vendor/autoload.php are up to date. Before executing the composer update, execute the commands below: To update the Composer: composer selfupdate To generate the…
-
8
votes1
answer18490
viewsA: Add Column in SQL server
Use a GROUP BY together with the SUM() SELECT ColA, SUM(ColB) FROM tabela GROUP BY ColA;
-
1
votes1
answer648
viewsA: Filter the return of Stored Procedure
What you want to do is impossible via Stored Procedures due to the way it works, as if you a closed function. If you need to increase your query you can: 1 - Insert this parameter as argument of…
-
1
votes1
answer315
viewsA: How to calculate database usage in Microsoft Azure?
I do not know in depth the plans of Locaweb, for a quick search saw that they offer SQL Server 2008 only which is an outdated (were released 3 versions after it and the 2008 version has no more…
-
60
votes4
answers5144
viewsA: What does the "@" sign on C" mean?
Means a string literal, or a string raw, without considering the escape characters. The character \ acts as an escape to insert special characters in string, and as it is a network address, you…
-
7
votes1
answer108
viewsA: How to serialize an Exception with closure
If this is not a problem, you can include a package in your project to enable the serialization of Clousures. Remember that Laravel 4 uses this same package for the same problem:…
-
1
votes1
answer90
viewsA: Delete images sent by ckeditor
You can use the DOM to manipulate your HTML in PHP. <?php $string = '<p><img alt="" src="http://intranet.supersoft.com.br/novo/ckeditor-integrated/uploads/images/imagem.jpg"…
-
9
votes1
answer2567
views -
2
votes1
answer211
viewsA: Is there a command to change a user-created type in Sql Server?
Cannot directly change the structure of the type (something like ALTER TYPE). What is possible is to create a temporary type with a new definition, change all tables with this field in your database…
-
5
votes1
answer63
viewsA: Code is not executed on command line
The problem lies in your opening tags <? To use them you need to enable in the configuration of php.ini the option short_tags_open for on. More information on this configuration here. On the…
-
2
votes2
answers54
viewsA: Error using libraries in PHP
The error is due to the use of Namespaces in your code. Note the use of the word use in your code. In this part of your application it is used to import the specific Namespace that will be used in…
-
4
votes2
answers267
viewsA: Delete method returns unencumbered page
The problem in your form is in how the method was set. HTML forms in HTML only support the methods POST and GET. In contrast, HTTP has other methods, such as DELETE, PUT and PATH. Some frameworks,…
-
4
votes1
answer4338
viewsA: Command for Fill Effect in Excel VBA
You would need to enter the following properties of Interior of your object Cell to have the desired effect: Range(Celula).Select With Selection.Interior .Pattern = xlVertical .PatternColorIndex =…
-
4
votes2
answers1937
viewsA: Error: "PHP Startup: sqlsrv: Unable to initialize module"
Xammp does not keep track of the Dlls needed to connect to SQL Server, you need to manually download and copy to your PHP extensions folder. You can download the latest versions of driver here. This…
-
2
votes3
answers4546
viewsA: How to make a foreach for an array of arrays?
If it is an array with only two dimensions, as the output of a database for example, the array_column is the simplest solution: <?php $array = [ ['nome' => 'Luis', 'id' => 31], ['nome'…
-
1
votes3
answers799
viewsA: Delete Item Array
Hugo, I’ve changed your role to receive parameters as reference, so it becomes simpler to remove unwanted lines. Based on your comment, I thought it would be safer to exchange the comparison of…
-
0
votes2
answers1515
viewsQ: Remember user and password of an Oracle ODBC connection
I am connecting an Oracle database with an Access database through Oracle ODBC Driver 11.2. The problem is that every time I access the base in Access, the driver from Oracle requests…
-
9
votes3
answers1320
viewsA: What are braces {} in an SQL string for?
What are braces {} in the following SQL string used in PHP for Mysql? In this case for nothing. PHP will interpret the keys and return you something like this: $tabela = 'user'; $fields =…
-
0
votes1
answer414
viewsA: Installation of Laravel 4 on remote server
In my company I use a git repository that from a hook post-receive fire a command composer install in the code that was made the deploy. It’s quite simple, but requires a certain knowledge of git…
-
3
votes2
answers4154
viewsA: DROP DATABASE in phpMyAdmin
In phpMyAdmin if I do not have memory of the command DROP DATABASE is disabled for security reasons. To activate it you need to change the phpMyAdmin configuration. Look for the line…
-
10
votes5
answers53548
viewsA: Mysql decimal value
In Mysql we have some types of data to store decimal numbers: FLOAT and DOUBLE Both represent numbers with floating points. The difference between both is in their accuracy and in the size in bytes…
-
4
votes1
answer567
viewsA: Translation Laravel 4
In this repository of Github we have in total 37 translations for the messages of Laravel 4, including PT-BR. https://github.com/caouecs/Laravel4-lang Just give a git clone and copy to directory for…
-
1
votes1
answer136
viewsA: Sessions on a login system
In part $_SESSION["$Email"] take off the $. You are telling php that you want to use the contents of the variable as the session index $Email, which is not defined in the vector. Preferably, when…