Posts by Henrique Barcelos • 376 points
9 posts
-
1
votes3
answers5312
viewsA: How to add line break using sed?
& represents ALL the string that matches the pattern, so you’re just adding a line break to the end of the line. This generates the expected output here: echo 'foo bar' | sed 's/\(.*oo\)…
-
1
votes3
answers462
viewsA: My code does not abort form submission as it should
Just some good practice considerations: Do not use attributes on* directly in HTML, as it makes changes difficult and is not scalable. There is a better way to prevent a form from being sent. Do it…
-
1
votes4
answers1241
viewsA: Problem in CSS and JS path in MVC project
I don’t know if you’re familiar with the concept of View Helpers, if not, do a search around. What I usually do is create a helper that helps me solve the paths to these resources (Assets): <link…
phpanswered Henrique Barcelos 376 -
3
votes3
answers6240
viewsA: What would be the best way to make a CRUD for a framework in the most generic way possible?
It is worth noting that there is an abstraction level difference between standards such as MVC, MVP, MVVM and those Enterprise or Gof standards (Adapter, Iterator, Bridge, Composite, Intercepting…
-
6
votes4
answers1700
viewsA: Understanding Node and Applications in Real-Time
Node replaces Apache and I have to choose between one and the other? The nodejs has its own webserver, but is compatible with Apache, Lighttpd, Nginx and others. To make it run over the Apache,…
-
0
votes2
answers211
viewsA: Doubt about inheritance in classes
Remember that builders have no return. The best way to do what you want is through exceptions: # relatorio venda controller class RelatorioVendaController { public function __construct($form) {…
-
1
votes2
answers282
viewsA: foreach PHP for Javascript
Javascript does not yet have an equivalent to foreach languages like PHP, Perl, etc. A possible solution is to use for..in with an extra check: for (var key in obj) { if (obj.hasOwnProperty(key)) {…
-
10
votes4
answers1804
viewsA: Should I check dates with Datetime or regex?
Dates are in the background numbers. Even if you declare in string form, it is more efficient to represent them as integers. The class DateTime is specialized, therefore, has all possible…
-
4
votes3
answers942
viewsA: Undefined Reference when compiling multiple files
Assuming you are using GCC or some compiler with similar interface, do, on the command line: $ g++ -c gradebook.cpp -o gradebook.o $ g++ Main.cpp gradebook.o -o <nome_do_programa> You can make…