Jump to content

VBAssassin

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Everything posted by VBAssassin

  1. Oh the memories! Let me just explain a little about my site, since this will all become relevant in a minute. Also, you can see it's quite large, though not really huge (over 100,000 lines of code) by checking it out: http://www.coderprofile.com/ First of all, it was entirely procedural. But that soon started too become to much work to update. It kept meaning complete re-writes and/or features being held back. Then i started learning more OOP. So i converted a few things from procedural to objects. Such as the bbcode system,and thumbnails of images, etc. These were pretty independent classes. Then i decided, i want to learn moooooreee... so i got some more books such as PHP Patterns, Objects and Practice (something like that) and some other books about OOP concepts and some UML books (designing them out in UML is a god send, also helps you understand what the books are on about). I also have the gang of four book (design patterns) which is good. They state things like "choose composition over inheritance" and other such tips. You learn the design patterns and as you learn them, they show you "good design" as well. I don't quite understand some of the patterns, but from the ones i do understand like the factory pattern... well... what can i say... i wish i had learn them years ago! They have simplified so much code! Then your ready to really start coding in OOP especially when you can modal them in UML, you understand the difference between aggregation, composition, generalization, etc. A lot of "newbies" (and myself included at the time) tend to inherit everything! This simply produces a mess! Also, learn what packages are (the concept is useful an organize them in to folders aka packages on the server). Read as many OO articles as you can... even if you already understand it... read it again! Eventually... after just a few months you will start thinking in proper OO design ;-) I would also suggest you invest in some books: amazon.com Kind regards, Scott
  2. I have no idea what the heck your on about? Please explain further. I'm somewhat very experienced with creating "profile" sites, the best one i'm doing is http://www.coderprofile.com/ So i'm sure i can help you if you explain a little clearer what it is your trying to do. Kind regards, Scott
  3. Wew! I wasn't expecting all that code and all those files! lmao. Since your going to be working with text files for data, you should get very familiar with serialize and unserialize. Can save a lot of manual parsing. Here is how you should layout your guest book: libs/functions.php - stores all your main functions content/guest_book.php database/index.php database/users/username-password.php database/posts/posts.php You will have to create users manually at the moment by just creating a new file in the format username-password.txt which is more efficient than saving those two details in the file itself (else all the files need to be opened to check for users and duplicate usernames etc). use file_get_contents() and file_put_contents() if you are using PHP5 (much easier than fopen, etc). When a user posts a message in the guest book ask for there username and password with their message. If the username and password file exists, then they are ok to post... then simply add the message on the end of posts.php To view the posts, just use get_file_contents() on the posts.php file. Make sure you put an index.php file in the database/users/ folder to prevent people seeing a directory listing of the users folder and seeing everyones username and password. Anyway... gota get back to work now... this distributed PHP framework is a pain. Kind regards, Scott P.S. Here is an example of a simply page hit counter that uses the file system to save the total hits, instead of a database: http://www.coderprofile.com/networks/source-codes/328/simple-hit-counter-v13
  4. Haha, you never said that (or did you?)... anyway... thats what GROUP BY is for ;-) SELECT COUNT('A1') FROM `answers` WHERE `A1` = '50' OR `A1` = '75' OR `A1` = '100' GROUP BY `A1`; Try that. Kind regards, Scott I said the number of answers of each, but i guess I wasnt very clear I tried that, but I dont think it will work as: it doesnt return empty rows for the options where answer to count = 0 and it doesnt label them. e.g.: SELECT COUNT('A1') FROM `answer` WHERE `A1` = '50' OR `A1` = '75' OR `A1` = '100' GROUP BY A1 gives: COUNT( 'A1' ) 2 2 Oh... this will return data showing which ones have X amount SELECT `A1`, COUNT('A1') FROM `answer` WHERE `A1` = '50' OR `A1` = '75' OR `A1` = '100' GROUP BY `A1`; If it don't show results with 0, then just make a php script to sort that out ;-) Kind regards, Scott
  5. Haha, you never said that (or did you?)... anyway... thats what GROUP BY is for ;-) SELECT COUNT('A1') FROM `answers` WHERE `A1` = '50' OR `A1` = '75' OR `A1` = '100' GROUP BY `A1`; Try that. Kind regards, Scott
  6. lmao... then once you have done whats on that (after it teaches you how to build a login page lol)... just add: header('location: where/ever/your/profile/page/is'); and your done... You should probably know, i'm creating a profile site (taken me 1 and a half years to get to where it is) and my profile on that site is: http://www.coderprofile.com/coder/VBAssassin I assume that's the sort of thing you mean by "profile" site? Kind regards, Scott
  7. Don't ever use COUNT(*)!!! It pretty much forces table scans! Not good. Anyway... SELECT COUNT('A1') FROM `answers` WHERE `A1` = '50' OR `A1` = '75' OR `A1` = '100'; Kind regards, Scott P.S. You need an index on the A1 field.
  8. Looking at that, your comfortable working with JavaScript. I would suggest you now look into using a JS framework such as jQuery or Prototype. http://www.prototypejs.org/api/ajax/request Looking at your code, your just trying to post a form... and no bothered about the return data. In which case you can do it like this. Change <select name="warpx"> to <select id="warpx" onclick='javascript:send_it();'> and then add this js code function send_it() { new Ajax.Request('/url/here/of/where/to/post/it', { method: 'post', parameters: { warpx: $('warpx').value } }); } I haven't tested it though, so chances are there will be some syntax errors or something or other... but thats most of the code you should need anyway to make a simple Ajax POST request. Oh, and you will have to install the prototype framework, add this to the head part of the html: <script src='http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js' language='javascript' type='text/javascript'></script> Kind regards, Scott
  9. This is a huge subject and too general for anyone here to really reply to. Try google or something like this: http://www.phpeasystep.com/workshopview.php?id=6 Kind regards, Scott
  10. Hi ya, Are these code snippet showing aggregation or composition? Example: <?php class poster { } class wall { function render_poster(poster $poster) { } } $poster = new poster(); $wall = new wall(); $wall->render_poster($poster); ?> Example 2: <?php class poster { } class wall { private $posters = array(); function add_poster(poster $poster) { $this->posters[] = $poster; } } $poster = new poster(); $wall = new wall(); $wall->add_poster($poster); ?> Notice that the second example is NOT being passed by reference (or does PHP5 auto pass by reference unless you use a clone statement or put & in the methods parameter list?). I think i know what i would class them as in my head, but just want your opinions to make sure i'm correct, otherwise, i'm going to be asking some more questions if i'm wrong :-D Kind regards, Scott
  11. Hi ya, Something that's bugged me for a while now is is it better to use www. or miss it off? Looking at it from both a SEO standpoint and a visual standpoint. Kind regards, Scott
  12. Hello, Your main topic content above didn't make much sense to me, so i'm gonna go by your topic title "Submit value only if checkbox is ticked". Basically, you have two options (server side, client side). Client side will require some javascript: <form onsubmit='javascript:if (document.getElementById('id_of_checkbox_here').checked == false) { return false; } ;'> Server side (PHP): if (isset($_POST['checkbox_name_here'])) { //code here if the checkbox was ticked } else { //code here if the checkbox was NOT ticked } Hope that helps. Kind regards, Scott
  13. Haha, this brings back some memories! I started by saving votes (and comments, etc) all in separate tables... bad idea. Save them in 1 table and simply differentiate them using an enumeration. Then simply write a class to handle the votes system. Save a timestamp with each vote so votes can be removed after 24 hours ;-) I'm actually upgrading my voting system to "reviews" :-) Kind regards, Scott
  14. One way around it is to dynamically change the names of the fields sent. This confuses the macros because each time they try and fill in the form, the names and id's etc of the fields it's supposed to access change! Meaning it's then bust. It's a pain to implement dynamic names though, such as: Page Hit 1 <input name='dsafd'> Page Hit 2 <input name='2133dsas'> Page Hit 3 <input name='a8s7sjd'> Since the real names have to saved as well: <input type='hidden' name='_a8s7sjd' value='title' /> Once the form is sent, your post data is scanned for all the names beginning with _ (these for a hash, or in php, associative array). You then lookup each of the dynamic names in the table to work out what data is what from the dynamic form. This will prevent your script from getting confused, but not the macro script (except macro scripts that automate mouse movements and clicking etc but then you have to give up your mouse while the macro runs). Kind regards, Scott
  15. [quote author=Jenk link=topic=110890.msg450747#msg450747 date=1160616785]Constants break encapsulation.[/quote] Not always... [code]<?php         class messages {                 const TYPE_ERROR = 1;         const TYPE_CONFIRM = 2;                 function add_message($message, $type = TYPE_ERROR) {                     }     }         //normal use     $message = new messages();     $message->add_message("Well done!", messages::TYPE_CONFIRM);     $message->add_message("Warning though, don't do this again", messages::TYPE_ERROR);     ?>[/code] Source: http://www.coderprofile.com/networks/discussion-forum/1694/is-there-a-name-for-this Kind regards, Scott
  16. Sure, open up the php.ini file and put this: session.gc_maxlifetime= 600 if you can't do that, put this in a htaccess file instead, or use ini_set() at run time. Kind regards, Scott
  17. Did i speak to you on MSN about what pagination was? Can't remember... must have been someone else. Anyway, here is a basic Pagination Class i wrote not so long ago (PHP5): http://www.coderprofile.com/networks/source-codes/493/pagination-class Kind regards, Scott
  18. Hey up, I only just uploaded the new blog! I'm currently converting it to the new one from this: http://www.coderprofile.com/site/development-blog I will allow commenting but i have to improve the current commenting system since people can not currently reply and hold the connection with the comment they are replying to. But that is planned. Also, they will be integrating with the notification system on the site soon once i finished adding all the previous posts to it (otherwise coders will get a notification for each one i add which in total is about 70+ lol). I'm also thinking about changing the announcements topic on the blog to a "think pond"... which is where i will post what's currently under debate about what to add to the site next etc and you guys can all discuss it and vote etc on them. Since that's generally what's happening in the forum at the moment and i don't want to utilize the forum for that. What do you think? As for the other words you said about the site. Thanks :-) It's nice to know that the hundreds of hours spent on a project are worth it, and that i am going in the right direction :-) Kind regards, Scott
  19. I'm not saying validation is a bad thing, i'm saying it's time consuming and not as productive use of my time as it could be spent doing higher priority updates and additions. However, there are many little tweaks i need to do nearer when the site is completed such as convert the icons to sprites (as we will talk about in a minute). Thanks :-) I've never done that before... so thats quite cool. Though what sort of users would generally do that without actively editing the config file such as yourself? Nice little touch anyway :-) They aren't supposed to be. Yeah, because at the moment i'm adding new ones, removing ones, adding new sizes, etc etc etc... messing around with sprites will add a lot more work thats not needed yet. Once the site is nearer finished and / or starts suffering from to much traffic then i will make that change. But right now, there is no need. I think it's known as premature optimization ;-) Yeah, but i like the quality of png images. 40kb is something i can live with compaired to the fuzzy jpeg (or higher quality results in higher file sizes anyway). PNG does a nice file size with a very nice quality. All thumbnails however (all user images) are converted to JPGs for the reason you stated. The sites design and template however, i'm keeping as PNG. Not sure what you mean there? The footer actually is the same layout as the very top of the site (with stuff on the left and right, not in the center). Thanks, and yes, your feedback is helpful :-) Often explaining yourself to someone helps you make sure what your thinking is actually right or wrong. If that makes sense at all. It's getting late. Kind regards, Scott
  20. Hello, Yes it is one of my few designs. It takes me aaaages to do a design because of my curse (being a perfectionist). Thats the best design i have done though. I prefer programming... basically anything but design lol It's cool how you all seem to see the potential of the site. Though i am not naive. I know there is a lot i have to do yet, and there is still a great deal missing. I am happy with quite a few systems on the site though such as the BBCode System i wrote, the way you can add and remove applications on your profile all works great, the notification system is really good too. But there are then systems such as the comments that have problems such as not being able to directly reply. The discussion forum has direct quotes which i'm not happy with, and so on. Though i do aim on clearing them all up over xmas (before january). I'd love for some of you guys to register and watch as the site develops. In fact, i'm about to upload a new version of the site (to v1.46, check the footer to see if the update has been applied yet) :-) Kind regards, Scott
  21. Thanks. Thats cool considering i'm not actually a "designer". It went through 3 re-designs till i got it like that which i am now happy with. Yeah, it does seem a little strange don't it... let me explain... at the moment... they are pointless! Bet you weren't expecting that! lol. Basically the drop downs on the first 6 items allow you to select a new item to replace it with (allowing you to customize the tab things). The one on the far right shows them all and allows you to jump to a new network. At the moment i am perfecting the sites systems such as i need to replace the comment system with a system that allows replies and allows votes for a comment (to weed out spam). I'm also working on a new category class which will allow you to categorize everything on the site, and so on. All of next year i will simply be adding new applications such as blogs, coding challenges, etc... and that is where those drop downs will make sense. Since there could be 20 applications meaning 20 networks in those drop downs to choose from ;-) Thats a great idea! I love the cron idea. Although, with a lot of source codes could be quite processor and database intensive. Also it wouldn't detect codes that don't work on the demo (only links that point to a 404). So maybe "report as broken" would be best :-) Actually... the recent SEO work i did in the latest update increased the pages being indexed on google from 300/400 up to over 3,000! :-) Also, using i seem to be getting good traffic come in from search engines from a few codes like the calculator code i wrote in VB and Delphi. Since the breadcrumbs, title, and page headings all pain the same picture it works great! Sorry, but through experience i decided not to go down that route. In theory it makes perfect sence to use divs, in practice, it's not! Simply seperating the CSS from all pages in to a seperate file creates an extra http request (and css don't gzip for some stupid reason... browsers don't like it)... also... changing it in one place has knock on effects (which can be good) but since the site changes so much it's actually harder to keep the css files up to date without affecting other pages. Using inline style tags is better... but then adding the extra connection from the html tag to the css code is another complication (no longer encapsulated) and you have to keep looking up what the css was for each class etc. Then you got name clashes and so on... inline is easier when a site like CP is changing so frequently. With divs the width is often a problem since there generally is no overflow control i have seen that mimics that of a tables and many other sites have the same problem. Type in a really long URL... and watch as the URL goes straight over the design! Tables however, stretch when that happens. Max/min width is an option however, it's not supported on all browsers. It's all these sort of problems that tables solve. When the time comes i will change it... but until there is a real need too it will wait. Also, tables seem to work better across browsers etc without the requirement of CSS hacks etc. Good job tables are sooooo old now, meaning they are so well supported. And as already stated... So theres little problem... other than maybe an extra few KB in markup. You have to know when to stop perfecting something :-) I hope it doesn't yet because i don't want to move my attention from development to member management and scalability and hosting issues. At the moment i want to develop it until i have finished adding the final applications and then get ready to promote it. I have a 5 year plan for the site all written down and so far, it's all going to plan :-) Thanks :-) I enjoyed reading your post. Kind regards, Scott
  22. Hi ya, Ya giving some great feedback and suggestions :-) The thing is with demo's of source code. I'm not sure how i would implement that in a secure way. The second option i know is to allow them to simply enter a link to a demo... but... over time those pages that the demos point to become broken. Which isn't a good thing at all. In regards to the ratings. I actually plan on using a 5 star system which will allow for half of a star (which would make 10 possible ratings). Using a mouse over system instead of a select an option from a selection box. I'm still not sure about ratings at all though. I'm thinking about replacing ratings with reviews where each coder on the site can write 1 review per source code etc. Also the commenting system has some problems that i really don't know how to fix yet (the comment systems works in regards to 0 bugs - it's more of a logical problem like how to reply to comments). I'm thinking that the way digg deals with comments is pretty good... but still looking around and want to come up with my own unique way of commenting. Any help is appreciated. Kind regards, Scott
  23. Hey up, That is very true. I did write that in the very first version of the site so it's about time for an update with it i think. Ok, what about this for a solution: 1. They signup 2. An activation email is sent with 2 options (a link they can click, or the option to manually put it in). 3. If they manually put the key in, there will be 1 single input box for the key allowing them to copy and paste the whole thing in one go (and i will remove any spaces automatically). The reasons the key is "unusual" are; 1. It means bots would have to configure themselves differently to work with CP as opposed to configure it once and work with all vBulletin forums. 2. It's unique to the site and allows me full control over it. The same algorithm to generate the keys is used also for the validation images etc (so great code re-use) Yes it is completely free :-) i even release obsolete parts of the sites source code (classes) as well (on my profile: http://www.coderprofile.com/coder/VBAssassin ) Kind regards, Scott
  24. Thanks :-) i have quite a few users on there who use a very wide range of browsers and operating systems so it is generally well tested in that respect. At the moment the fact it is not 100% valid xhtml trans doesn't seem to be causing any problems. Even google, microsoft and digg all have home pages that don't validate. I know it should validate, but when comparing time with productivity it's quite low on the productivity end of the scale. Which is unfortunate because i would love to be able to code for 1 browser and have it work in all! But thats just not reality at the moment. Kind regards, Scott
  25. Hello guys, I've spent the past 1 and a half years developing this site from scratch (and no i do not regret not using a 3rd party framework) http://www.coderprofile.com/ I have also setup a test member account at username: phpfreaks password: asdasd And i would just like some feedback from some programmers as to what you think overall. Please do not kick off other people on the account via the security center (by destroying active sessions or login keys on the account). I will delete the account when this topic is finished. Thanks in advance, and have fun. Kind regards, Scott P.S. I'm primarily a programmer, not a designer, or journalist, etc.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.