Posts by Guerra • 8,533 points
116 posts
-
23
votes4
answers13910
viewsA: What is the best way to represent an Address?
In my opinion the best address database in Brazil is the e-DNE that has more than 900 thousand records and, in my opinion, works very fast. Follow the diagram of their seat. When I needed to use…
-
12
votes3
answers4056
viewsA: How to get the value of the current percentage of an upload?
Using the ajaxform jquery plugin to do so: $('form').ajaxForm({ beforeSend: function() { status.empty(); var percentVal = '0%'; bar.width(percentVal); percent.html(percentVal); }, uploadProgress:…
-
3
votes6
answers3652
viewsA: How to detect page encoding with PHP?
The best way to convert ISO 8859-1 character to UTF8 I found was this: function fixEncoding($in_str) { $cur_encoding = mb_detect_encoding($in_str) ; if($cur_encoding == "UTF-8" &&…
-
2
votes4
answers8320
viewsA: What is the difference between client-side and server-side code in web development?
Client-side = runs client-side, e.g.: Javascript. Server-side = runs on the server, e.g.: PHP, C#, etc.
-
2
votes4
answers18077
viewsA: How to organize auto-increment numbering of a column Id of a table in Mysql?
There are 2 ways, but both are expensive to use in everyday life. First I’ll use as an example your situation, you deleted id 4 in which case it would be something like this: update tabela set id =…
-
54
votes6
answers12507
viewsA: Why shouldn’t we use mysql_* functions?
For a simple reason is enough for many: This Mysql extension has been discontinued by the PHP development team. But then you ask me, why was it discontinued since it was simple and worked cool? I…
-
247
votes6
answers12507
viewsQ: Why shouldn’t we use mysql_* functions?
A very common question is why should we stop using mysql_* functions? For example mysql_query(), or mysql_connect(). I see that many people use them, or stop using them but do not know the real…
-
3
votes5
answers28367
viewsA: When to use self vs $this in PHP?
The $this points to the object and the self points to the class itself. The self can also be used when the class extends another and you want to access the implementation of it or its relative for…
-
47
votes5
answers28367
viewsQ: When to use self vs $this in PHP?
I see it as a very frequent doubt: When should we use the self::, or the $this in PHP. Which form is best suited for use and what is the difference between the 2 situations?…
-
5
votes3
answers946
viewsA: Run function for each class you find
To perform a certain function for each element is used: $('.thumb img').each(function(){ if($(this).width()<$(this).height()){//portrait $(this).css({ maxWidth:'100%' }); $(this).css({…
-
3
votes2
answers15027
viewsA: How can I refer to the heaviest queries in SQL Server?
There are tools that can help you like Navicat which has a monitoring feature. Or the Monyog. If you want to do in hand there are these commands: EXECUTE sp_who2 And with this command you can…
-
-5
votes4
answers2543
viewsA: Insert paragraphs from a JSON file into a DIV
Using regular Expression is possible this way: str = str.replaceAll("(\r\n|\n)", "<br />");
-
5
votes7
answers8794
viewsA: How to Convert Mysql Database?
The ideal is to configure your server to generate a DUMP of the database as well as your data in a text file, and perform the versioning through this. Versioning of the database itself is not…
-
1
votes2
answers32948
viewsA: How to send SMS for free using PHP?
To send SMS via code what happens basically is that you use an API of some carrier that when sending your request to the same it will trigger a mobile device that will send your SMS. I do not know…
-
13
votes5
answers22775
viewsA: What is the best way to iterate objects on a Hashmap?
Using the method entrySet(), Example: public static void printMap(Map mp) { Iterator it = mp.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry)it.next();…
-
134
votes10
answers34548
viewsA: What is the difference between the == and === Javascript operators?
The operator == compares by "result" so to speak, in other words, since Javascript is not strongly typed it converts what you want to compare and checks: if (true == 'true') // aqui vai dar true if…