Skip to the posts
Buffalo's neighborhood journals since 2003 🍀 Patrick Spicy Devil Logan🌭 Sahlen🥨 Weber Spank🥟 Pierogi🐸 Scaj🍺 Labatt Utica Pink Cherio❄️ Snow Murder

paul’s journal

Such a fucking idiot

·

I seriously just lost an hour of my life working on android and location accuracy. I am not even going to talk about it because like all of my other outside of work projects it will just get eclipsed by the high demand for my time that my actual job has.

Anyways, I was trying to get an accurate location and it kept giving me lat/long of 42 by 78. It was weird because it was saying the accuracy was like 1-28m. At first I thought it was because it kept selecting the network provider as more accurate as I was indoors. This got me running in and out of the house to try and get it to work.

But it wasn't working. Even when I explicitly chose the GPS as the location provider and set the accuracy to ACCURACY_FINE, it still was 42 by 78. After tons of frustration I looked at my logging code and I was casting the lat and long to int instead of a fucking double. Duh, it was being rounded. I could kill myself for not having noticed this and wasting so much time. I guess this is what I get for programming as entertainment at 2:41am on a saturday.

double lat = (double) (location.getLatitude());
double lng = (double) (location.getLongitude());

vs

int lat = (int) (location.getLatitude());
int lng = (int) (location.getLongitude());

💬 2 comments

  1. tinypliny ·

    I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.

    —Douglas Adams, "Last Chance To See".

  2. metalpeter ·

    At 2:41 am I know I wouldn't be able to think clear but that is just me.... Or maybe the fact that drinking is the only reason I would be up at that time would be a factor.....

💬 Write a comment