KevinM1
Moderators-
Posts
5,222 -
Joined
-
Last visited
-
Days Won
26
Everything posted by KevinM1
-
There are coders of all levels on this forum My level is over 9000.
-
Sweet, thanks! Oooh, nice
-
Awesome! And I'm happy to see I'm not far off with my current projects. Thanks!
-
Hey, I was wondering if there was a decent resource that describes what's needed to ensure that a website meets accessibility guidelines, especially from an HTML standpoint. I know that alt attributes are necessary for images, but what else?
-
I don't think anyone is a fan of VB.NET. C# is where it's at.
-
There's no value in limiting yourself to just open source. All you're doing is limiting your potential income. Your income is limited by your available hours. You can get a job doing PHP, you can get a job doing .NET, but imo it would be better to be good at one or the other. This is a bit of a truism. One will naturally be better at using one language over the others. The point is to not be better at one at the expense of the others. In New England, .NET is where the money is. However, due to the crappy economy, competition in that job market is high. The backup plan? PHP. Being comfortable (admittedly, with a different level of comfort depending on language) in both allows me to make money where others may not. It's all about being flexible, and making yourself more likely to thrive in conditions where others may fail.
-
Pro PHP Security - APress C# 3.0 in a Nutshell - O'Reilly Professional ASP.NET 3.5 in VB and C# - Wrox Design Patterns - Gang of Four (don't know the publisher) Essential Actionscript 3.0 - O'Reilly (haven't gotten around to reading it yet)
-
30. Now get off my lawn! *shakes cane*
-
More accurately, an interface declares functionality, leaving the class(es) that implement it to define how that functionality should be handled. All methods listed in an interface must be defined in a class that implements it. And, no, you cannot use the 'new' keyword with an interface. Interfaces help enforce type. If a class implements an interface, then you know that those interface methods will be available. An object of that class is also considered to be an object of that interface, allowing you to use that fact in type hints. So, something like: class Book implements IProduct {} $book = new Book(); Means that $book is a Book, and it's also an IProduct. A factory is a method that implements the Factory Method design pattern. It's a static method that takes information as an argument and returns the correct object based on that information. What that information is, and what objects it can return, are dependent on what kind of objects you need it to return, and what info is necessary to create such an object. A classic example is a Database factory: abstract class DatabaseFactory { public static function instance($connectionString) { // return correct type of db object (MySQL, SQLite, postgreSQL, etc) based on the connection string } } $db = DatabaseFactory::instance(/* connection string */); What makes this flexible is that you don't actually need to know what kind of database $db is. You're just certain that it's a db, and that you can execute queries with it. The particulars are hidden.
-
Rule of thumb - global should never be used.
-
Real bad advice. In my area of the world, unless you're freelancing, you're writing ASP.NET. There's no value in limiting yourself to just open source. All you're doing is limiting your potential income. There's no cost for the developer to write .NET apps. Microsoft is very good to their developers, and offer a host of free IDEs that work very well (google Visual Studio Express). They also have great deals for small business owners. I currently have a three year subscription to the MSDN, including full downloads of their professional development software, and I'm practically getting it for free - $100 fee after my three years are up, and some hosting costs, that's it. I get the whole "Microsoft sucks" argument. I wouldn't pay the kinds of costs it normally takes to host an ASP.NET site either. But, that's not the point. Other people do, and will, and I'm in a position to capitalize on that. To the OP, here's my advice: Keep up with your PHP. PHP isn't going anywhere - look at Facebook for a recent example of a large, profitable website written in PHP. Learn ASP.NET with C# as your code-behind language - both traditional web forms and the new MVC framework. Finally learn Python, and the Django framework. It's the new hotness. That should keep you in good shape.
-
It looks a lot better overall. Some thoughts - 1. I don't get what the fence in your header graphic has to do with anything. Is it from a pre-made template? 2. Your codeblocks are still jarring to look at. You don't need to make the background electric blue. Make it light gray and put a 1px black border around it. That will keep it readable while separating it from the rest of your content. 3. Not to be the turd in the punch bowl, but you do need to improve on your tutorials. Content is what will drive your site, and so far it's lacking. I think your intent and effort are noble, but the results are lacking. A couple of examples: In your 'Block IP addresses without a database' tutorial, how would one obtain an IP address? In your 'PHP email' tutorial, where should one be concerned about security? This isn't intended to make you feel bad, rather I'm saying this to motivate you to do better. Tutorials should generally have more than 10-15 lines of code total, else what's the point? Those that don't should highlight a bit of theory, or a really useful trick or tip. Here's a good tutorial for you to write - building a login system from scratch. Including: Database table(s) Proper password handling Proper security (scrubbing the inputs, escaping them, etc) Gracefully handling error conditions Having the site remember a logged in member It'll be a worthwhile topic for you to cover, as it is a topic that crops up here all the time. Further, it'll give your site truly relevant content. Something to legitimately think about, IMO.
-
I feel you need to be a bit more precise - there's a difference between classic ASP and ASP.NET. I wouldn't recommend the former to anyone as it's old deprecated technology. That said, it still crops up from time to time. It's hard comparing ASP.NET to PHP as they don't really match up in a 1-to-1 way. ASP.NET is comprised of two parts - server controls and the code behind the scenes. Server controls are the building blocks of a page - list boxes, dynamic tables with built-in sorting and pagination, calenders, etc. They can be added to the page in a drag-and-drop fashion, or written using proprietary markup. The actual code that runs behind the scenes to get everything to work is written in either Visual Basic (ugly language) or C# (wonderful language). In the end, you get a naturally tiered product - the server controls lie on top, giving the user something to interact with. The code behind is the middle layer, responding to changes in the server controls. The bottom layer is the data store, usually a database. Traditional ASP.NET web form projects have their pros and cons. There's a steep learning curve. ASP.NET can be a pain to deploy, For smaller sites, the bulk of it all may not be worth it. That said, server controls make it easy for non-programmers to add to the structure of a site (this feature tends to be leveraged by CMS systems), some of the server controls are powerful, and the code behind files can be a mix of both VB and C#, which is great for large projects where one coder may be comfortable in one language but not the other. Finally, there's the benefit of the .NET framework itself. It's powerful, flexible, and since it's divided into namespaces, you only use what you need of it. There's more: ASP.NET MVC. Relatively new, it allows one to write ASP.NET apps in a much more web-friendly way. I haven't had a chance to play with it a lot, but it reminds me of Code Igniter and Kohana. Really cool. This probably reads like an advertisement for Microsoft. It's not. PHP has some clear benefits over ASP.NET. First, it's incredibly easy to learn. Second, its documentation blows MSDN out of the water. Finally, its easier and cheaper to deploy. There does tend to be an ASP.NET vs. PHP conflict, but it's really a Microsoft vs. open source conflict. I can see the merit in both, and as a developer, I have no issues learning and using either. IMO, it's worth your while to be familiar with a multitude of languages. Now if only Visual Studio 2010 had a PHP extension...
-
I really want to punch Justin Bieber in the face!
KevinM1 replied to Orionsbelter's topic in Miscellaneous
One of two things will happen: 1. He'll fade away in the next year or so. 2. He'll persist, but only for a very specific audience (think Jonas Brothers). Teen sensations tend to disappear after the cuteness wears of or when they're around 18 years old and no longer want to be marketed to other teens and children. Chances are there will be some pics of this kid at a club drinking, smoking, partying with skanks, and perhaps doing some blow (extra points if it's off a hooker's ass). -
That's what __autoload (or the spl equivalent) is for. If you're serious about OOP in PHP, this isn't an issue. This is true. I don't see anything wrong with storing objects in sessions if it's a small app. To the OP, storing an array in sessions is the same as storing a single value. Fill your array with your data, then assign it to a session variable.
-
Exactly right, which is why it's more logical to do it that way. Given the choices: Men - Women - Both - None If someone is interested in, say, women, then logically it's impossible for them to choose none as well. They can't have it both ways. Radio buttons enforce this behavior, and save you from having to check for those kinds of logically impossible combinations. It just looks like you're trying to over-design it, IMO. Checkboxes aren't a one-size-fits-all tool.
-
Logically, wouldn't it make more sense to have these options as a set of radio buttons? I mean, this is for some sort of social networking site, correct? Someone can be interested in men, women, both, or none. With a set of radio buttons, you wouldn't have to do as much work to manipulate the data as you wouldn't have those "The user clicked both 'none' and 'men'" cases.
-
A few things: 1. You should have meaningful variable names. $foo, $a, $b, and $c are horrible variable names, as they provide no context for what they're supposed to be. 2. You don't need to pass $_POST into the function. It's globally available. 3. You should take a look at pdo or mysqli. 4. If you still want to stay with vanilla MySQL, try: function clean($data, $a, $b, $c) // again, pick better names { if (is_array($data)) { $foreach($data as $key => $value) { $data[$key] = clean($value, $a, $b, $c); } } if (get_magic_quotes_gpc()) { $data = stripslashes($data); } if ($a == '1') { $data = mysql_real_escape_string($data); } if ($b == '1') { $data = trim($data); } switch ($c) { case '1': $data = ucwords($data); break; case '2': $data = strtolower($data); break; case '3': $data = strtoupper($data); break; } return $data; } foreach($_POST as $key => $value) { $_POST[$key] = clean($value, $arg1, $arg2, $arg3); }
-
I really want to punch Justin Bieber in the face!
KevinM1 replied to Orionsbelter's topic in Miscellaneous
?? -
You could do it that way, put the info in a 2D array like the accessories, or make small struct-like objects to contain the data.
-
The following in PHP: $this->someDataMember; Is the same as the following in C#: this.someDataMember;
-
Once again, it's time to showcase my ignorance of MySQL. Yay! I have a few tables filled with different kinds of content. These tables all have a date_added field, which is a datetime. What I'd like to do is retrieve content from a table, and order it by date, grouped by month, like the way most blogs do it. So, something like: August 2010 (5) September 2010 (11) October 2010 (2) etc. I think a query like: SELECT COUNT(*), *month and year* FROM content GROUP BY *month and year* DESC Would be what I want, but I'm unsure how to: 1. Group by month and year 2. Obtain that month and year Any ideas? I feel like I'm close, but just need a nudge in the right direction.
-
It's Object Oriented code. The '->' is an object-to-member operator. removeActiveUser() is a method (read: function) of the $database object. $this->username is the argument passed to that method, and is a data member of whatever object's class code you're currently reading.
-
Here's how I'd do it: Create a Computer class. The required components would be the key data members of the object. The accessories would be stored as an associative array within the object. So, something like the following (which is intended only as a rough sketch): class Computer { private $motherboard; private $cpu; private $memory; private $hdd; private $accessories = array(); public function addAccessory($name, $price) { if (array_key_exists($name, $this->accessories)) { ++$this->accessories[$name]['quantity']; } else { $this->accessories[$name] = array('price' => $price, 'quantity' => 1); } } }