New answers tagged

0

The real question here is "what is the consequence of failure?" If you delete something and it's not there, who cares? You wanted it gone anyway. If you want to insert data and it fails, what can you possibly do? Nothing, really. How, or even if you communicate errors largely depends on the fault tolerance of that transaction. Deleting something that ...


0

I think you should use directives for the DOM elements and controllers for interaction between these directives. DOM manipulation should only be done inside a directive. Fetching a text file could be done inside the controller, but it would be better if you did that through a service. Services can be used for reusable business logic/fetching data. You ...


0

I'd take a look at what would be useful to whatever calls your delete method. At the moment, client code calling this method will see a false condition when the item isn't there to delete, or is not able to delete... How should the client code react? Is it important that your client code does something in either case? Without knowing what the application ...


0

The answer to your question is: it depends. What you are currently doing is called exception suppression, that is calling a method which may throw and returning false when it indeed happens. Is it a good practice? That is difficult to answer without knowing exactly what you want from the method where you are suppressing the exception. I personally have ...


4

You put a cryptographically random, unguessable token on the password reset link that you send to the user's mailbox, and give them a time limit, expiring the link after that time limit has passed. The token insures that it came from the right mailbox. Further Reading Implementing web application self password reset mechanisms properly Forgot Password ...


6

I work on a code base in a compiled language (Scala) which is tens if not hundreds of thousands of lines long. The first thing commonly done in such situations is to break the application into microservices that usually max out at two or three thousand lines of code each, spread out among maybe 50 source files. Many are much smaller. Next, as others have ...


0

Not compiling everything after changing a single line in a single file is a big part of how we keep compile times low. This is partly what makes build management tools like Make or Gradle so much better for this than general purpose scripting languages like Bash or Groovy. That is, Make and Gradle provide easy syntax for defining dependencies, whereas Bash ...


0

Go's niche is really back-end services. While Go can certainly run your blog, its targeted purpose is to do the heavier lifting on the back-end where the design and coding part of the development cycle is typically more involved. So the 'inefficiency' of waiting for the compile isn't a big factor. Plus, there's some perspective involved. The code-compile-...


1

There's a widely used tool for Java which allows you to reload classed on the fly when they are recompiled. I've used it and it's reliable for the kind of thing you are talking about. Combine that with an IDE that compiles each class on saving (faster than I can blink,) it's basically just like what you describe. I don't know if anything like that exists ...


3

Both solution are viable, they simply don't apply to the same use-cases. a) manipulate the DOM via JavaScript : This result in a more heavy first page, but after that you will use less bandwidth, because you will only fetch what you need, and not rebuild and send everything. And in the cases where you don't need to fetch anything, it will be really quick (...


0

You could separate the user interface part (be it web or desktop) from the core application part (they could be different processes communicating thru some IPC). The Model View Controller paradigm or design pattern is probably relevant. A specific issue regarding Web interfaces is that quite often (but not always, e.g. the embedded web interface of your ...


5

There is a difference between coding only once and compiling/linking/building only once. The former is desirable; the latter (which I think you are suggesting) is usually not worth the bother. Code the core of your application in a language which exists both on the desktop and on the web server (and on any mobile devices you can see it being ported to in ...


1

I see all websites (THE big ones) make both PHP and HTML in same page .. Do I need to make all my website pages as PHP and embedded HTML inside it ? The fundamental problem here is that you're seeing a thing that websites you perceive as being big ones and then you're assuming that's a good thing to do. It's not. PHP is terrible enough on its own; ...


0

Yesm all of these things are correct but in the end when every page is loaded they are all converted to an HTML formatting so basically PHP, Bootstrap, CSS, JS are just basically all additions with makes data entry or forums all possible but the real question is what will this be used for and how can we , you implement an infrastructure for storing all data ...


0

Yes you can avoid PHP inside HTML. Use PHP as an API. Load up the page with embedded JSON, and render out the page client side with JavaScript. Then, instead of requesting HTML/PHP via AJAX, request more info formatted as JSON.


2

Ahmed, Web pages can be built in just html. In fact, that's how the web started out: with just simple html pages, things we would call today "brochure-ware". The user requests a page and the server delivers a mixture of text and pictures, and then it's done. There is no interactivity, like individual preferences or searching a database. PHP came later ...


0

I would be cautious about simplifying what goes on under the hood of Angular.js to MVC, as there have been countless discussions about what MVC even is, and whether Angular implements MVC or MVVM or some other MV* paradigm. It's kind of become accepted in the Angular world that they implement Model-View-Whatever and leave it at that. Having said that, the ...


0

From the documentation, I am assuming that by "most templating systems", they are referring primarily to server-side templates which get rendered into a view. I feel comfortable making this assumption due to a later statement explaining why angular is different: "... the template ... is compiled on the browser. The compilation step produces a live view." And ...


2

dynamically appending new code on the rendered page in a way that the changes would reflect on the other clients And this makes it possible to do XSS, mislead the users into providing confidential data such as passwords, and do lots of other cool stuff. You can't just let the users change the source code and run it, unverified, in other people's browsers. ...


1

Usually you have to query DB every time you render a page. Q1 - Yes, you just have to select all items ordered by created date (well, you don't want to select ALL, but only how much you need for current page - see 'Pagination') Q2 - Yes. Same as above. This might not work exactly as you want, because SQL databases are not search engines. In SQL DB you can ...


1

I am not a lawyer but my understanding is that as long as you are not distributing the software, you don't need to do anything special. You are free to use it for commercial uses. This license was created before the concept of the cloud and the AGPL was created to address this loophole: http://www.gnu.org/licenses/why-affero-gpl.en.html


0

Thank you for all the provided feedback! I will give them the following advice: Make sure that the programmer follows the OWASP secure coding guidelines. Make sure passwords are stored encrypted in the database. Do not save the documents on the webserver. Sync them at once to Google or Spideroak if they need to be encryped. If the sync fails, the whole ...


2

First off, you shouldn't be thinking of security in terms of a binary 'ok' or 'not ok'. Every choice you make has security implications that you want to understand. Regarding keeping the files on the web server's machine, that's not typically a problem for most commercial applications. You just need to make sure they aren't accessible via the web server....


2

There are a number of potential problems here. Theres not enough detail on the technical solution to say for sure but it seems an unsophistocated approach. Instead of critising the technology selection though, we should establish the security criteria needed for the application and ask how the solution achieves each point. eg. Should the documents be ...


1

5Mb seems like a trivial amount of data these days. So I wouldn't worry about pulling that out on demand, deserialising and manipulating that. Performance shouldn't be a problem given your quantities of data If there are no projected format changes for this data, I would stick to this approach.


4

Put the data in a data base. Write a function which pulls all the data from the database and populates the arrays. Pass the populated arrays to the unchanged calc function Write a function to write a database using the resultant arrays from the calc function.



Top 50 recent answers are included