i18n l10n – How to display the user’s preferred language in a User view

In a Drupal 8/9 site, I can select the User’s preferred language.

In the “Manage form display” page (for user’s fields), there are two rows which are about language:

  • Language settings (settings = –no settings available–)
  • Language code (settings = “language select” as the only option)

Question 1 : What do these two options produce?

In the “Manage display” page, I can display only one item about the language : Language code

As a result, if I visit my user profile page, I can see:

Language code: French

But if I change my preferred language in my user edit profile page into Dutch, there is no effect in my “User view” page: it is always “French”

ok, I can preprocess something and adapt the twig template to display my preferred language but this is not the answer I would like to have.

Question 2: I would like to understand this behavior because, as always in Drupal, I am sure there is a good reason for that.

What Is Google’s Preferred Method Of Configuring A Mobile Site?

What is Google’s preferred method of configuring a mobile site?

design – Which is preferred: subclass double or create extension methods to test (relative) equality due to floating point differences?

I am writing financial calculation software using .NET C#, which needs to be blazingly fast. There is a lot of fractional math. So using decimal type is pretty much out of the question, given its poor speed relative to using double. But of course double has its problems testing for equality, with floating point rounding issues.

My options seem to be subclassing double and overriding ==, < and >; versus creating extension methods for double equivalent to these. My tendency is to go with the latter – less code to change and maybe it will be less confusing to others reading the code later? Is there another option? What are other good reasons to choose one over the other?

Preferred server for UK,US and Malaysia for forex VPS

Please suggest me dedicated servers to be distributed as Forex VPS at UK,USA and Malaysia location.
Feel free to drop dedicated server prov… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1824008&goto=newpost

Preferred way of calculating run chances in Game of Cricket

For modelling a simple game of cricket, Considering a batsman has a single attribute rating. I can go about deciding run chances by weighted probabilities. Something like
# map of run: probability
if batsman.rating <= 30:
probabilites = {0: 0.7, 1: 0.1, 2: 0.1, 3:0.5, 4:0.5, 6:0 }
elif 30 <batsman.rating < 60
probabilites = {0: 0.7, 1: 0.1, 2: 0.1, 3:0.5, 4:0.5, 6:0 }
else:
probabilites = {0: 0.7, 1: 0.1, 2: 0.1, 3:0.5, 4:0.5, 6:0 }

Now there are two challenges:

  1. What if I want finer control over batsman.rating and probabilities? How do I manage to keep the sum of all probabilities equal to 1?
  2. How to manage a second attribute to a batsman, let’s say aggression. Which can lower chances of 0 and increase chances of 6?

Initially tried dealing to have finer control like below:

# map of batsman rating: probability, 
rating_to_zero_chances = {0: 0.9, 10: 0.7, 30: 0.5, 60: 0.3, 90: 0.1}
rating_to_one_chances = {0: 0.9, 10: 0.7, 30: 0.5, 60: 0.3, 90: 0.1}
chances_of_zero =  <some library>.interpolate(rating_to_zero_chances).yvalue(batsman.rating)
chances_of_one =  <some library>.interpolate(rating_to_one_chances).yvalue(batsman.rating)
.
.
...do this for each run

The problem with this is that I cannot interpolate the probabilities such that they are equal to 1, Since the slope of runs for the interpolated data are different

For challenge 2, Initially tried handling it by making a probability density function and shifting the mean of the curve if the aggression is more. This creates a problem when there is a 3rd or 4th attribute added (such as timing etc are added).

Currently am planning to deal with a single run with its chance, rather than having to sum their probabilities to 1 like below:

zero_chance = interpolate(rating_to_zero_chances).yvalue(batsman.rating)
zero_chance += aggression / 100  # assuming aggression on 1-100
is_zero_scored = binom((0,1), p=zero_chance).random()
if is_zero_scored:
    return 0    
one_chance = interpolate(rating_to_one_chances).yvalue(batsman.rating)
one_chance += aggression / 90  # assuming aggression on 1-100
is_one_scored = binom((0,1), p=one_chance).random()
if is_one_scored:
   return 1
. # similarly for 2
.
.

Is there any neater way to do this? I am new to game development and had learned about probability distributions recently. Are there some theoretical/ practically established concepts I should be looking at?
How do game developers handle and balance different chances of an event?

google search – Should I noindex the old site after moving or it’s preferred to remove it

I moved from wordpress.com that was mapped to a domain A.net to another domain B.com for 8 months ago.

Now the mapping between domain A.net and wordpress.com is expired but still domain A.net redirects (301) to domain B.com

So what Should I do,

  • Remove WordPress.com site permanently.

  • Extend the wordpress.com mapping with domain A.net

  • Discourage search engine to index WordPress.com (I set this option for 1 month ago)

  • Actually, I lost 100% rank from google, so if I rollbacked the move and remapped the WordPress.com to domain A.net after enabling the discouragement of the search engine option, it will go back to its old rank!

menu – Is the Macintosh Menubar Preferred?

The Macintosh menu bar is certainly preferable to me, and there are some good arguments for (and against) its use.

The main argument for a persistent menu bar across the top of the screen is that it becomes an infinitely-large target along the top edge, which according to Fitts’ law makes it much faster to target with the mouse. It’s also notable that in Windows (which, as you probably know, still uses per-window menu bars), many core applications are losing their menu bars entirely behind drop-down menus and disclosure arrows (see Internet Explorer, Windows Explorer, etc.), which makes finding things like the Edit menu (for copy and paste) much harder for users who haven’t memorised the keyboard shortcuts than it once was.

The main argument against a persistent menubar is that it makes the interface inherently modal. While I have a specific application focused, I’m in that application’s “mode”, and I am forced to actively change application focus before I can interact with the menus for another application. If I have a word-processing document open and a web page open in a web browser, it’s not always immediately obvious which has focus (which can make choosing things like “Window > Minimize” have unintended consequences). It’s worth noting that even without a persistent menu bar, desktop window managers tend to be somewhat modal since keyboard shortcuts (e.g. for copy and paste) only apply while a given application (or document) window has focus. Since that limitation seems unsurmountable, perhaps making the interface seem more modal is a good thing (and could explain why Windows users tend to run their applications fully maximised much more often than Mac users do).

It may also be that on today’s 20-inch-and-larger displays the distance between the window you’re interacting with and its menus is too great (the original Mac had a 9-inch screen with a resolution of 512×342 pixels). Compare a modern Mac’s resolution (the one I’m typing on is 1920×1200) with the one below from Computerhovel.com — the distance of the window from the menu bar could never really exceed 100 or so pixels.

Low-res Macintosh screenshot

Here’s a great blog entry by StackExchange’s own Jeff Atwood about the relative pros and cons of the Mac menu bar that touches on a few of my points and adds a few more.

clean code – Preferred architecture for tree stuctured data (Angular/Typescript)

After reading some of “Clean Architecture” I got the idea that perhaps I should reconsider the way I have architected a chart of accounts/accounts object in an accounting program.

I have accounts which live in a tree structure like this:

Budget account (root) 
   Sections (0..n)
     Accounts (0..n)
       Subaccounts (0.n)
          LineItems(0..n)`

Only line items have an actual concrete ‘total’ value, which is entered by a user and stored as a number field. Each level of the hierarchy derives the total from the sum of its children’s total, so the Budget Account total is ultimately equal to the sum of all the line items.

My question is this — Should the ‘total’ property above ‘lineitem’ of each account be implemented as a function equal to something like

get total() :number {
  return (sumOf(children.total())
} 

, or should it be designed as a number field on each account which is updated in response to user lineitem changes by responding to an observable which announces changes in the values of any of accounts children?

In the former case, accuracy and maintainability, simplicity, concurrence are all probably increased if there is only one set of actual data to be maintained at the line item level, but it just seems like a heck of a lot of processing that has to happen each time a page with accounts has to show its total. For example if a page header {{budgetAccount.total}} that in turn would provke a process where every single account is recursed through a loop to calculate the total — on every page referesh! And if you print the entire chart of accounts, the same numbers are added over and over and over each time an account.total is requested. However, with the speed of and capacity of todays machines and browser and I don’t have akeen sense if the burden of all this processing is actually meaningful or not and worth persisting some of these imemdiate totals within the accoutn object, so they don’t need recalculation everytime some uses the getter.

For context, might be 20K-30K lineitems in my actual budget, split over maybe 1,000 accounts at various levels. But of course, an exceptionally large budget may come along with as many as 100,000 or 500,000 line items. In my application, the entire budget structure is kept in memory once retrieved from the back end..

What the factors that should be considered in this decision?

front end – Is there a way to count quantity of evaluations (this preferred) or edits in a cell since last notebook save?

Abstract

The goal is to use this to create an autoSave(evals_:5):=Module({}, save after set number of evaluations or edits have occured...). I asked a similar question before as Can Mathematica be set to remind user to save after a set number of unsaved edits have occurred or after a set amount of time has passed? but only received a halfway satisfactory answer. This is no knock on those generous members who tried to answer this as the official documentation does not demonstrate such an obvious utility or it is well hidden if it does. However I did find an excellent short and sweet answer for an autoSave(...) based on seconds passed here (look for last answer entitled “From Mathematica Engineers:” Is there a notebook autosave frequency configuration? which I edited for flexibility:

autoSave(minutes_ : 10) := 
  Dynamic(Refresh(NotebookSave(); DateString(), 
    UpdateInterval -> minutes 60));
autoSave()

Goal

The goal of finding counts of evaluations in a cell or number of edits is to use that to make autoSave(minutes_:10, evals_:3) more flexible by saving notebook based on minutes passed or number of evaluations since last save whichever comes first.

I hope I did not impart too many details leaving participants confused. The target solution only needs to count number of evaluations or edits since last save. I can do the rest but given to help participants target a solution compatible for such use.

Poll Results: Preferred Virtualization Engine for Cheap VPS Hosting

On May 15th we asked our users to tell us which virtualization engine they most preferred as the basis of their cheap VPS hosting plans.  After 9 days of voting and 327 unique votes, the answer is in, and the community has decidedly voted in favor of KVM virtualization.

While voting will remain open we grabbed the results as of May 24th (after 9 days of voting and 327 votes).

Recently we’ve published a number of guides about different virtualization technologies, including KVM, Xen and OpenVZ. If you are not familiar with the differences you can start by reading a broad description of the three and then continue to learn more about KVM Virtualization followed by OpenVZ Virtualization.

Check out the results below:

poll results preferred virtualization engine for cheap vps

While it is not surprising that KVM Virtualization was the preferred hypervisor engine according to our users, what is surprising is the extent to which it led other options, including OpenVZ and Xen. Both VMWare and Hyper-V tend to be more on the enterprise side of the game, but even still, they both beat Xen. While the whole “low end box” era of cheap VPS hosting started with OpenVZ it is clear that the transition to dedicated resources and enhanced security/neighbor protections offered by KVM is well under way. A few year ago a 2GB RAM OpenVZ VPS was very exciting — even though it would have likely been RAM oversold many times over. Today, there are no shortage of great deals available on inexpensive KVM based VPS options, many of which now offer RAM allocations in excess of 2GB for less than $10/month.

If you are shopping for a cheap KVM based VPS, check out the latest offers on LowEndBox.

There are plenty of great OpenVZ VPS offers still available, too, should you prefer it.

Thanks to everyone who took a moment to vote and share their opinion on our Preferred Virtualization Engine Poll!

Related posts:

Poll: OpenVZ VPS, KVM VPS, Xen VPS or Other?

Poll: What do you use your VPS for?

Jon Biloh

I’m Jon Biloh and I own LowEndBox and LowEndTalk. I’ve spent my nearly 20 year career in IT building companies and now I’m excited to focus on building and enhancing the community at LowEndBox and LowEndTalk.