Posts by gpupo • 2,181 points
62 posts
-
2
votes1
answer64
views -
3
votes2
answers1770
viewsA: How to force a drop table into SQL?
Do so: SET foreign_key_checks = 0; Drop table ... The SET foreign_key_checks = 0 will remove the foreign key check. Remember to return the check to the original value with SET foreign_key_checks =…
-
0
votes1
answer32
viewsA: Update site Symfony2
After modifying the file, clear the cache using console: php bin/console cache:clear --env=prod Each environment (env) has a cache configuration so, by default, the development environment does not…
-
1
votes2
answers241
viewsA: A file with multiple functions OR multiple files with a function?
In this amount of functions, that is irrelevant. Hardly you will find a file by function in old systems that used this structure that is now considered unproductive, unless you are doing something…
-
2
votes2
answers73
viewsA: Use unique identifier timestamp in a PHP process?
Yes, the chance of conflict is great. Ideally, each transaction should receive a unique incremental identifier, but if this is not possible, I recommend using a prefix with the machine…
-
0
votes2
answers171
viewsA: Check the status of a service on Amazon
You can use the service AWS Cloudwatch to create a Dashboard of their services and to trigger alerts as soon as one of the services leaves the standard. For example, trigger an alert when the CPU of…
-
0
votes1
answer49
views -
6
votes2
answers44
viewsA: Functions in Javascript
Some problems with the code: 1) You are declaring functions within a lambda (anonymous function). If you’re actually going to use declared functions, you should leave them outside the event you’re…
javascriptanswered gpupo 2,181 -
3
votes2
answers86
viewsA: Problem with use in PHP
I am considering that you are dealing with a legacy application and that it is not convenient to adopt the best loading practices so I see that you can leave the way it is without compromising…
-
3
votes2
answers97
viewsA: What does the expression "for x in *" do?
This, written the way it is, does the same thing as the command ls The * is being used as a joker. Try it this way: for x in *.zip;do echo $x; done; You can use the same rules that you use on ls, as…
-
1
votes1
answer470
viewsA: recover localstorage array and turn into a sql query in php
You must make the looping in a result requested by AJAX to a PHP controller and in this request you sent the contents of localStorage.getItem("favoritos") which will be processed by PHP. In short:…
-
0
votes1
answer118
viewsA: Use Jekyll Folder with option to list categories
To get what you want I recommend you use collections. Continue with your posts in the traditional way and keep your projects in the directory _projects. Add these lines to _config.yml: collections:…
-
5
votes1
answer2573
viewsA: Aws change instance EC2 from one region to another
There is no simple way to do this, but you can follow this script in the AWS Console itself (web Adm): Create the image of each instance Turn this image into a model available in the new region…
-
0
votes6
answers17792
viewsA: Accentuation problem while recovering records in SQL Server
There are answers that already make a good instruction on how to model your application for the same encoding of the database. However, I want to leave my answer to be used by those who want to keep…
-
1
votes2
answers931
viewsA: Why doesn’t my javascript work?
pegaNome() does not return a string you expect to print in mostra(). Make sure pegaNome() return any string to debug before trying to fetch an element value. Another thing that is wrong in your code…
javascriptanswered gpupo 2,181 -
0
votes1
answer205
viewsA: Bypass FTP lock
whereas it is a fact cannot simply add the IP of your Server to the Firewall white list of the server where the file is, you will need to configure, on any server located in Brazil, the forward port…
-
4
votes1
answer60
viewsA: How to make a RDS instance via Inbound Rules/Securitygroups receive access from an EC2 instance?
Use the Subnet CIDR because in case of substitution of the EC2 Instance as for example in a repair case from a Snapshot, you do not need to change the rule.
-
1
votes0
answers401
viewsQ: Service or package to generate Nfe possessing only the Invoice key
With only the Nfe key I can access the Revenue website and view the Invoice in PDF. You can use a third-party service or bundle that manages such PDF in the same way as Recipe offers, possessing…
-
2
votes1
answer624
viewsA: Simple contact form sending email via Amazon SES with PHP
The three alternatives work, however you should consider the application resistance need and shipping quantity. In Alternative 1, your system is connected directly to Aws SMTP and is locked while…
-
1
votes3
answers598
viewsA: Check if there was POST with Javascript
In case you’re using jQuery, can add a custom header to all Ajax requests, using the following script syntax loaded right after jQuery load: <script> jQuery.ajaxSetup({headers:…
-
5
votes7
answers1478
viewsA: Is using many interfaces a bad programming practice?
Only use Interfaces if you use Design by contract (Dbc). If you don’t use Dbc, keep your code dry without using interfaces. This is "the best" from the values of Lean Software Development because it…
-
0
votes1
answer64
viewsA: Index Google Shopping standard XML in Sphinx Search
Use the Pipe2: ./pipe2.phar convert:google data/google-shopping-sample.xml Use in Sphinx configuration: source xmlSource { type = xmlpipe xmlpipe_command = /usr/local/bin/pipe2 convert:google…
-
7
votes1
answer226
viewsQ: Server Side rendering need for javascript content - Angularjs
Knowing that from this year google Crawler performs javascript, considering the indexing of a content that is displayed using Angularjs, there is still the need for a version of the same content…
-
4
votes1
answer93
viewsA: Change lines of code within files with Apache Ant
You can use other OS executable resources and generate one task. In your case, you could create a ant task using sed. Another option is the replaceregexp Example: <replaceregexp byline="true">…
-
4
votes3
answers6637
viewsA: Run PHP function asynchronously
You can get this result using parallelism with the PHP extension Gearman Example: <?php # Criação do worker $gmworker= new GearmanWorker(); # Adicionando um servidor (localhost é o padrão)…
-
1
votes3
answers5312
viewsA: How to add line break using sed?
Use sed 's/.*oo.*/&\'$'\n/g' but to catch foo you need to improve the standard: echo 'foo bar' | sed 's/.*oo/&\'$'\n/g'
-
1
votes2
answers1213
viewsA: Amazon SES - Registry.br DNS Server domain verification
Always insert TXT records between double quotes. Add as follows: "/xYz24aNPG4mH2k+amyZer8aDRdqcyQ9ZWZ2w1Fcn6w=" and check the result using dig: dig seudominio.com.br TXT If you are using aws, I…
-
4
votes2
answers2346
viewsA: Code indentation spacing standardization
There are several patterns. The most common is the identation with 4 spaces. I recommend the Google HTML/CSS Style Guide as standard for HTML and CSS. Indentation Indent by 2 Spaces at a time. Don’t…
-
6
votes1
answer398
viewsA: Paypal receive transaction update
To receive information, both in feedback after checkout and later (in cases of more time consuming analysis), you need to implement a Controller which will be accessed by Paypal at a later time, in…
-
1
votes1
answer124
views -
5
votes2
answers408
viewsA: Loop json with PHP
Step 1: Transform JSON into Array using json_decode(); Step 2: Use foreach in the Arraypreviously generated.
-
5
votes1
answer323
viewsQ: How to get SHA1 from a String in Swift?
I know there’s an object SHA1 but I’m still learning the syntax, so, my beginner question is, given a simple string: var greeting = "Hello!" How to get SHA1 from greeting in Swift?…
-
1
votes1
answer147
viewsA: How to retrieve the contents of a rendered template in Symfony2 and store in a String
SF2 returns the object \Symfony\Component\HttpFoundation\Response in his controller. For you to have access to string Html, you can do it this way: <?php /** * State controller. * *…
-
5
votes1
answer157
viewsA: About fallback for CDN
In most types of downtime, yes, will slow down the page, but at least it will work. If the downtime is the type that responds quickly to unavailability, for example an internal error, this will be…
-
2
votes5
answers23429
viewsA: Calling js function in another file - Dependency between Javascript scripts
You can make the first script execute an existing function in the second script, but to do so you must trigger the event execution onloaddocument as this example (using jQuery):…
javascriptanswered gpupo 2,181 -
6
votes1
answer581
viewsA: Block login via CURL PHP
It is possible if you use a good engineering for Cross-Site Request Forgery (CSRF) Prevention. Basically, your form will have a field where you store a token which has a lifespan and is validated at…
-
4
votes3
answers7761
viewsA: How to call Javascript functions in another Javascript
The functions you load in the global scope can be used in any script that is loaded in the sequence. This is for both inline and included javascript. You can also make the first script execute an…
javascriptanswered gpupo 2,181 -
2
votes2
answers1064
viewsA: When to use cache system in PHP?
Yes, you must use. In PHP, for simple use, as a website that runs on a single machine, use APC, preferably passing through an object of yours that manages reading and writing, such as the ZF2 Cache…
-
5
votes3
answers279
viewsQ: How to test whether an instance is dynamic or static?
Say you access an object you don’t know how it was created and you want to know if it was instantiated as new \Acme\Foo() or if it was just returned \Acme\Foo; What is the most practical test ?…
-
1
votes2
answers1809
viewsA: Take a value that is within a <span> on another site using PHP
You can use a PHP Client that does the processing DOM of the document that is in this URI. One component that can help you is the Goutte: <?php use Goutte\Client; $client = new Client; $crawler =…
-
2
votes1
answer878
viewsA: How do I get php code commented correctly?
Using Docblock Comment standards. However, I don’t personally use tags like package for the very namespace already meets this need. See the PHP DOC Tag List Tags: @api @Author @Category @copyright…
-
0
votes1
answer77
viewsQ: What features to use when creating a Chrome extension for notifications
I want to create a Chrome extension that periodically checks a response URI JSON and that displays a notification to the user (in some cases). This must happen, regardless of the website where the…
google-chrome-extensionasked gpupo 2,181 -
6
votes4
answers30006
viewsA: Limit text display in PHP
Do so: <?php echo substr($row["catname"], 0, 20);//Apenas os primeiros 20 caracteres
-
7
votes3
answers1335
viewsA: Why is it bad practice to use Javascript inline?
Disadvantages: Failure to re-use the code As a consequence of item 1, the customer needs to ALWAYS download the code Logical that you can eliminate the problem 1 using includes in its server side…
javascriptanswered gpupo 2,181 -
1
votes1
answer111
viewsA: Web Hosting or Streaming Hosting?
I believe you will have other variables like copyright protection, but then there is no quick answer to "what’s the best solution," but yes, what’s the ideal solution for your case. I believe you…
-
1
votes2
answers1836
viewsA: Download file with Curl and php
Not use PHP to do this, but yes, use Apache reverse proxy: Example of configuration (part) in server1: ProxyPass /arquivos/ http://server2.example.com/ or you can still work with file types:…
-
8
votes2
answers2431
viewsA: Working with Git on a day-to-day basis with two different computers
You’ve made yourself complicated from this point: Now I’m coming home and will continue to work on the project. So I give the git pull command to download the latest changes. Only I already have on…
-
6
votes3
answers302
viewsQ: Practical use of Constant scalar Expressions in PHP and other languages
In the PHP 5.6 we will have an appeal appointed Constant scalar expressions. The manual provides some examples, but the main focus would be: How to use the functionality correctly, without doing so…
-
1
votes1
answer403
viewsA: How to pass an xml to foreach without using a file?
Simple: query processes with the laço; generates string XML echo in the header and in the XML as body of the document Example: <?php $test_array = array ( 'bla' => 'blub', 'foo' => 'bar',…
-
2
votes1
answer123
viewsQ: Bootstrap usage in legacy layout without Grid system adoption
Consider a complex, legacy, Tables-dependent layout that cannot be converted to tableless. From this premise, if we insert CSS and Javascript from Bootstrap, we could use some components (like…