How to use Mapbox to convert from coordinates to address and back again

Back in January, I promised that a future post would cover how to go from a street address to latitude / longitude coordinates.  Previously, we have covered how to get the user’s street address, using navigator.geolocation and MapQuest and more recently, we covered converting addresses to latitude and longitude but that wasn’t an actual street address and we have never done this with Mapbox, before. Continue reading How to use Mapbox to convert from coordinates to address and back again

How I get my news, these days

I will readily admit that I got too much of my news from Twitter, before the implosion.  After twitter went away, there was a slight hole in my daily news diet.  I started filling that hole with Inoreader and PressReader.  Inoreader has a $20/yr “supporter” plan and the app syncs your feeds from device to device.  PressReader is free with a Milwaukee County Federated Library card and gets you access to over 7000 magazines and newspapers on up to five devices.

PressReader includes the Milwaukee Journal Sentinel, which is good.  It doesn’t include the Washington Post or the New York Times, though.  I’m maintaining a seperate annual subscription for the Washington Post for the time being.  It appears that the Milwaukee Public Library offers remote access to the New York Times for members of the MPL but I’m a member of the MCFLS, so I’m not covered.  I would subscribe to that as well but I’m not sure if that or the Milwaukee Business Journal would be the better option.

I really wish there was a viable “netflix for news” that would cover all of these publications.  Paying $80 here and $80 there for these things is really hard.

 

[ Cover photo by Roman Kraft on Unsplash ]

How to autofill an address using mapbox

I have been poking at the Milwaukee County Trasit System (MCTS) APIs over the past few weeks.  A few years ago, I tried to write a bus app using Angular and it just didn’t work out well.  I figured that I would try it again, using what I have learned since then.  The first step was to build out a data infrastructure using Cloudflare Workers and Cloudflare KV.  The end-result of that is what drives the MCTS mastodon bot.  The workers JSON api returns every bus stop in the system, along with the route, direction, and location.  The next step is to figure out where the user is and where they are going.  That is the subject of today’s post. Continue reading How to autofill an address using mapbox

How to calculate the sunset and sunrise times in JavaScript

Over the holidays, I created Good Morning, Milwaukee! (a Mastodon bot that posts a “Good Morning” toot every morning).  The problem is that it hasn’t been behaving correctly since shortly after I finished it.  I want to simplify it a bit, so I can make it a little less fragile.  The first component of the message that I decided to focus on is the bit that gets today’s sunrise and sunset. Continue reading How to calculate the sunset and sunrise times in JavaScript

I might have been spending a lot of time on Mastodon

In my previous post, I talked about how after Elon Musk’s purchase of Twitter, I was giving more attention to Mastodon.  Since then, I killed my twitter account, launched my own Mastodon instance, launched three new Mastodon bots (including a new one that goes live this morning), and converted Joe Travels to only post to Mastodon.

The new bot is called Good Morning, Milwaukee! and I created it to test the limits of my ability to create a Mastodon bot.  It gets sunset info, sunrise info, the weather, the news, and a live photo.  For the news article, it randomly picks between the Milwaukee Journal Sentinal (limited to just local stories) and the Milwaukee Business Journal.  Once it picks a publication, it picks a random story amoungst the five most recent ones.  For the live photo, it picks a random one from three (i43 at Silver Spring Drive, Cathedral Square Park, or the Milwaukee River at the MIAD campus).  The whole bot is written in Node, using Pipedream.

The other two bots are MCTS and The Hop.  They both post the details of a random stop (including a Google Street View image) once per day.

I don’t consider any of this to be a finished product.  Everything is going to need some tweaking, moving forward.  I’m going to try to stop building new bots, though.

Please drop a comment if you have any questions and feel free to check out Toot Works if you are interested in checking out what Mastodon is all about.

 

[ Cover photo by Christopher Burns on Unsplash ]

Where you can find me online

Last week, Elon Musk bought twitter.  As soon as the deal was complete, he fired the chief executive, chief financial officer, and head of legal policy, trust, and safety.  That last one was what worries me the most.  I have been mirroring my tweets over on mastodon for a while now.  I’m planning on staying on twitter for the moment but mastodon is a good escape hatch if things get really bad. Continue reading Where you can find me online

What is a CSS Reset?

The goal of a CSS reset is to reduce inconsistencies with things like line height, font sizes, and margins.  Every browser defaults to different sizes and spacing and if you set a common baseline, you end up with a better end-product.

A basic example would look like:

body, div, h1,h2, h3, h4, h5, h6, p,ul {
margin: 0;
padding: 0;
}

Andy Bell and Josh W. Comeau have pretty good, pre-packaged CSS resets but the OG might be the one by Eric A. Meyer.

There is an argument that a CSS reset violates DRY (Don’t Repeat Yourself) but a good CSS reset is minified, blindly pasted in, and is common to all of your projects.  You might be setting things only set them again later but it will save you time and pain for a minimal cost.

 

[ Cover photo by Tom Grünbauer on Unsplash ]

Notes on my trip to India and Nepal

At the end of December 2019, I was getting an itch to travel some more.  I started browsing TourRadar and found a tour that hits both India and Nepal.  In my 2020 Timecapsule post, I even talked about having found the tour but not booked it, yet.  I was supposed to travel in April of 2020 but of course, COVID-19 ended up happening.  When I read the “we don’t cover pandemics or civil wars” part of the two seperate travel insurance policies, I figured that I was out of luck but the company that I used offered offered a travel credit with a deadline that kept getting moved.

When the deadline was moved to the end of September 2022, I figured that I better go while I can.

Continue reading Notes on my trip to India and Nepal

Hide My Ass VPN sucks for app testing

This past July, I found myself looking for a way to test a web application from behind “the great firewall of China” (aka Golden Shield).  The problem is that I can’t test that something works in China if I’m not in China.  My first thought was to use Nord VPN to connect to a VPN server in China but the closest that Nord offers is Hong Kong.  I did a little light investigating and found that Hide My Ass VPN claims to have 4 servers in Beijing.  After paying $59.88 for an account, I was ready to start testing.

Unfortunatly, it looks like HMA VPN is doing some shinanigans to make it look like your traffic is originating from the country without it actually originating from that country.

When you use their client, it shows that you are connected using an IP that is in China.  You can use IP Chicken to prove that it is your new public IP address and you can use a service like MaxMind GeoIP or IP Location Finder to prove that IP address is in Beijing.  The problem was that despite that, the Golden Shield limitations were not happening.  I could still visit things like Google and Twitter and see things like photos of the Tiananmen Square massacre.

The first thing that came to mind was to use nmap to trace the path between the remote server and my computer.  It does that by sending packets to the server with decrementing TTL, in an attempt to elicit ICMP time-exceeded messages.  That didn’t work great because the result didn’t show my public IP.  My next idea was to use traceroute since instead of decrementing the TTL, it increments it.

Since the traceroute goes from where your computer is to the target server, the first hop should be your public IP address but in this case, it isn’t.  So, where is 5.62.34.110?

 

It looks like for some reason, when you select China, you get a Chinese IP address but the traffic actually emerges onto the internet in Singapore?!?

I have no idea why this is happening but when I asked them, they said:

The most I can do to show you we are indeed telling you the correct information is to point you to the database of the official registry RIPE NCC:
https://apps.db.ripe.net/search/query.html

RIPE NCC is one of five RIRs worldwide coordinating and maintaining the information databases about the registered IPs and operating under IANA (Internet Assigned Numbers Authority). You can also confirm these IPs are allocated to RIPE by looking them up here: https://www.iana.org/whois.

I understand that the inner working of the internet is not your prime concern, but rather the websites recognizing your location correctly. Still, I just wanted to demonstrate that we have taken all the necessary actions on our end. At the moment, incorrect IP details appear, but they appear less and less frequently as other websites conduct updates of their databases.

So, they aren’t denying that they are faking the traffic.  They are just saying the IPs are registered in China (which doesn’t help).

I still need to figure out if there is a legitimate way to test if I site works in China.  Have a suggestion?  Feel free to drop a comment, below.

Joe Steinbring's thoughts on coding, travel, and life

Exit mobile version