Click here to Skip to main content
15,891,529 members

Comments by glen205 (Top 23 by date)

glen205 15-Jun-16 10:32am View    
I understand that the links are different per user.

I put "xxxxx" and "yyyyy" in my example to illustrate where you would put *your* active content to render the url / visible text (the PHP code <?= $user_info['portfolio_website'] ?>)

In effect, my solution is just "what's the right HTML for a link" - I was just saying that the <p> tag isn't a clickable link, the <a> tag is. I assumed you already were okay with what PHP to use to put the actual text you wanted to appear.
glen205 6-Jun-16 5:54am View    
It's only my opinion, but I would keep the class. This goes to separation of your domain model, which may directly reflect the structure of your database, and the "model" part of MVC which is a presentation model. If you accept that an application can have multiple models - maybe one for the DB (domain/entity model), one for MVC (presentation) and any number of other models (business logic etc) it becomes acceptable to take a couple of fields from two entity objects and combine them to form a presentation object, which is the "model" for the page you want to render....

The OO concept of a model can therefore cover your presentation layer with a different set of classes to your persistence layer -

TL:DR - it's okay if you have a custom model to present to a view....

Just my 2 cents!
glen205 27-May-16 4:09am View    
Despite the post of 2 solutions, I worry for the problem you're trying to solve.

Making keys that should be unique in the data domain, out of real-world data that may well not be unique, can cause conflicts. In your example, if someone else already has the same last-2 characters in name (Joan == Alan), email domain (AbsolutelyAnything.com == AbsolutelyAnythingElse.com) and ending digits of phone number, then they can't use your system. A person can't actually change any of these things at will to accommodate your restrictions. Unlikely scenarios happen more often than we'd like to think.

Consider adding an additional numeric sequence to the end to keep it unique for Joan and Alan (although even this has limits, do you use 2 additional chars and limit yourself to 99 Joans/Alans?)

Also, make sure you're not using "meom67" as the primary key on your users database table. Google "Surrogate Key vs Natural Key" for reasons why. Store "meom67" but also have a seeded incremental integer ID column on the table or things will get sticky.

Good luck,
Glen
glen205 13-May-16 8:23am View    
I'm also struggling to understand this question. Here's what I've got:

"I have three seperate values - U,T,C Each value has a different number assigned to it, usually in the thousands."

So - for example these are variables of an integer type e.g. U = 1000, T = 5000, C = 10000 ?

"I need to make up each value of U,T,C by using items, I have about 20 items"

Does "item" mean "object/class" e.g. you have a class with U, T and C properties (let's call this class "container"), and you have 20 instances of container, each with different values e.g. (using C# as an example, I'm not an Objective-C guy!)
Container c1 = new Container() {U = 1000, T = 5000, C = 10000};
Container c2 = new Container() {U = 6000, T = 2000, C = 4000};
etc....

I'm getting lost after that - can you explain: "calculates the best combination of items that will equate to U,T,C with the least amount of overflow possible"

Maybe I've totally understood the problem. What is meant by "best combination out of 20" - is it a fitness function like a genetic algorithm would want? Are your "20 items" like a population where fitness is to be evaluated?



glen205 12-May-16 3:02am View    
Timespan is a type containing a period of time between two fixed times. e.g. Timespan from 10:05am to 12:15pm is 2 hrs, 10 minutes.

That Timespan has the properties:
Hours: 2
Minutes: 10
Seconds: 0

but also:
Total Minutes = 130 (2hrs * 60 plus another 10)
Total Seconds = 7800 (130 * 60)

These properties are designed to solve your problem exactly i.e. "How many minutes long it this timespan?"

George's link to the MSDN documentation explains this.