US and UK based site how to handle - html

We have 2 sets of prices, $ and £'s.
How best can I handle this.
Should I have a folder with the US site in so when users click on the US flag they go to mydomain.com/us and then navigate from there.
Or is there something simpler I can do?
The HTML site passes users over to our client system when ordering so currency conversion etc isnt needed. Just want advice on how to handle displaying a site in dollars and pounds.

If you have a country field on your user's table you could use this value to determine what symbol and prices to show.

If you are trying to keep it really simple without any server-side page generation use a bit of JavaScript. Pick a default currency and allow the user to click US or UK to switch to the other one. Javascript can be used to set a cookie so that when the user revisits the website, or views other pages, you can automatically set the preferred currency.
There are a few different ways to perform the conversion, and it probably depends most on how you do the conversion yourself. If you are just going by a current exchange rate store the prices in one currency for each item in a table and then have it apply the exchange rate as part of your conversion function.

Related

make a URL displayed clickable without control of the website

I am doing some volunteer work for a charity that is using a couple online systems that store their donors and related data. I would like to find a way to store a URL as a custom field in such a way that they can put corresponding links between donors in one of the systems in order to quickly find the same donor in another system. The only built-in method in the products being used is to store a single value in a field labeled "website" which is originally intended to store a value for any website associated with the donor. I would like to avoid using this field if possible and instead create a custom field.
However, the rub is the custom fields only have a handful of options (clear text, date, currency, etc). There is no option to store a URL or something like rich text). I've thought of a couple less optimal ways to make the values stored in those fields clickable (a browser plugin or a proxy) however both of those have obvious drawbacks that I would like to avoid.
What I am wondering and hoping someone has a possible answer for, is if there are an ways of storing a value in a clear text field that might disrupt or escape the underlying html encoding such that the displayed link is clickable. I already control the values being put into these fields (users cannot enter their own values, they are essentially read-only), so security isn't much of a concern.
I have very limited access or influence to have any system level changes, however I would like to make this possible as it would help them a great deal (their users are all volunteers with limited time and education). I've tried a few tricks but havn't found anything that doesn't get converted to unicode or escaped (it could be that it's completely controlled for at output, i simply don't know).
My current attempts have been limited to using the built in forms submission, I may explore their import and/or API methods on the theory that might allow better low-level access to storing the actual values in the system, however I'm still not certain what to try other than adding .
I have also tried an inline script to add the corresponding tab, however that seems to break the form submission method (perhaps it'll work via csv import or via the API)
Does anyone have suggestions for other things I could try before I go any further? I'm a bit of a novice and feel like there may be something else obvious I haven't tried.

Better to store miscellaneous metadata in database or calculate on each access

I have a number of attributes I need for various page loads and other backend tasks, and I'm debating on whether storing these things in a database or calculating them on the fly.
For instance, if there are files that users can upload, and you want to track the size, space taken, format, etc. would it be better to calculate these things once and store them along with the location of the file in the database, or just grab the file each time and get the file attributes manually?
Another use case is shopping cart items. Is it better to calculate the price of an item and store that in a row with the shopping cart table, or calculate the given price each time a page loads. In this case, changes to the price based on site-wide sales, discounts, markups, etc. would not be reflected once the item has been added to the cart unless the prices are updated through another method when sales/discounts/markups are applied. This isn't the best example, but hopefully you understand the idea; maybe you have a better example.
In both of these examples, the source material is available to get the answers from which is key to the question. Obviously, one has a lot overhead for every page load would could be a lot depending on the situation, however the other seems to have less dependence on database integrity in terms of making sure it is always accurate and up-to-date (which I think I prefer). I'm not looking for a specific answer here, because I'm sure it will depend on many variables, but I am looking for a best practice or a method to determine the best solution.
NOTE: This is a similar question but has gotten very little response and no answers.
There can be trade offs between
When a user is waiting, elapsed time is critical.
A user will expect up-to-the-second pricing information.
A user will be frustrated if he orders something, only to find out that you are out-of-stock before his order is submitted.
We cannot say how fast it will be to recalculate things in your system. If you have some SQL code, we can help you speed it up.
Sometimes in Computer Science, it is faster to do the computations when the thing changes; sometimes it is faster to compute when it is requested. It sounds like your case is that it is also slower to compute when it is requested. If it is not "too slow", then that option may be viable.

How to handle duplicates in emailaddreses when using multiple signup forms with MailChimp?

I have various signup forms on my website, all adding to 1 list in MailChimp.
Each signup form has different purpose, e.g. free ebook, video etc.
By using a hidden source field I managed to provide the correct download urls etc.
But... How to handle a visitor who signs up on multiple forms?
I want to share the related materials with him, but MC marks the duplicate as error and requests to update profile... with no option to obtain the related material.
You'll probably need to use the API to make this work, a simple form isn't going to cut it.
There are some options. If there are only a handful of things, have them be interest groups. When someone signs up, say for a free ebook, mark the free ebook interest group and subscribe them if necessary.
You can then create an automation for each interest group to send the material.
I would consider creating multiple lists for this purpose, since a MC list can never contain any duplicates.

Graphhopper: edit motorway speed online

I'm trying to edit the motorway speed to the user's preferences and return a route as a result of this change. I would have an input field labeled 'motorway' on the webpage's form and when submitting, this value would change the speed of all the motorways.
I have see the answer here: Does GraphHopper support dynamic edge weights? , however I would like to know how to edit all edges and through which java file.
The plan is to have user preferences for road speeds (for busy times), regularity of turnings and traffic lights. Any point in the right direction would be appreciated
By default the GraphHopper import process stores only the speed and accessibility (forward+backward) information for an edge.
So, the first step will be to create a custom FlagEncoder which stores the type of the road e.g. an integer somewhere in the long/int flags. You can use the EncodedValue class for this.
The next step is to create a custom Weighting implementation which then calculates the speed from the flag information you stored. The weighting will be called while querytime so you can take into account the user its preferences, which can be changed per query.
Note: you'll need to disable CH when you allow changing the preferences for every query
Note: this change could be valuable for the core GraphHopper, so if you implement it let us know via a pull request ;)

Fix HTML structure

I know this is a strange question, but maybe some of you have had the same problem. I run a website where user share notes, papers and any other kind of documents, written in HTML. The problem is that the content structure is not very good: usually, they don't use headings (h2,h3,etc.), <ul> and <ol> lists (they write lists as plain text), and so on.
Has anyone experienced this kind of problems? How can I address this problem? I've tried with some heavy regex-based solutions, but they are not very accurate.
Example
Demand- quantities of a good or service that
people are ready to buy at various prices within some given time peiod
other factors besides price held constant. FACTORS THAT CAN CAUSE DEMAND TO
CHANGE: 1. Taste and Preferences 2. Income
NON-PRICE DETERMINANTS OF
SUPPLY: 1. Costs and Technology 2. Price of other
Goods and Services Offered
Must be converted to:
Demand
Quantities of a good or service that
people are ready to buy at various prices within some given time peiod
other factors besides price held constant. FACTORS THAT CAN CAUSE DEMAND TO
CHANGE Taste and Preferences Income
NON-PRICE DETERMINANTS OF SUPPLY
Costs and TechnologyPrice of other
Goods and Services Offered
I suggest you disable any existing HTML capabilities from your editor, and use a simple textarea instead, where the users would enter the content with markdown formatting (which is very close to what they're currently doing).
There are many converters from Markdown to HTML, for several languages (see for example this Wikipedia article). So you can use a JavaScript implementation for a live preview (like Stack Overflow does), and use another server-side parser to convert the content when creating your HTML views from the database.