Devil is in the Details

the_Grinchthe_Grinch Member Posts: 4,165 ■■■■■■■■■■
I've been writing a web app for work to give you the location of the closet gas station and produce a web link that will open Google Maps on your mobile device to give you turn by turn directions to it. We have gas stations throughout the state that we can use and while you'll typically end up using the same one, being we work the entire state, there are times when you will be in an unknown area and need fuel. Of course, being behind the times, all we currently have to offer is a webpage with a list of all the stations.

Two days ago I got it to the point where it would pull your location (after you agree to allow it to) and then calculate the distance to the various stations. Worked flawlessly, but the issue at hand was that they were not in the order of closest to furtherest. Yesterday I changed the datatype to a Dictionary as then I could order the values from closest to furthest. Two hours I spent trying to get it to work and for the life of me I could not get it to sort. In Python it's pretty non-trival to sort Dictionaries and it just wouldn't work. Finally I look at my code and realize I had converted the distance value to a string when I wasn't using a Dictionary and thus the sort wasn't working. Changed it and bam I was in business.

Read that code kids!
WIP:
PHP
Kotlin
Intro to Discrete Math
Programming Languages
Work stuff

Comments

  • yoba222yoba222 Member Posts: 1,237 ■■■■■■■■□□
    Hmm. Python + mobile app--have you looked at Kivy at all? I'm beginning to learn this library now as it's so touch screen friendly, though I have a long way to go before I write anything as useful sounding as what you're doing.
    A+, Network+, CCNA, LFCS,
    Security+, eJPT, CySA+, PenTest+,
    Cisco CyberOps, GCIH, VHL,
    In progress: OSCP
  • johndoeejohndoee Member Posts: 152 ■■■□□□□□□□
    the_Grinch wrote: »
    I've been writing a web app for work to give you the location of the closet gas station and produce a web link that will open Google Maps on your mobile device to give you turn by turn directions to it. We have gas stations throughout the state that we can use and while you'll typically end up using the same one, being we work the entire state, there are times when you will be in an unknown area and need fuel. Of course, being behind the times, all we currently have to offer is a webpage with a list of all the stations.

    Two days ago I got it to the point where it would pull your location (after you agree to allow it to) and then calculate the distance to the various stations. Worked flawlessly, but the issue at hand was that they were not in the order of closest to furtherest. Yesterday I changed the datatype to a Dictionary as then I could order the values from closest to furthest. Two hours I spent trying to get it to work and for the life of me I could not get it to sort. In Python it's pretty non-trival to sort Dictionaries and it just wouldn't work. Finally I look at my code and realize I had converted the distance value to a string when I wasn't using a Dictionary and thus the sort wasn't working. Changed it and bam I was in business.

    Read that code kids!

    The navigation in my vehicle will do the same thing in 15 seconds worth of screen taps. I am pretty sure Google Maps does the same thing on all phones. Are you trying to re-invent the wheel?
  • --chris----chris-- Member Posts: 1,518 ■■■■■□□□□□
    johndoee wrote: »
    The navigation in my vehicle will do the same thing in 15 seconds worth of screen taps. I am pretty sure Google Maps does the same thing on all phones. Are you trying to re-invent the wheel?

    I think he is building an app that directs coworkers to "organization" approved gas stations (work for the state?). While your right, google will show you to the nearest gas station........does this gas station fall on the list of approved stations? Thats his solution.
  • the_Grinchthe_Grinch Member Posts: 4,165 ■■■■■■■■■■
    Yeah these aren't public gas stations so Google Maps wouldn't direct you to them. I could set them up as waypoints, but try doing that over 200 devices.

    I've looked at Kivy, my issue is trying to get IT to approve the app and then dealing with all of the updates as they come through. Thus a website, geared towards mobile, where I can control updates and it ultimately operates the same all the time. I only need to develop for Android, but I've been looking at React Native for some personal projects. Use HTML/CSS/Javascript for mobile apps and maintain one codebase for iOS and Android. In turn can use Electron for Desktop apps.

    Google let's you take a page and put it on your Home Screen like it's an app. Thus any employee can add the site to their home screen and utilize it without installing anything.
    WIP:
    PHP
    Kotlin
    Intro to Discrete Math
    Programming Languages
    Work stuff
  • shodownshodown Member Posts: 2,271
    React native is sweet. I've been messing around with it for a while with node back end API's. It does have a curve to it but once you put in a few solid months of javascript picking up react, then react native is not that hard.
    Currently Reading

    CUCM SRND 9x/10, UCCX SRND 10x, QOS SRND, SIP Trunking Guide, anything contact center related
  • shochanshochan Member Posts: 1,014 ■■■■■■■■□□
    I suppose Gas Buddy app is not usable?
    CompTIA A+, Network+, i-Net+, MCP 70-210, CNA v5, Server+, Security+, Cloud+, CySA+, ISC² CC, ISC² SSCP
  • TechGromitTechGromit Member Posts: 2,156 ■■■■■■■■■□
    the_Grinch wrote: »
    We have gas stations throughout the state that we can use and while you'll typically end up using the same one, being we work the entire state, there are times when you will be in an unknown area and need fuel.

    There's no reason what the the same code can't be applied to other areas of "locate the nearest ..."

    Drug Dealer
    Escort
    Meth lab ingredient(s) (nothing worse than being in the middle of a cook and find out your out of methamphetamine)
    Money Launder

    The list is endless! icon_twisted.gif

    On a serious note, I can see it being very beneficial to the owners of electric cars to locate charging stations, and Natural Gas powered vehicles.
    shochan wrote: »
    I suppose Gas Buddy app is not usable?

    He's referring to "Official State Government service stations", not commercial stations used by the general public.
    Still searching for the corner in a round room.
  • the_Grinchthe_Grinch Member Posts: 4,165 ■■■■■■■■■■
    You'd be surprised how dumb some criminals can be. Some would probably be more than willing to be put in a mapping app haha

    I've heard React has a learning curve, good to hear that you can grit through it if need be!
    WIP:
    PHP
    Kotlin
    Intro to Discrete Math
    Programming Languages
    Work stuff
Sign In or Register to comment.