1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Motors New website for calculating your MPG

Discussion in 'General' started by Stompy, 16 Mar 2010.

  1. Stompy

    Stompy What's a Dremel?

    Joined:
    16 Aug 2004
    Posts:
    1,112
    Likes Received:
    3
    Hi Guys,

    I've created a simple little website (mostly for something to do) that some of you might be interested in. :thumb:

    Basically, you put in the distance you've covered since the last fill up and how much fuel you used, and it will calculate your MPG for you. When you use it twice or more it will give you the option to view your history, which will show you a table of your recent results and also show it to you in a little graph. This is all done by a cookie so no login/pass needed (trying to keep it as easy to use as possible!)

    Feel free to use it and abuse it as much as you want, also any comments, bugs or feature requests are welcome!
    :clap:

    Find my MPG
     
    GiGo likes this.
  2. Matticus

    Matticus ...

    Joined:
    23 Feb 2008
    Posts:
    3,347
    Likes Received:
    117
    A very nice design, I usually use the MPG calculator over at torque cars but I think I will use this from now on due to its cleaner design and less clutter.

    You should consider implementing the cost per mile as Torque cars have, you could even add in the amount of money the Government are taking from each mile you drive, that would interest a lot of people.

    I would also consider using a login as myself and many others I know of clear their cookies either every day or at least weekly. But I understand that this would cause you to host a possibly very large database. But either way its a great start.

    One of the activities we put together this semester in c# was to create an MPG calculator, so this is very relevant to my interests :p
     
  3. Gunsmith

    Gunsmith Maximum Win

    Joined:
    23 Sep 2005
    Posts:
    9,759
    Likes Received:
    2,331
    mines probably 300 mpg because i cant afford to pay 1.20 a ****ing litre!

    seriously if Alistar "dick head" Darling thinks that hes sticking 1% extra tax on at the end of march without a public riot he's either ignorant or brave.
     
  4. Stompy

    Stompy What's a Dremel?

    Joined:
    16 Aug 2004
    Posts:
    1,112
    Likes Received:
    3
    Thanks for the feedback Matticus :)

    Cost per mile is definitely something I want to implement, hadn't thought of the tax thing tho I will do that too!

    I'm probably going to keep the system how it is with the cookie but add an optional login for those who want to use it on different systems or delete their cookies. The data isn't stored locally in the cookie, it's just an identifier, so its not much more db space for me to include a users table as well.
     
  5. Krikkit

    Krikkit All glory to the hypnotoad! Super Moderator

    Joined:
    21 Jan 2003
    Posts:
    23,925
    Likes Received:
    655
    No offence, but why do you need a website for this?
     
  6. Stompy

    Stompy What's a Dremel?

    Joined:
    16 Aug 2004
    Posts:
    1,112
    Likes Received:
    3
    Cos some people are interested in it :)
    Clearly not you, which is fair enough ;)
     
  7. Jipa

    Jipa Avoiding the "I guess.." since 2004

    Joined:
    5 Feb 2004
    Posts:
    6,367
    Likes Received:
    127
    No, why do you need a website for counting "Miles traveled/gallons used"? I'd rather just whip out a calculator if interested - you don't even need the internets for doing that. Or better yet, calculate it in your head while driving. Oh well, everyone in their own way.
     
  8. RTT

    RTT #parp

    Joined:
    12 Mar 2001
    Posts:
    14,120
    Likes Received:
    74
    You could do with fixing it - your JS is woeful, it doesn't degrade nicely, it's not accessible, doesn't validate in the slightest, yada yada yada... :p
     
  9. Stompy

    Stompy What's a Dremel?

    Joined:
    16 Aug 2004
    Posts:
    1,112
    Likes Received:
    3
    Well for one thing we generally measure our fuel usage in litres, yet use MPG for efficiency, and not too many people know the conversion off the top of their head. Also, it lets people track it without having to make their own spreadsheet etc (for example if using a different fuel, additives, tuning engine etc.)

    Yeaa its my first foray into JS, I hate it :p
    I haven't yet reached the status of coding god like you RTT ;)
    When I started it I was learning the JS as I went along, at some point I will probably rewrite it from scratch using everything I've learnt along the way....
     
  10. Brooxy

    Brooxy Loser of the Game

    Joined:
    20 Apr 2006
    Posts:
    2,096
    Likes Received:
    122
    For people like me with older cars that don't have this feature built in :)

    Nice site, will be keeping an eye on it for updates
     
  11. julianmartin

    julianmartin resident cyborg.

    Joined:
    25 Jul 2004
    Posts:
    3,562
    Likes Received:
    126
    the encouragement on this forum sometimes makes it woeful, degrading, inaccessible, rarely validates ones personal effort, yada yada yada.....
    :D
     
  12. Jipa

    Jipa Avoiding the "I guess.." since 2004

    Joined:
    5 Feb 2004
    Posts:
    6,367
    Likes Received:
    127
    Oh fair enough, I had no clue you people are so weird you use both gallons and litres :lol: Then again, you also use MPG, not litres/100km like over here.
     
  13. C-Sniper

    C-Sniper Stop Trolling this space Ądmins!

    Joined:
    17 Jun 2007
    Posts:
    3,028
    Likes Received:
    126
    Using 0 miles and 0 litres came up with "NaN" miles per gallon. might want to change that to 0 mpg.
     
  14. Krikkit

    Krikkit All glory to the hypnotoad! Super Moderator

    Joined:
    21 Jan 2003
    Posts:
    23,925
    Likes Received:
    655
    C-Sniper - If you haven't moved and haven't used anything you haven't got a miles/gallon, maybe something along the lines of "Try again!" for NaN?

    Jipa - our pumps give us litres, but with our magnificent mix of imperial and metric we use mpg. :)

    Brooxy - I don't have it on my car either, but I work it out in my head or with a calculator.

    Stompy - mpg is useful and interesting, I just don't see why you need a website to do miles/(litres/4.54).
     
  15. Hugo

    Hugo Ex-TrustedReviews Staff

    Joined:
    25 Dec 2006
    Posts:
    1,384
    Likes Received:
    19
    Says the developer of TR ;)
     
  16. DarkLord7854

    DarkLord7854 What's a Dremel?

    Joined:
    22 Jun 2005
    Posts:
    4,643
    Likes Received:
    121
    Dropdown to change from litres to gallons (US & UK) would be useful if you really intend to let other people be able to make use of it.

    Also, it's always a good idea to make the site show "This page requires javascript" if the person has it disabled, or better yet, make it be able to do a non-JS calculation with some server-side code.


    Should also add Google Analytics just to see how many people visit and from where ;)
     
  17. Stompy

    Stompy What's a Dremel?

    Joined:
    16 Aug 2004
    Posts:
    1,112
    Likes Received:
    3
    Well I've pretty much rewritten the backend of the site now (although it currently looks exactly the same to the user so my hard work isn't really visible :p), javascript is a lot cleaner (and used a lot less), and the PHP side of things has been re-done. Also, the site now displays and works correctly on the iPhone.

    I haven't yet added the option to change the units, but it has been coded in at the PHP end. I just need to work on the UI side of things.

    Oh, one more thing, RTT you'll be pleased to know that it now validates as XHTML 1.0 strict ;)
    Unfortunately the CSS doesn't validate but thats because of some fudging that had to be done to get it to display properly in IE.

    Thanks for all the comments and suggestions guys, has been helpful!
     
  18. keir

    keir S p i t F i r e

    Joined:
    5 Oct 2003
    Posts:
    4,380
    Likes Received:
    49
    looks nice but I've no idea to see how many litres I've used so not much use :(
     
  19. Stompy

    Stompy What's a Dremel?

    Joined:
    16 Aug 2004
    Posts:
    1,112
    Likes Received:
    3
    Fill up your tank to full, then reset your trip counter.
    Next time you fill up, fill it up to full again and look how many litres you've put in, this is how much you've used since last time! Record this and obviously the mileage on your trip counter, put them into my calculator, et voila :)
     
  20. DarkLord7854

    DarkLord7854 What's a Dremel?

    Joined:
    22 Jun 2005
    Posts:
    4,643
    Likes Received:
    121
    2 things regarding your CSS..

    Font sizes should really be in px, not pts, because browsers render pts differently.

    Your colors should be hex values, not words.


    I've also just noticed the logo and form don't appear to be centered and it's now bugging me severely o.o
     

Share This Page