Posts by Maniero • 444,682 points
6,921 posts
-
5
votes1
answer237
viewsA: Does the last instruction of a switch need 'break'?
Directly no problem except confusion during maintenance as the bfavaretto put in his comment. I don’t have much to say about, except that it is stylistic encoding option. By the way, pretty bad if…
-
12
votes4
answers19339
viewsA: How to go to a link by clicking on a div without using <a href>
HTML5 can do this: #divlink { background-color: #D0D0D0; width: 100px; height: 100px; } a.link { display: block; height: 100%; width: 100%; text-decoration: none; } <a href="http://example.com"…
-
5
votes2
answers213
views -
4
votes1
answer147
viewsA: How to show the build version?
I think that’s all you want: @typeof(SeuNamespace.MvcApplication).Assembly.GetName().Version I put in the Github for future reference.…
-
1
votes2
answers1472
viewsA: Only get words from A-z and numbers 0-9
Just use the str_replace(). $chars = array('!', '@', '#'); echo str_replace($chars, '', 'oh! texto com # e @ para apagar!'); Behold working in the ideone. And in the repl it.. Also put on the Github…
-
3
votes2
answers212
viewsA: Why Arraylist instead of Stack in the implementation of the Memento standard?
Examples are just examples. Each one does as they see fit. If you want to know why and it is not explained where you read it, you should ask who made the example. It must have a reason. mgibsonbr…
-
6
votes3
answers1670
viewsA: Limit HTML5 Audio Controls
It is possible, but you can not choose the controls on own player. Either it’s all or nothing. Then you have to create a button manually and link it to player, which may even be an advantage because…
-
2
votes1
answer381
viewsA: How to fill Textboxes?
If I understand correctly, you can avoid the if properly said but can not avoid a decision , so I will use a ternary operator (I’ll put only what matters, then you replicate to the other fields):…
-
7
votes1
answer1258
views -
3
votes1
answer109
viewsA: Do HTML "script" tags get "thread" unique to each one in the browser?
No. You cannot separate execution in processes or threads in this way. All engine Javascript will run in a single environment. There may even be some situations that the browser can do some…
-
4
votes1
answer13146
viewsA: How to put 2 inputs side by side?
It’s very simple, the CSS has it: .campo1 { float:left; } <input type="text" class="campo1" /> <input type="checkbox" /> I put in the Github for future reference.…
-
5
votes4
answers249
viewsA: Most common words among Rows
There is no function ready to do this. I know it can be done in SQL but it’s more complicated. As my familiarity with SQL is more limited, especially from Mysql and as you put the tag php I’ll…
-
10
votes1
answer2897
viewsA: What is Bind(Include = "Property") used for?
Your remark is correct. But this attribute nullifies all Binding already defined and determines that only the properties listed in the attribute will be used. So the action (in this case) cannot…
-
7
votes2
answers1659
viewsA: What is and what is the reserved word "strictfp" for?
It’s to try to ensure compatibility between architectures. The way non Strict FP was created to give greater precision in calculations on architectures with floating point implementations with…
-
1
votes1
answer1537
viewsA: How to open a file that is within the solution with Process.Start
You see, if you want to make an application that works in all situations you need to make sure it works in all situations. If you don’t find the file you want it is likely that it doesn’t exist at…
-
12
votes2
answers1720
viewsA: Which is faster, access data in file or database?
It depends on the intention. It seems to me from the description that the file is more business. If it is exactly as you said. But there are those who like to put everything in database, at least in…
-
14
votes1
answer4417
viewsA: What’s the difference between print and echo in PHP
They are very similar. Some differences: print Returns 1 as a result and can be used in expressions echo Returns a type void, therefore cannot be used in expressions It is possible to pass several…
-
4
votes2
answers210
viewsA: How to detect USB connection via application?
It seems to me that what you want is in that reply in the OS: <receiver android:name=".DetactUSB"> <intent-filter> <action android:name="android.intent.action.UMS_CONNECTED" />…
-
3
votes3
answers2598
viewsA: How to know which component is in focus?
In this question in the OS I think you have the answer you want. Correct me if I’m wrong. You’re right in your statement. I highlight the first two answers there. Method that scans the controls to…
-
10
votes2
answers3396
viewsA: What is the use of methods with an "inter-ternal" modifier?
I imagine you know what it’s for. If not, I replied about it in that reply (is VB.NET but it’s the same thing). In short, it determines that that type or member has visibility on the entire…
-
2
votes2
answers2457
viewsA: Subtract dates and compare with value
It seems, yes you should put in Controller. I can’t guarantee because the question doesn’t go into too much detail. Without telling you where you will apply this or putting relevant parts of the…
-
8
votes3
answers1335
viewsA: How to use an object to add to an attribute?
I’ll answer since you have divergent answers and do not know what to do. You have already learned in the other answers that there is a type compatibility problem. Under normal conditions you cannot…
-
4
votes1
answer72
viewsA: OR returns unexpected result
It returns like this because you’re in charge. The OR cannot be used loosely so it is not natural language text. SELECT COUNT(id) FROM `system_stats` WHERE `name` = 1 OR 0 AND `us_id` = 0 name = 1…
-
1
votes1
answer186
viewsA: Using Ruby on Rails is it possible to perform external functions on the client side?
Not possible using any language and virtually any technology. I say this almost because it is always possible for someone to install something that goes over a fundamental restriction in a browser.…
-
5
votes2
answers167
viewsA: Use substr directly on a foreach
Any problem doing this? foreach ($exibe as $u) { $titulo = substr($u->titulo, 0, 50); echo "<div class='col-md-3'><div class='thumbnail'> "; echo "<img src='{$u->imagem}'…
-
4
votes2
answers887
viewsA: Can I use a variable to overwrite a method?
It’s okay to do this. But your question doesn’t seem to make much sense. I think you think you’re doing something you’re not doing. If I understand what you mean. I can use a variable to overwrite a…
-
4
votes2
answers755
viewsA: What does the dereferenced compilation error mean in Java?
You’re using a primitive type. The syntax used should take a reference in the variable used and primitive types have no reference, they keep the direct value without any reference. So there was a…
-
1
votes1
answer229
viewsA: Can I point to project files this way?
I think this is what you want: import java.io.*; class Main { public static void main(String[] args) { File path = new File("src", "models"); System.out.println(path.getPath());…
-
1
votes1
answer824
viewsA: How to represent in UML superscript methods
There is no universally correct form, what I see is more common to do is to place an abstract method as italic in the original class, making it clear that it must be superscripted by whoever…
-
2
votes2
answers1226
viewsA: Put pointer on second line to write?
The first mistake is to use the append. You want to write in the archive and not add something to the end of the file. The other thing is that you need to find where the first line ends and start…
-
5
votes1
answer101
viewsA: How to remove the red part of the figure?
I think you want to do this: foreach($array_banco as $item){ $fields[$item['field']] = $item['description']; } Behold working in the ideone. And in the repl it.. Also put on the Github for future…
-
2
votes1
answer39
viewsA: Get position of wxTextCtrl
Use the method GetPosition() available at wxWindow. It’s in the documentation. You probably haven’t found it because you still don’t quite understand inheritance of object orientation. A class has…
-
3
votes1
answer2607
viewsA: Can I declare a builder in the child classes when the mother class is abstract and already has a builder?
Yes, it can, the constructor is precisely to initialize essential class properties, so each class must have its own constructor. When a daughter class will initialize, she also needs to initialize…
-
6
votes3
answers1817
viewsA: Should I declare Get’s and Set’s at UML?
The most important thing is to always be consistent. This includes being consistent with what the team does. If the team is still going to define what to do I would just indicate that there are…
-
4
votes1
answer1230
viewsA: When using __constructor magic method or set and get
First you have to answer if having this data initialized in the class instance is fundamental to consider it consistent from the start. The constructor’s function is to create an instance in a valid…
-
6
votes2
answers201
views -
5
votes1
answer3636
viewsA: Convert timestamp value to date
Assuming this number is a timestamp valid would only need to create a date based on it. As we should consider only the seconds, it is multiplied by 1000. With the date in hand you can use it in the…
-
3
votes1
answer393
viewsA: Separate Rows by group and their percentage of total
You need to tell everything, group by fruit and sort by the count of each group, limiting to 10. Thus: select count(id) as contagem, fruit, concat(format((count(fruit) * 100 / (select count(*) from…
-
9
votes1
answer147
viewsA: Persisting all data as string is a problem?
Yeah. There’s no way to just manipulate string. Actually, if you do this, it’s gonna be harder since you have to do conversions all the time. Unless you have something that actually only works with…
-
4
votes4
answers765
viewsA: How to put a DB column loop inside an array?
I don’t know if I understand, but I think that’s all: $array['field'] = $colunas->fetchAll(PDO::FETCH_ASSOC); The FetchAll just returns a array complete associative whose keys are the names of…
-
4
votes2
answers770
viewsA: How to calculate average time?
Assuming that the composition of the table is configured correctly would be so using the function TIMEDIFF: SELECT AVG(TIMEDIFF(hora_que_entrou, hora_que_saiu)) FROM `visitantes` I put in the Github…
-
4
votes4
answers632
viewsA: How to execute two querys in a statement?
The two selections will have to be made separately but can bring the result at once by combining the two selections into a third. The select can return any information, even if it does not depend on…
-
3
votes1
answer872
viewsA: Change Mysql column information with UPDATE
I will tinker with what I think is what you want. I will avail to solve some other problems but not all. <?php // definições de host, database, usuário e senha $server = ""; $usuario = ""; $banco…
-
3
votes1
answer628
viewsA: How to use variables in a location outside the scope where they were created?
Whenever you need a variable in a certain scope you must declare it in that scope. If you declare in an outer scope what you need it is accessible more than it should. The compiler will not give…
-
2
votes2
answers651
viewsA: Licensing of Mysql
Yes, you can distribute Mysql along with your application without any problem for you or your client. I just won’t say no future risk at all because we’re talking about an Oracle product, the…
-
4
votes1
answer187
viewsA: I cannot display the SQL value
I changed something that is obviously wrong. I don’t know if it will produce the result you expect but at least it shows you where the error is. You ended the while with a ;. It will not keep…
-
2
votes3
answers1501
viewsA: Read objects saved in.dat file
You cannot record objects and then read them to memory. You need to serialize them. In fact you’re trying to make a serialization when you use the cast (char *) but it doesn’t give the result you…
-
6
votes2
answers865
viewsA: ASP.NET vNext in Apache
Microsoft has changed its stance with the entire platform. In that reply i talk about the new . NET Core which is not only open source but has the principle to run on any platform. We are talking…
-
6
votes1
answer805
viewsA: How to simulate concurrent traffic/access arbitrarily in Apache?
You will have to use appropriate software. You can even do it on your own but it takes work and you probably won’t do it properly. You need to test normal and overrated load until the server no…
-
3
votes3
answers880
viewsA: Integer for String
I just took a test and it worked: #include <string> int main() { std::string s = std::to_string(10); } If it doesn’t work you’re probably using an old compiler. I strongly advise you to update…