header pic
Date, Time, Currency Rate
Wed, 07/17/2024, 10:16 PM
Central USA:
Wed, 07/17/2024, 8:16 AM
Currency: 1 USD = 156.51 JPY
as of 07/17/24 12:00 UTC

Japan Days

My Days in Japan

header pic 2

Some minor changes for September 2019

Post Date: September 29, 2019 -- Categories: Technical Articles

During September 2019, I made a few minor changes to Japan-Days.info. Here is a summary of the changes.

Currency exchange rate added to this website page header.

Changes to the articles page menu column.

In this example, the menu is expanded by hovering over Japan Culture Articles, thus showing the selections available in that category.

AJAX the Home Page Newsfeeds block

This is something that I really should have done a long time ago, but I finally got around to actually doing it. That "it" is changing the way in which the newsfeed data on the home page is refreshed upon selecting a different feed. In the initial rebuild of the site in 2017, although I updated the newsfeed function to be database driven, the basic function for generating the content was pretty much the same as it was on the original site. In that implementation, selecting a different feed than the one currently displayed caused the entire page to refresh. Yes, I know that is pretty archaic in that AJAX has been a standard methodolgy for several years now, but I just had not put the time into making the change on this site. Now, when you select a feed, the form change in the select field is caught by a jQuery script which sends post data to the server as an AJAX request, and then updates the newsfeed element with the returned information without affecting the rest of the page.

Currency exchange rate information:

I have thought for a long time that displaying the current US Dollar to Japanese Yen exchange rate on the web page would be really handy. So, a couple of weeks ago, I finally decided to do something about it. This was really simple, actually. There are a lot of currency exchange services and banks that have an API with which one can extract this information. The problem with most of these services, however, is that one must pay a usage fee for a key to access the API. Don't get me wrong, I think that the fees are justified because those banks and exchange services that charge a usage fee typically offer a full featured service, like real time updates from multiple markets worldwide and historical data. Those services are well suited to commercial applications like trading sites, but way beyond the simple needs of a personal hobby website like mine.

I was very happy when I stumbled upon a service offered by the European Central Bank. They have a free exchange rate API that is updated once per day, at close of business Central European Time, or at about 10AM US Central Daylight time. So, I added a line below the date/time display in the page header, along with a function call to a PHP function that I wrote which will send a request to the API, retrieve and parse a JSON dataset that contains all of the exchange rate data, and return the USD to JPY information to the web page header.

4/02/2021 update: The service that I use now requires an API key, and usage is free for up to 1000 inquiries per month. Also, the service has been upgraded to update every hour. In order to stay within the 1000 hits per month limit, and thereby remain free for me to use, I added some code that will use locally stored data unless that information is at least two hours old, thereby limiting the number of inquiries that the website will make to 12 inquiries per day.

Articles page menu changes:

The most recent change as of this writing are changes to the menu on the Articles page. In the original release of the site, the articles menu was simply a list of all articles in descending post date order. My plan was to change this at some time, based on either category grouping or chronological grouping. In my initial design of the database, I included a post category table, and a category field in the articles table in order to facilitate some future grouping, so it was fairly simple to modify the function that generates the articles menu in order to group the menu items by category. With a few CSS changes, and a simple jQuery script to handle mouseenter and mouseout events, and it is done.

Articles page, addition of "most recent" and "today's popular" articles:

Since I had decided to keep a two column page format, I now had a lot of space in the right column, so I added two boxes. One shows the most recent article, and the other shows "Today's popular article", in other words, the article with the most hits in the last 24 hours. Each box contains the article title and post date in a link, and the first paragraph of the article.

That's all of the site changes for now, but most likely I will soon find something else to change.

 | Published by: Japan Days  logo
 | Date Modified: July 28, 2023


Most Recent Article

Today's Popular Article