Jump to content

SoccerGloves

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Posts posted by SoccerGloves

  1. Hi!

     

        I've seen many people use lower camel case (thisIsAnExample) for variable names, and upper camel case, also known as Pascal case  (ThisIsAnExample- sorry, I'm sure you know this already)  for class names, and possibly for method names and property names.

     

        But it seems simpler for me to just use all lower camel case.  If I use both, what good does it do?  And if I do use it, it brings up the question of "well, now what about the name of a library I write?  Or an entire piece of software?  Are those upper or lower?"  And it just seems simpler to do all lower.

     

    But I don't want to walk over a cliff here, so if anyone thinks this is a bad idea please let me know! 

     

    Thanks,

    -Ryan

  2. Hi!  Sorry I've been slow.  It doesn't look like there are any easy log-out solutions other than quitting the browser.  If you really want to have that feature, we'll need to look at some PHP, which is fine too!  I think the tool jhbalaji gave us along the right track, and I could help you with setting something like that up.  It gets harder because you need to make changes to your web-pages themselves, instead of just clicking a switch on the godaddy admin panel, but it does have advantages (like you get to choose what the log-in box looks like, and it is actually on your page somewhere, and you get to have a log-out button =).

  3. OK!  So, actually, Godaddy has a neat, easy-security tool built into it.    (I have a godaddy account, too - I didn't break into yours or anything =)

     

    [*]Log on to godaddy.com

    [*]if not yet selected, click the "my account" tab at the top right

    [*]on the green strip that appears at the top of the page, click "my products".

    [*]Scroll down until you see a black bar with the heading "products".  Bellow that and on the left is "web hosting" - click that.

    [*]the screen will change slightly and you will see your hosting plans listed - click the green "launch" arrow for the one that you want to work with. (you might only have one account, like me)

    [*]You should get a completely new screen after clicking the launch button.  Click the large silver button near the top left that says "your files - manage site content".

    [*]This should give you a cool file-system tool on-screen.

    [*]Pick the folder that you want to protect.  If you want a certain area of your website to be only available to members, then make a folder called "secure" or something.

    [*]After you have decided on the folder that you want to secure, check the check box beside the folder (don't enter the folder).

    [*]Look near the top of the tool, where you can see a lot of folder buttons, and click the one labeled "permissions"

    [*]On the panel that appears, There should be 3 tabs.  Pick the tab for "password protect".

    [*]Check the check box labeled "Password protect directory".  Now you have switched on security for this folder!

    [*]Use the gold "add user" button to add new users.  Click the blue "remove user" link to remove users.  Click the gold "OK" button when you are done.  For me, it took about a minute for these changes to take effect on the actual site.

     

    I tried this out on a simple little site for my friends (we have sword-fights with padded sticks =) 

     

    http://www.oftheword.com/sword/   

     

    And you can see that the site now requires a password.

     

    Hope this helps!

  4. I looked on Godaddy, and it looks like they only use Apache, so you should be set in that regard (http://community.godaddy.com/help/article/124). 

     

    I like the Apache method best for simplicity;  you said "The php is the one I think I would rather use as it would be easier to edit users.. ", but I think the Apache method is easier for editing users, unless you want an automated registration process, or unless you want to attach more info to your users (like phone number or mailing address).  If you just want a really simple security system with a small pool of users (maybe it would start getting tedious with 100 or more users)  and as long as you don't mind the way it looks (the simple little pop-up window) then I think this would be my favorite way.

     

    Good to hear back from you by the way!  I thought it was neat that you replied so quickly =)

     

    For the Apache tool, I don't think you need to download a file, you should just need to open up notepad and paste in the text shown in the tutorial, and then tweak it a little for your purposes (change the folder you want to password protect, and type in your users / passwords). 

     

    Let me know if it works!

  5. Hi!

     

    There are a couple ways to do this. 

     

    Method 1: make it yourself.

     

    One way is to actually build the security using PHP (or some other scripting language).  What I mean is that you would write the computer code that would handle these tasks:  (A) getting the users log in information, (B) checking that it is valid, © if valid, giving access to the protected area of the site, and © possibly also building a tool to register new users.  This is the harder of the three options, but it is also more flexible and lets you do more cool things.  For example, PHPFreaks uses something like this that was coded in PHP.

     

    Method 2: Use the server's security system.

     

    The second way is easier, simpler, but less powerful (I DON'T mean less secure - I mean it gives you less flexibility).  It looks like the site that you gave as an example uses this kind of system.  Server software (usually the open source Apache software) is what makes your website work - when someone types in your website address, Apache gets the request and responds by sending the requested page.  Apache has a built-in system for creating website security, and it is pretty easy to use.  However, whether it works or not may depend on your version of Apache (if you have that, which I'm pretty confident you do).  I think it is a pretty standard system.

     

    Basically, you just need to create a special file on your server with the list of acceptable usernames and passwords, and Apache takes care of the rest.  Actually, I think you need two files - one will end with ".htaccess" and the other with ".htpasswd".  Even better, instead of creating these files, you can edit the Apache settings, but sometimes internet hosting services do not allow you to do this, so the ".htaccess" and ".htpasswd" file may be your best bet.

     

    This looked like a pretty good tutorial for how to do this:

     

    http://www.addedbytes.com/articles/password-protect-a-directory-with-htaccess/

     

    And this is the official Apache website's article about security:  (But I like the first tutorial better =)

     

    http://httpd.apache.org/docs/2.2/howto/htaccess.html#auth

     

    Method 3: Use somebody else's tool.

     

    There are a lot of cool, free tools like Wordpress, Drupal, Joomla!, and so on that handle users and passwords for you, and also help you to build your site, but they may or may not be what you are looking for.  They are called "content management systems" (Or atleast I think that is what they are called! =)

     

    Hope this helps! 

    -Ryan S

  6. Yes, that sounds like a good organization system.  So, you are saying that the CarModel class could contain an array of all the images for that model, regardless of color.  Then the Color objects within that CarModel would contain images for that specific color for that specific model.  That way, the data would be in both places, and it would be a fine way to organize it, and easy to get at.  If you just want to get all the images for the CarModel, look in its images list.  If you want a specific color, go to the Color object.

     

    I can see that working!  I know space is not a huge issue unless you are designing a fast and optimized program, but does it matter at all that the images are repeated?  I suppose, since they are objects, you could even avoid this by using object "references" so the CarModel and the CarColor point to the same CarImage objects.

     

    If I'm understanding you right, your method gives you some cool functionality - again, being able to get all the model images or get a specific color image - but for me,  I don't need to get a list of all the pictures for a model, I only need to get specific color images.  My script will ask the CarModel object for a picture of the car in blue, and the object will return the proper image.  So I only need those images in one place - I'm just not sure if those images should go in the CarColor class or directly in the CarModel class.

     

    Just to make sure I'm not mis-understanding you, is this what you are suggesting?

     

    CarModel:

        > normal stuff...

        > colors array (each color does contain the car image - for example, the blue object contains a picture of the car in blue)

        > images array - a list of all the images of this car model; this list contains pictures of various colors

     

    Thanks for posting!  you are quick

     

  7. Hello,

     

    I have a question about data association.  I think the easiest way to explain it would be an example. 

     

    Pretend that I am making a program to keep track of cars, and I have a "CarModel" class that simply holds data for a particular car model.

     

    Now I want to keep track of a lot of information about the colors these models come in.  I want to know the names of the colors, sure, but I also want a swatch image of the color, and a hex code for the color, and a color ID that comes from the manufacturer.  So I make a "CarColor" class, and give it these properties.

     

    CarColor

        > color name

        > color hex code

        > path to a swatch image of color

        > color ID from manufacturer

     

    and my CarModel class:

        > manufacturer

        > model

        > year

        > array colors: array of CarColor objects (a list of all the colors that the car is available in)

     

    So this is fine and good - I'm happy with this so far.  But now I decide that I want an image of the whole car in each color, not just a swatch image of the color.  So there are two ways I could do this.  I could add a property to the CarColor class; that would be easiest:

     

    CarColor

        > color name

        > color hex code

      > path to an image of the whole car in this color

        > path to a swatch image of color

        > color ID from manufacturer

     

    This is easy because it's stored right with the other color data, so it's nice and neat and tidy.  BUT, what if I want to pass that color data around to another car model?  Then those images wouldn't apply any more - they would be pictures of the right color, but the wrong car!  (I don't forsee needing to do this, but maybe some day...who knows?)  So perhaps I should instead put my colorful pictures in the CarModel class:

     

    CarModel class:

        > manufacturer

        > model

        > year

        > array colors: array of CarColor objects

        > array of color images: keys point to a color object, values contain links to images of the whole car in each color

     

     

    So, what do you think?  The second method takes more work - I need to have some way to connect the images to the colors - but it is also more in-line with the data that the classes are supposed to represent.  Pictures of the car belong to the CarModel class more logically than they belong to the CarColor class.

     

    Thanks for any thoughts!

    -Ryan S

     

  8. Wow - I didn't expect so many good responses!

     

     

    xylex, you're right about the sites changing and such, I hadn't thought of that.

     

    Garethp, That's encouraging, and I hope my code is helping my boss make money.

     

    ignace,

    8 dollar is a fair amount.
    cool! - I'm glad you think it's fair.

     

    KingPhilip,

    Honestly, I'd bump up your prices, but not charge too many hours to research time ;)
      I agree about the reasearch time - I'm not working on his project really, I'm just learning how to do it.

     

    Crayon Violent,

    The project involved a bit more than just data gathering, but I'd say about $4.5k of it was the bot(s).
      Hey, that's good to know.  I bet my bots have a lot more bugs than yours would have  :) but at least it seems like I'm not insanely off price.

     

    businessman332211,

    Go through and clock the hours as your working..if you stop to look something up on Google or learn something you don't know, stop the timer.  Learn it, then start clocking again when your making viable progress on the system again.  Overall your on the right track, just keep knocking stuff out.
      Thanks!  I'm lucky that my boss has a good time clock program, so I'm set there, but I can do better at marking when I'm researching / progressing.

     

    This was exactly the kind of opinion I was looking for - you can't see my code, so what I really need to do is work together with my boss and make sure my time is giving him a good working product - but now I know that as long as my work is good, the price is fair.  Thanks!

     

  9. Hello!

     

        I'm looking for advice on standard php-employee payment.  I'm a college student, and I have worked for a local business-man as a steady, per-hour employee for two years.  I feel uneasy because I am not sure if I'm charging him a fair amount - what if he could pay a professional half what he pays me and get the same job done?  He didn't seem concerned about it when I asked him, but I would like to know. 

        I work on projects for 8 dollars an hour, but it takes me a long time to do things.  In the end, I've been paid 4.3 thousand dollars to develop a web spider that does this:

     

    • Logs into any one of 10 different websites.
    • On each of those websites, the spider reaches several hundred pages.  Each page within the site has the same basic layout.  The spider looks through each page for several different pieces of data, and its search involves looping through tables.
    • The data is important to the running of my employer's business, so it is well tested.  If  I know the information will meet a certain criteria, I'll make the spider check what it finds.
    • Each of the websites, while somewhat similar, needed completely different spiders to be built for each one.  The main spider is told what website to visit, and it hands off to the sub-spider responsible for that website.

     

    Looking back, I'm worried that it cost him much more money (and time) to hire me, as apposed a professional.  Did he get the short end of the stick?  Through these past two years, I've had to learn regular expressions, cURL, object oriented coding, and good practice, all from scratch.  A lot of his time and money was certainly spent for me to learn these things before I could apply them, not to mention me needing to go back and re-do things because I made in-experienced mistakes.`

     

    I'm just looking for thoughts, thanks for taking the time to read!

    -SoccerGloves

  10. You might want to look into interactive fiction - that may be a little different than what you are thinking of, but I think it's very similar.  There are scripting languages and standards that allow you to write these interactive books, and then there are interpreters that will play them.  You can do all the things you are talking about, from picking up items to using passwords to talking to other characters and exploring.

     

    http://www.andybrain.com/archive/interactive_fiction.htm

     

    http://www.web-adventures.org/

     

    http://en.wikipedia.org/wiki/Interactive_fiction

     

    I don't know of any PHP tools, but there are some web-based ones, like the web-adventures.org

  11. Hi!  I don't think I have any good advice, so don't get to excited about my reply =)  but I just want to make sure I understand what you are trying to do:

     

    You have a hierarchy.  You have a list of nodes, and each node fits into a tree. so, for example, you have:

     

    > Tree A

    > - > Node 1

    > - > Node 2

    > - > Node 3

    > Tree B

    > - > Node 4

    > - > Node 5

    > - > Node 6

    > Tree C

    > - > Node 7

    > - > Node 8

    > - > Node 9

     

    And in your table of nodes, that would look like:

     

    [node id][belongs to tree]

    [Node 1][Tree A]

    [Node 2][Tree A]

    [Node 3][Tree A]

    [Node 4][Tree B]

    [Node 5][Tree B]

    [Node 6][Tree B]

    [Node 7][Tree C]

    [Node 8][Tree C]

    [Node 9][Tree C]

     

    And you are trying, now, to allow trees to be inside of other trees, like:

     

    > Tree A

    > - > Node 1

    > - > Node 2

    > - > Node 3

    > Tree B

    > - > Node 4

    > - > - > Tree C

    > - > - > - > Node 7

    > - > - > - > Node 8

    > - > - > - > Node 9

    > - > Node 5

    > - > Node 6

     

    Where Tree C now belongs to Node 4 inside of tree B.

     

    And you want to come up with a way to make this inter-nesting happen, in a way that uses the fewest database calls possible, right?

  12. Hello,

     

        I have a question about my messaging / error logging system.  I am working on a data-crunching script, so it doesn't get viewed as a public web page, it only is seen by the administrator.  All it needs is a simple on-screen output tape that keeps the person who is running it up to date on how it is working.

        So, lots of non-error status messages get written to the screen, and also into a log file and a log database-table.  I'd like to make a clean, standard way for handling all these messages.  I considered making my own "message" object that would contain a text message describing the error, an "importance" code, a message type ("error", "info", or "debug"), and a debug trace.

        So here's my question:  the built in Exception class has almost all that stuff already, and I could extend it.  Could I use exceptions for non-error messages?  Would that be good practice?  It would look like this:

     

    $m = new ExeptionMessage('normal operation...50% done', 2, 'info');
    $myMessageLoggingObject->send($m);

     

    this would be slick: I wouldn't need to make my own message object, and I could swap-in normal, ordinary, thrown exceptions into my ->send() function,

    and they would work just fine! 

     

    catch (Exception $e) {
        $myMessageLoggingObject->send($e);
    }

     

    Is there any problems you could see with this?  Is it bad practice to use Exceptions when they are not being thrown?

     

    Thanks!

  13. Yes!  I do do this, but I don't know if it is a good practice, either.  I just started it for a few of my projects, and it seems to be working well, and I love the flexibility and the opportunity to make changes later without re-writing all of your calls to that function, but I don't know if there is something I am missing?  I'd like to know what other people think.

×
×
  • 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.