Search found 284 matches

Actual Results

Post Posted: March 3rd, 2015, 10:43 am

I'm surprised you feel like you need a pivot table. It looks like there's a 1:1 or 1:* relationship between an account and a contact. So, you can likely simplify your table structure. What I'd do is combine the things that can only be applied once to the contact into one table: SSN DOB Home Phone Ce...

Post Posted: July 5th, 2014, 5:05 pm

You have complete access to the DOM with:


It should be trivial for you to grab a hold of the element you wish to inject the video duration into with one of those functions.

Post Posted: May 13th, 2014, 5:00 pm

Any speed benefits of MySQLi over PDO are likely negligible. And you get the benefit of not having to reinvent the wheel, instead having battle-tested code at your disposal. Keep in mind, you can use a factory to determine the strategy your strategy object uses. You might not even need the wrapper i...

Post Posted: May 12th, 2014, 9:46 am

Your database idea has already been addressed by PDO. ;) For your mailer idea, you may also want to look into the Strategy Pattern. With that, generally speaking (since design patterns are purposely half-baked) you'd have one mailer object that would act as a wrapper API to various implementations t...

Post Posted: May 9th, 2014, 6:25 pm

Like most things, factories have their benefits and drawbacks. Have you read up on them? Are there any particular problems you're facing that you think would benefit from implementing one?

Post Posted: May 9th, 2014, 6:15 pm

Tip: never use the $_REQUEST super global array. It contains everything in GET, POST, and COOKIE. That means if you have something in two or more of those with the same name (which is plausible) you won't know exactly which version you're dealing with. If you have a cookie named 'blah' that contains...

Post Posted: March 14th, 2014, 12:16 pm

Thanks Nightslyr, if I could +1 that post I would. That was really helpful!! Going from what I read in your post I want to learn C++ for desktop applications, but Java is mainly for Android development, right? Also, what books/tutorials that I could use to start learning C++ and possibly Java (for ...

Post Posted: March 14th, 2014, 12:09 pm

@Spork, yeah, Mono is pretty great. The biggest issue is that there's still this perception that traditional open source languages (PHP, Python, Ruby, etc.) = *nix stack, while Microsoft languages = Microsoft stack. So, while it's definitely possible to use C#/.NET on linux, good luck finding a team...

Post Posted: March 11th, 2014, 9:17 am

C++ is newer than C (you know the post-increment operator? $i++? yeah, that's why C++ is named the way it is). It's not 'better' than C, but rather aimed at doing different things. C is really used for code that has to run close to the metal. Think operating systems. The Linux kernel is written and ...

Post Posted: March 11th, 2014, 9:00 am

Singletons are unnecessary in PHP precisely because scripts (generally) have the lifespan of a single request. Add that fact to the fact that objects are passed by reference by default, and all of these singleton repository/database wrapper classes I see floating around in bad code are useless. Ther...

Post Posted: September 2nd, 2011, 9:46 am

It would probably help if you explained what you mean by 'freeze columns/panes'. Also, what part should be frozen? Why aren't they frozen now?

Finally, is this for layout? Tables should only be used to display tabular data. Using tables for layout is the epitome of doing it wrong.

Post Posted: June 22nd, 2011, 4:50 am

I'd do something like this: [php]public function logged() { // Note, no 'global'. Why? Because our user object should // have a reference to the db. 'Global' breaks // encapsulation, one of the main components of OOP // Checking if the user is logged in the session table $sql = $this->db-...

Post Posted: June 20th, 2011, 7:51 am

You need to swap your quotes around:
PHP Code: [ Select ]
"SELECT * FROM users WHERE email='$email' AND pass='$pass'"
Variables are only interpolated if the entire string itself is double-quoted. You'll also need to fetch your results as mysqli_query simply returns a resource. Finally, you can't mix...

Post Posted: June 19th, 2011, 3:59 pm

This: Each field may contain more than one value, in which case they will be seperated by a comma. Makes me think you should read this: Comma-separated values in a column is generally a sign you're doing it wrong. This is espec...

Post Posted: May 22nd, 2011, 1:34 pm

A sheet of paper is fragile yet a telephone directory can stop a bullet. Look beyond the weakness of the language and examine its strengths. It took me a week, couple of nights without sleep and coffee so thick you could slice it before I figured out how to do this :lol: . When I have enough posts ...

Post Posted: May 21st, 2011, 8:39 am

[javascript]//Javascript Document function checkform(form) { var errors = new Array(); if (form.occupation.value == "") { errors.push("Please enter your occupation."); } var gender = form.elements["gender"]; var genderCount = 0; for (var i = ...

Post Posted: May 20th, 2011, 11:40 am

Your mistake is that you keep redefining your checkForm function over and over again. The end result is that only your last definition of the function, which checks the last input, actually exists.

You only need one checkForm function. Combine what you have.

Post Posted: May 17th, 2011, 1:33 pm

*eye twitch at more 'global' parameters*

You may want to look into dependency injection for this kind of thing.

Post Posted: May 17th, 2011, 1:31 pm

Both are used to facilitate polymorphism. Abstract classes and interfaces create is-a relationships. If a class implements a particular interface, or extends an abstract class, then an object of that class is also considered to be an instance of that interface or abstract class. Unfortunately, since...

Post Posted: April 1st, 2011, 5:35 pm

FWIW, using a member's registration timestamp as a salt is pretty common. It's unique, and unique to each user. Even better, if you keep that date hidden to everyone except that user when viewing the profile, it's impossible to guess. No one's going to want to brute force every second from the epoch.

Post Posted: January 20th, 2011, 12:08 pm

That still doesn't stop you from passing your config variables in through a function's argument list. When you have a function like:
Code: [ Select ]
<?php function doSomething($arg1, $arg2) { global $configVar; // code that does something } ?>
You're hiding the fact that the function needs your c...

Post Posted: January 19th, 2011, 1:28 pm

Exactly right. Globals lead to coupling rather than reduce it. They, by definition, break encapsulation. They're a crutch, and in the vast, vast majority of cases, a sign of poor design. See also: Even though the link ...

Post Posted: January 15th, 2011, 5:54 pm

That doesn't stop you from passing the variable in through the function's argument list.

Post Posted: January 14th, 2011, 3:44 pm

Gah, why are you using a global variable? Pass $sys_url through your argument list.

Post Posted: January 14th, 2011, 12:49 pm

Ack, no, Visual Basic is horrible. If you want to learn a Microsoft language, choose C#.

That said, the description of what you want to do is so general that literally any programming language would suffice.

Post Posted: April 2nd, 2010, 4:33 am

Also, when was the last time you defragmented your HDD?

Post Posted: March 31st, 2010, 10:09 am

Remember to use session_start() on ALL pages you want to use sessions on.

Post Posted: February 23rd, 2010, 10:37 am

Try: [code]<?php if (isset($_POST['submit'])) { if ($_POST['op'] == "volvo") { echo "Volvo"; } else { echo "Saab"; } } ?> <!-- other HTML, including the beginning of your form --> <select name="op"> <option value="volv...

Post Posted: February 23rd, 2010, 10:32 am

I wrote a database access wrapper a while ago and made it public. Someone emailed me and asked me why I didn't use any PHP Optimization Techniques such as making some functions withing a class static (At least that is how I understood what he said... he said "i do not understand why have you n...
  • Sort by

© 1998-2016. Ozzu® is a registered trademark of Unmelted, LLC.