Posts by Pagotti • 3,042 points
94 posts
-
2
votes2
answers437
viewsA: Send form only if any input changes
You can use the serialize jQuery. Through it you can save the state of the form fields values when it is loaded. When you submit the form, you can call again and compare to the saved state initially…
-
1
votes1
answer151
viewsA: Capture all phones from a text file
Depends on the pattern of numbers An example of regular expression: /(?:\((\d{2})\))?\s?(\d{3,5}[-\s]?\d{4})/ It will capture, in group 1 the DDD and in group 2 the number, including strokes or…
-
1
votes2
answers312
viewsA: How to round up number?
You can use the function fmod() function arred ($n) { $r = fmod($n, 1.0); if ($r != 0) { return $n - $r + 0.5; } else { return $n; } } Script with testing: http://codepad.org/slXVpUti.…
-
0
votes1
answer416
viewsA: PHP find addresses up to 5km away
Use Mysql space functions If your Mysql is version 5.6 or higher, why use the distance calculation function from the database itself. Example in mysql website: mysql> SET @g1 = Point(1,1);…
-
1
votes1
answer107
viewsA: Error in SQL Pivot function
Lack of aggregation function You need to define at least one aggregation function for the PIVOT. Example: SET @SQLSTRING = N' SELECT * FROM(SELECT Id, Nome, CNPJ, Descricao, Situacao FROM #tab1) AS…
sql-serveranswered Pagotti 3,042 -
6
votes2
answers9761
viewsA: What is an overhead?
Additional Cost This is the translation I prefer to use. Although it can be used in many contexts, I understand that the term "additional cost" seems to give a good understanding in most cases…
-
0
votes3
answers106
viewsA: More attributes in Appsettings
Name and Value Only You can add other values to Appsettings without breaking with applying? The answer to your question, to include new attributes, is nay. This happens because the appSettings is a…
-
3
votes2
answers83
viewsA: What is the syncblock?
Synchronization guarantee A function of syncblock is to do this competition control in a multitasking system. I do not know if it is in this sense that you have doubt, but I will put an example.…
-
2
votes2
answers112
viewsA: Use same sorting algorithm with different attributes
Use an interface One of the ways you change the sorting function is through the use of an interface. Following the code you have already written, without modifying the way you are doing Sort, an…
-
1
votes1
answer23
viewsA: Radiobutton is loose in the form
Radio Buttons operate inside a container Each option/radio buttom set has to be in a frame or container as a panel, for example to work together. When you put it into the form, the form is the…
visual-basic-6answered Pagotti 3,042 -
1
votes1
answer605
viewsA: Problem Recovering User Geolocation
Browser Restriction On this page of w3schools you can find more details about the use of geolocation functions with examples. Even has code for you to check if the browser supports this…
javascriptanswered Pagotti 3,042 -
1
votes3
answers1556
viewsA: SQL in the code or in the database?
Depends on the System The answers that have already been presented are very good, but I will contribute other aspects that may not exist in your project, but may be relevant to others. It is good…
-
4
votes2
answers83
viewsA: How do I convert this php code to javascript?
Use the corresponding functions PHP substr > Javascript substr PHP strpos > Javascript indexOf PHP operator . > Javascript operator + The structure of IF and the logical operators are the…
-
2
votes2
answers564
viewsA: What are the differences between jQuery and jQuery Mobile?
Framework for mobile front-end The manufacturer’s own definition: jQuery Mobile is a touch-friendly UI framework built on jQuery Core that Works Across all popular mobile, tablet and desktop…
-
1
votes4
answers1662
viewsA: Comparing and updating data from an HTML table with data returned via JSON?
Use a dictionary To update the array doing only the update of the items, without having to clean and regenerate the array, you can use a dictionary that relates the key to the item index and update…
-
0
votes2
answers233
viewsA: Search for data in Json and display time in time and move on to javascrtipt
Using the $.getJSON jQuery You can use code similar to the one in which you put a timer to update every 5 seconds, which will fetch a JSON via ajax and update something via JS when it returns.…
-
0
votes1
answer184
viewsA: MDX - Monthly Average Open by Date
Use the function Descendants The function Descendants returns members of a certain level from the specified member. Thus, you would have as set result to apply in AVG the dates which are the…
-
2
votes2
answers4388
viewsA: Error creating table: Invalid default value for
Version of Mysql Only from the 5.6 you can use DATETIME using the DEFAULT automatic updating. In the 5.5 the type of data needs to be TIMESTAMP Edited: Had suggested in the reply to change the type…
-
4
votes2
answers110
viewsA: PHP logic problem
Use the array_filter With this function you can specify a filter by plan and method and if you do not return any element of the array it is because it does not exist. If you need to know the array…
-
13
votes2
answers1065
viewsA: What problem do Microservices solve?
Divide and Conquer It’s kind of a cliché, but that’s pretty much it. I will try to put what I understand that architecture tries to solve, but of course the subject is quite extensive. Briefly I…
-
2
votes4
answers1903
viewsA: How to join two lines in SELECT?
Separate into two sub-queries Your question is incomplete to do more testing but I believe the way is for you to create two sub-queries and then join with users. A SELECT representing incoming calls…
-
0
votes3
answers135
viewsA: When we include a script or CSS file in the HTML document, does an HTTP request occur?
Separate is better than Together See how the flow works Browser <-> Server: You type the URL in the browser and the request (Request) is done to the server. The server, after processing…
-
3
votes3
answers302
viewsA: What is a module in PHP?
Module is the calling script The expression "module" in this context has meaning similar to "another script that is not the PHP file itself". I believe it was written that way because the return has…
-
2
votes4
answers388
viewsA: Regex to capture infinite groups in a URL by separating them by the bar
Using Regular Expression Although the easiest way to solve it is with the explode, if you want to use regular expression, here is: $input = '/Controller/Action/Param1/Param2/Param3/';…
-
9
votes1
answer7629
viewsA: What is the difference between simulator and emulator?
Simulation is imitating. Emulation is playing. Based in that OS response, which is opposed to that other response from the OS, and also in that famous book that was famous at the time of the release…
terminologyanswered Pagotti 3,042 -
1
votes1
answer234
viewsA: argument out of range Exception was unhandled
Use Math.Min I was wondering if you have any code to specify that as much as you can reach is 100 and do not go beyond that To min function class Math can do this maximum value control. It will…
-
5
votes1
answer2030
viewsA: Line break inside a Boostrap Popover
Use the HTML property To place HTML content inside the text or title, adjust the property html for true. See the specification of popover Example: $(document).ready(function(){…
-
15
votes4
answers1508
viewsA: What is the difference between continuous integration and continuous delivery?
Integration is process. Delivery is result. Continuous integration is a process for the purpose of controlling the code lifecycle of a system developed by several people and which has several…
-
1
votes3
answers937
viewsA: How to insert into mysql using foreach?
You can use the Implode You can use the implode of php to merge tags and save to a field varchar. $tags = implode(",", $contacts->tags); If you need to Insert or Update can use a command INSERT…
-
0
votes2
answers1080
viewsA: How to calculate the time from point A to B?
With Mysql you can use the TIMESTAMPDIFF function With this command SELECT below you can know the amount of minutes between the two points. To select the ID of each point, in its interface you place…
-
6
votes3
answers953
viewsA: Read txt line and include ";"
Depends on the Data Pattern You can use a regular expression based on the example of data you have placed, but it is complicated to know if it will work for all lines because you do not have a…
-
3
votes2
answers163
viewsA: How to enumerate bad Smells in a software?
Divide and Conquer First of all, it’s just an opinion, a set of generic tips, maybe even the obvious. As a general rule, when you later tamper with the code, less rework will have. I think in this…
-
4
votes2
answers2038
viewsA: How do one class that is inside another inherit an instantiated variable from the last one in python?
Python requires explicitly creating the access You must access the inner class through a function in the outer class. Try it this way: class externa(object): def __init__(self, n): self.n = n def…
-
6
votes3
answers4806
viewsA: Split the database to multiple clients or create one for each?
Choose a suitable "Multi-tenant" or "Multitenancy" model In a cloud application the person/company who hires use of the system is called tenant or "tenant". It is important to give this name instead…
-
2
votes1
answer76
viewsA: Add multiple indices of a vector as parameter
The relationship needs to be Um para Muitos To have this relationship you need that class Livro has, internally, a List of Pessoa. To do this you can create a method in Livro with the name…
-
1
votes5
answers1106
viewsA: Is SOAP safer than REST?
By common sense, maybe Yes. In general people have the feeling that using SOAP is safer than REST for the following reasons (IMO): It is an older message format. It has a set of rules that prevent…
-
1
votes1
answer528
viewsA: How to search address only through google maps?
Use the option types with an Autocomplete object In your code: var searchBox = new google.maps.places.SearchBox(input); Change the object to Autocomplete and add the option types, for example: var…
-
2
votes7
answers874
viewsA: Extract Array content for PHP variables
Commando list or extract PHP has a command called list which makes the association of a tuple of variables to the values of an array. If the array, as in your example is associative (value-key), you…
-
2
votes1
answer1139
viewsA: Hashmap manipulation between classes (Interpretation and Application)
A possible answer Below is a code for you to use base for your exercise. Ideally, you look at the code, understand each part, and then do it from scratch. The most complex part is using the class…
-
19
votes3
answers17530
viewsA: Why do we have to use the attribute self as an argument in the methods?
Only one convention to make explicit the object instance within the class. The author of the language define (in question 4.21) self as follows: Self is merely a Conventional name for the first…
-
2
votes3
answers137
viewsA: Function to double salaries in n installments?
From the initial question, it seemed to me that your variable $ValorTotal it has no use within the function, so I left only the calculation of the dates, which is simpler. It would also be…
-
10
votes1
answer4168
viewsA: How to create a variable accessible in all Forms?
One way to solve it is by using a Singleton. With a Singleton you can create a static class that would act as a kind of "User Session" and there save and retrieve information that the user needs…
-
1
votes2
answers1766
viewsA: Apache PHP Server with time-consuming processes
Web server (Apache) does not crash while executing a request. Apache has a default configuration that can handle multiple simultaneous requests. It can do this by starting threads within each…
-
4
votes1
answer70
viewsA: When relating two tables, is the correct one on the SQL side, PHP or whatever?
In short, it is best to use the DBMS to join the queries. Every time you run a query in a database it will basically do the following: Interpret the SQL command to know if the syntax is correct and…