Posts by gmsantos • 17,221 points
395 posts
-
5
votes2
answers2452
viewsA: How to make a database connection using the Singleton design standard
The Pattern Singleton consists of always returning the same instance of a given class to any point in the application. This is done by limiting the access to the constructor method and returning the…
-
1
votes2
answers170
viewsA: How to run all files inside a Folder
Create a batch with the following content (Assuming you are using 32-bit version): "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --playlist-autostart --loop --fullscreen --playlist-tree %1 Mode of…
-
1
votes3
answers525
viewsA: Doubt with Mysqli and PHP OO
In object orientation we have class properties, which are nothing more than variables within the scope of the class. The mysqli allows both procedural method (which is what you are using) and…
-
3
votes2
answers379
viewsA: How many images can I save to a mysql blob field?
Usually a column blob is made to store an image only. If you need to store more than one image per entity, the solution to your problem would be to normalize the blob for a second external table:…
-
6
votes1
answer873
viewsA: Place an IF with various conditions
The problem with your if is that the or are comparing nothing to nothing. You need to compare again to something ($row[??] in your case): if ($row['xpto'] != '' and $row['xpto'] != NULL and…
-
4
votes2
answers1630
viewsA: In php how to run a function after past X days of last run
I see no problem using a common date for this calculation if you don’t need that millisecond precision. My idea would be to use the class DateTime to check the difference of 15 days <?php //…
-
9
votes3
answers6637
viewsA: Run PHP function asynchronously
Yes, from some external libraries it is possible to implement similar things quite simply. The best known project is the reactPHP. There is a very interesting benchmark comparing the reactPHP with…
-
5
votes1
answer888
viewsA: PHP (setcookie) vs header (header )
Both functions come to the same result. But what differentiates the setcookie() is its ease for creating more complex cookies, with expiration date, domain of the application that the cookie will be…
-
4
votes2
answers800
viewsA: Check if a sequence of numbers corresponds to a valid timestamp
TL;DR Use the class DateTime PHP and dates represented in a different format than UNIX timestamp to not have problems with dates. A UNIX timestamp is the number of seconds that have passed since the…
-
0
votes1
answer724
viewsA: MS Access - how to get 30-day date range
In your query, use the expression SomData() (or DateAdd() in Access in English) as a criterion in the column of the following date form: >= SomData("d"; -30; Data() ) He makes a WHERE field…
-
1
votes2
answers893
viewsA: Calculate the difference between timezone dates
I suggest you convert to a common Timezone when storing the posting date (server Timezone for example). When displaying the date to the user, convert the date stored on the server using DateTime…
-
2
votes2
answers873
viewsA: Difference between two Multidimensional Arrays with PHP
Since the key is relevant to the comparison between the arrays (idAmbiente), what you are looking for is something closer to a array_diff_assoc Because its arrays are multidimensional, it will take…
-
9
votes3
answers51028
viewsA: Regex - Special Character Removal C#
I don’t know a specific list for these characters. One approach that you can use is the reverse: to subistituite all the characters that nay belong to a certain interval, with an interval denied [^…
-
2
votes1
answer2652
viewsA: Eclipse Dark in windows
There is still a long way to go before opensource projects (Eclipse and Netbeans) have a cool dark theme on Windows like VS. Eclipse Luna’s dark theme is already a step. As Renan mentioned, it is…
-
5
votes2
answers310
viewsQ: Static Methods in Factory Method
I’m creating a class using Factory Method and I came up with the following question:. The use of static methods in Factories? In many examples I found we have to create an instance of the class…
-
2
votes1
answer142
views -
11
votes3
answers6549
viewsA: What are providers? What is the difference between OLE DB and ODBC?
The difference is in the resources that each account and the databases that it supports. The ODBC (Open Database Connectivity) is a standard for access to database management systems (DBMS). They…
-
2
votes3
answers415
viewsA: Automatic method execution
Just point at this scheduled URL a file with the method call of that class File Class: <?php // path/minhaClasse.php class minhaClasse{ public function meuMetodo($parametro){ // Faz alguma coisa…
-
16
votes1
answer5461
viewsA: Which encoding to choose for a database?
The choice of charset your database will depend on the application that will use the same. The UTF-8 is a pattern that supports beyond the Latin characters, Greek characters, Hebrew characters,…
-
3
votes1
answer236
viewsA: Enter dates in the database?
It is possible to generate these dates from the following loop. Adapt the loop according to the codeigniter insertion method (I don’t remember what Active Record syntax looks like) <?php…
-
2
votes1
answer129
viewsA: Problem with mounting SQL query
Your condition separator is not properly separating the string passed via POST, which results in a query with no results. Example by selecting two checkboxs (Portuguese and math) with the student…
-
1
votes1
answer72
viewsA: Php data disappears on page
The syntax of your file is all messed up. You forgot several echo and quotes without closing during the course of your code! The following code will work as desired: <?php echo '<div…
-
3
votes4
answers2718
viewsA: Generate sequential Ids without losing the sequence
The resource you are looking for exists from the SQL Server 2012 and is called SEQUENCES. As SEQUENCES are objects used to generate auto numbering values, where we can define the initial values and…
-
5
votes1
answer5423
viewsA: How to disable a Constraint in ORACLE?
You can disable the Constraint check via a ALTER TABLE : ALTER TABLE tabela DISABLE CONSTRAINT nome_da_constraint; But be aware that this can lead to duplicity issues in your table if you don’t fix…
-
9
votes2
answers6772
viewsA: How to do similar word searches in SQL?
In some databases it is possible to do this type of search that is called Fuzzy Matching. You can get this result through the functions soundex() and difference(). I know they exist in SQL Server…
-
3
votes4
answers6030
views -
1
votes4
answers713
viewsA: Search from between dates
Based on Bacco’s response, we can use the function CURDATE() Mysql to return current day without the time information. So we don’t have to worry about increasing or decreasing one day of the…
-
2
votes2
answers4968
viewsA: Error initializing SQL Server Express
Do not use the services.msc to start SQL Server services. It does not properly start SQL Server services. Instead try to restart the service using the SQL Server Configuration Manager More…
-
14
votes4
answers1643
viewsA: Is it really necessary to define constraints in the database?
On a production server, I wouldn’t rely solely on the application to ensure data integrity. The function of foreign keys is exactly to ensure the relationship between the tables of the Bank.…
-
2
votes1
answer5772
viewsQ: Using the Excel Application object within Access
I am creating a VBA script that exports a table in multiple shared excel sheets in a specific directory. The problem is that Excel sends a warning to confirm the file save for each file. I would…
-
3
votes1
answer7721
viewsA: How to change the language of Microsoft SQL Server Management Studio?
Unfortunately SQL Server does not have Language Packs for the SSMS interface. Try to download the ISO into dreamspark in English. Another alternative is to download only SQL Server Management Studio…
-
1
votes2
answers1110
viewsA: Laravel 4 (Eloquent) Error deleting records
Try the following: public function destroy_download($id = 0){ $ids = ($id >= 1) ? array($id) : Input::get('ids'); if( ! empty($ids) ){ foreach ($ids as $id) { try {…
-
2
votes2
answers129
viewsA: Undefined Index
The error is in your view. You are returning a list of users on $this->User->find('all'); but in your view you are displaying the data of a single user. To display the list in the view, use…
-
6
votes4
answers1506
viewsA: Direct method call in instance
PHP >= 5.4 From PHP 5.4 you can do the following: print (new Pessoa("Vinicius"))->getNome(); PHP < 5.4 For versions prior to 5.4, it is possible to obtain a similar result by declaring a…
-
2
votes2
answers1154
viewsA: Git (and git bash) does not work on Windows 8
An excellent console for windows is the Cmder. In addition to numerous settings, it already includes msysgit. It’s worth taking a look and see if it suits you.…
-
1
votes2
answers134
viewsA: How to use Logicexception from PHP?
LogicException according to the PHP documentation, it is kind of exception related to some logic error in your application, which will imply a change in your code. In other words, it would be the…
-
17
votes2
answers713
viewsA: How to simplify the following IF in PHP?
In case your keys array do not repeat themselves between them you can do the following: $todosArrays = $IdUserOnline2 + $IdUserComum2 + $IdUserNovo2; $IdsInteracoes = implode(',',$todosArrays); You…
-
1
votes1
answer402
viewsA: Which regular expression to use to replace all occurrences found in an Eclipse file?
I don’t know what the eclipse syntax looks like, but a Regex that can solve this problem is as follows (in javascript): ^@external (.+)$ It would marry everything in parentheses (group) until the…
-
4
votes2
answers1304
viewsA: How to hold the value of a POST between paging in Codeigniter?
Instead of POST, you can pass the value of this <select> via GET and put it in your paging. Example of link without filter: pagina.php?p=3 Example of the link with the filter:…
-
2
votes2
answers317
viewsA: Problem with Seed Relationship between Category and Sub-Category in Laravel 4
Manually enter your primary key into your categories so you can create the subcategory relationship. Regarding the Migration reset, you can instruct your Database not to perform foreign key…
-
3
votes1
answer416
views -
2
votes1
answer444
viewsA: How does Html5 cache work?
With HTML 5 it is possible to cache a full page or make use of a file CACHE MANIFEST for such. For the browser to cache the page only, its HTML tag should look like this: <html…
-
4
votes2
answers394
viewsA: Get inverse relationship with Laravel
Well, I would implement it that way: It would unify categories and sessions into a single table by adding an "id_parent" column, referencing the table itself and allowing nulls. So the sessions…
-
0
votes3
answers134
viewsA: Is there a PHP function that simulates a LEFT JOIN?
Based on the responses and comments I arrived the following implementations: function array_left_join($arrayChaves, $arrayValores){ $arrayIntersect = array_intersect_key($arrayValores,…
-
4
votes3
answers134
viewsQ: Is there a PHP function that simulates a LEFT JOIN?
I’m developing a PHP application that needs to display a graphical indicator. The problem is that the data comes from an external API and depending on the filter applied, the API does not return me…