Reputation
10,299
Top tag
Next privilege 15,000 Rep.
Protect questions
Badges
4 36 50
Newest
 Enlightened
Impact
~242k people reached

2d
comment Student Attendance Database - Circular reference
That's not really circular. Since the arrows go in different directions. A circular ref would be if A points to be, B points to C and C points to D so if the references are mandatory may have trouble creating records (though this depends and is not necessarily a problem.) Your design does not have this problem. EnrollmentMaster has no references at all. Same for students. You can start with those and other tables point to them. No trouble at all as far as I can see.
2d
comment Nuts and Bolts Programming
I totally fail to see where using libraries and knowing how to program would be exclusive of each other. IMHO one can use libraries (and given the complexity of today's projects there is simply no way around doing that otherwise you waste your companies time and money) and still know how to program. You don't write a database if you want to store data, you don't write a sorting algorithm if you want to sort data for the same reasons. Waste of time. Still you need to know how to program and use the data you got from the database and sorted to do whatever the next step is for your specific task.
Jul
28
comment What's the right way to approach validations?
Really the type of error message should not be relevant for such a design decision. In worst case I would limit the validation error messages to strings with error codes and then add different helpers for API and UI that 'translate' those codes into real text.
Jul
28
comment What's the right way to approach validations?
@RobertHarvey you can write arbitrary code for validations. There are basic validations for size, data type, existence of related records etc, but you can easily add complete methods for more complex validations. So the question would be mainly about those validations being in other places. Like the controller? This seems wrong. Even if you decide to have different validations for the API and the UI you should still put them into the model area.
Jul
28
comment What's the right way to approach validations?
The validations should ensure valid data, this includes basically everything that possibly could go wrong. So: yes, the model is the place that ensures that only valid data goes into the database. That's at the core of the MVC model. You can not really depend on the UI for validations, especially in the browser the user can turn those off anyway and send any data he likes (don't trust the browser!). Also any other place would mean you would possibly duplicate validation code. In general the model is 'best practice' for all validations.
Jul
28
comment What's the right way to approach validations?
I do not exactly understand your problem. Anyway: The ActiveRecord validations main goal is to actually ensure data integrity. It doesn't matter where the data comes from, it's on the model level, so part of the business rules. Also what's the difference between 'validating user input' and 'ensure data integrity'? You validate user input to ensure data integrity. (Data integrity being a bit of a broad term, meaning basically 'valid data'). What additional 'features' does your API have that are different from the normal user input?
Jul
28
comment Auto Moving Objects using Java
You could just put 'java animate image' or 'java move image' in google and get lots of answers like these: stackoverflow.com/questions/14432816/…, stackoverflow.com/questions/16039768/… There are complete game tutorials available for Java.
Jul
28
comment Why is 'continue' the keyword for skipping the rest of the loop iteration?
Well, to use continue just to do what you would do anyway would make it an empty statement. So of the two possible meanings at this place inside the loop we are left with only one that makes some more sense. I personally prefer next too, but somebody had to make a decision at the time and to his language understanding continue made enough sense. Maybe we could even discuss the use of next. Is it really the best word? Would it not just mean to continue with the next statement (another 'empty' statement then). Shouldn't we use skip? Should we use with or each instead of for?
Jul
28
comment Why is 'continue' the keyword for skipping the rest of the loop iteration?
Maybe the idea is that the loop as such is kept running, compared to the break statement that would stop the whole looping.
Jul
22
comment MVC is a kind of Design Pattern?
It's sometimes named architectural pattern, so a bit more high level than your common OOP design pattern since it works on the whole project structure and not only a single class (or small group of classes).
Jul
20
comment Best practice for buffering when posting to a web-service that has gone offline
Would depend on amount of data, data format (CSV, binary, JSON, XML...) and maybe a few other factors (also considering using another service if this one isn't reliable enough, though of course may not be an option for whatever reasons). There are various simple solutions for log data that could handle this maybe, one thing to look into could be the Elasticsearch ELK stack.
Jul
20
comment How to deal with stock updates when a user makes a purchase in e-commerce?
You either have the basket in your database or the 'pending purchase' table you mentioned. In any case every record has a timestamp, so you can simply add all records for a given article that are not older than 10 minutes (or whatever) and subtract that amount from stock. A lot depends here on amount of customers on your site and how often this really happen (chances are less often then you may think). If this becomes a serious problem (you should log as much data about this as possible, especially if you show customers 'out of stock' messages) you should consider to stock higher volumes.
Jul
20
comment How to deal with stock updates when a user makes a purchase in e-commerce?
@skirato I was just basically writing a comment repeating my answer for the question MetaFight linked. Didn't even remember I ever answered it there.
Jul
8
comment REST API paging via headers
This still is more complicated and not the standard. I just fail to see why you would want to do that at all? There seems to be no real advantage to it, only makes using your API more complicated. As it is now you will have libraries that can easily make GET requests (also you can easily use command line tools like wget or curl for testing your API) and all you need to do is concatenating a simple string into the correct URI with all params. All this without worrying about how to get your tools to change header info. It's simple, it works, so you should have a very good reason to change it.
Jul
8
comment REST API paging via headers
This would be a bit uncommon. The range is more for data requests like getting part of a video file (e.g. when you click the progress bar in a youtube video). To start with in most cases it will be just more complicated (at least require javascript) to get this working. Also it would make it more or less impossible for search engines to follow you links, so you would possibly have negative SEO effects if that is relevant to your site.
Jun
22
comment php - design: database operations
yes, a framework would be a good idea. Once you worked with one you will get the idea. At least for tasks like those it will give you all you need (beyond that you would have to look into 'design patterns' and OOP but this is a larger thing.). Confusing to me is that if some of those if conditions fail, you still do return $row while no value was assigned to it (which happens only deeper inside those nested if/then).
Jun
22
comment php - design: database operations
Hmm, something model-view-controller would be the way to go I guess. What you describe would be a very simplified approach to a model layer which would already be a step ahead to separate your business and database model from the rest of the app. (Also unrelated: I am no PHP dev, but those functions look quite confusing and seem to return $row in various situation without assigning a value to this variable. Maybe guard clauses would help clean that up a bit by avoiding to nest if/then statements too deep)
Jun
19
comment Client and access to Github history
We do have access to the repositories of our outsourced projects. So that's definitely nothing like 'no developer would ever...'. But to be true, we learned the hard way to make this part of all agreements. From a legal point in your case this may be a matter of interpretation of the actual contract, 'all material' may be seen as 'results only' or really everything. In any case if it's needed as evidence for a law suit a lawyer may be able to get it even if it's not seen as part of the contract.
Jun
16
comment Web apps for enterprise
We did a prototype like that with something called Phonegap. The storage as such worked well enough. Syncing is tricky but can be solved (depending on complexity of the data). But for our case we run in some usability and performance trouble and finally decided for native (which was an easy decisions, since our employees all used the same product). There are limits with html, especially things like background synch and native features like push notifications or whatever are missing.
Jun
13
comment Best way to handle blank dates
This really may depend on your application. In some cases it may work or make sense to set an arbitrary date for unknown (say 31.12.1799) in others this may lead to difficult to track errors, like if you need to decide if somebody is of full age to make a purchase.