## Incorporating JavaScript in HTML – Web Applications Stack Exchange

I am new in HTML writing via dreamweaver 2020.

I have added the following codes to dw:-

``````<head>
<meta charset="utf-8">
<title>The ul, ol, and li tags</title>
<style type="text/css"> body {background-color: #E4E978;}</style>
<script type = "text/javascript">;
today = new Date();
dateValue = today.getYear() + "午" + today.getMonth() + "月" + today.getDay() + "日";
window.alert("n welcome nn today is " + dateValue "nn redirecting to my site");
var hour, min;
function showclock();
{   now = new Date();
hour = now.getHours();
if (hour <=9) hour = "0" + hour;
min = now.getMinutes();
if (min <= 9) min = "0" + min;
document.clock.time.value "NOW is" + hour + "/" + min;
setTimeout("showclock()", 1000 );
}
</script>
``````

I found that they were totally ignored.

Other things that I have tried (and with the same being-ignored result) are:-

(2) adding <!– in case some browsers have no JavaScript interpretation power;

(3) running on different engines (edge etc.)

Please let me know what procedures that I have missed.

## log messages – Incorporating Drupal 8 logs into Splunk

In Drupal 8 you may define your own logger implementation to do whatever you want with log messages. The default logger provided by core Drupal saves these messages in the Drupal database and makes them available in the UI at `/admin/reports/dblog`. This default logger is implemented in the core dblog module by the logger class `DrupaldblogLoggerDbLog`, and that’s a great example to use when you write your own.

A logger is a class that implements `LoggerInterface` and is used as a service with the ‘logger’ service tag. All registered loggers are used for every channel. You don’t need to ‘trigger’ a logger or do anything special to have that logger automatically used by core Drupal, other than tagging the service.

The service definition for the core DbLog logger looks like this (from dblog.services.yml):

``````services:
logger.dblog:
class: DrupaldblogLoggerDbLog
arguments: ('@database', '@logger.log_message_parser')
tags:
- { name: logger }
- { name: backend_overridable }
``````

You can see that the `logger.dblog` service is implemented by the `DbLog` class, and this service is tagged as a logger. That tag is how Drupal knows to send log message to this service. Without the tag, Drupal wouldn’t know this service was a destination for log messages.

Another good example in core is the core syslog module, which provides a logger that uses the PHP `syslog()` function to send messages to an operating-system-dependent location (probably a flat text file shared by all other programs that log messages on that operating system).

To make your own ‘Splunk’ logger, you would create a module that defines a logger service, for example `logger.splunk`. (Services are defined in the module’s `<modulename>.services.yml` file.) You must have a class, for example ‘Splunk’ that implements `LoggerInterface`. In that ‘Splunk’ class you may use the Splunk API to send log messages to Splunk. The details of how to do that is up to you as it has nothing to do with Drupal at this point. If you have code that sends log messages to Splunk from a standalone program then I think it is pretty clear from examples provided by core how to use that code in your logger class.

Your module will consist of a `<modulename>.info.yml` file, a `<modulename>.services.yml` file, and a `<modulename>/src/Logger/Splunk.php` file. Nothing more is needed. If you’ve done it right, then when you enable your module all messages should be logged to Splunk.

## calculus – Help incorporating a variable that I set to 0 even though the problem didn’t explicitly ask for it.

The equation that the problem is built around $$cfrac{1}{1-rho}(w-pi)^{1-rho} = cfrac{1}{2} left( cfrac{1}{1-rho}(w-x)^{1-rho} right) + cfrac{1}{2} left( cfrac{1}{1-rho}(w+y)^{1-rho} right)$$

In these problems, typically $$w > 0$$, $$x > 0$$, $$y > 0$$, $$pi geq 0$$ (it’s not 3.14…)

The problem wants me to show that for $$rho > 1$$, $$y$$ can never be sufficiently large for $$cfrac{1}{1-rho}(w-pi)^{1-rho} leq cfrac{1}{2} left( cfrac{1}{1-rho}(w-x)^{1-rho} right) + cfrac{1}{2} left( cfrac{1}{1-rho}(w+y)^{1-rho} right)$$

when the following is satisfied.
$$cfrac{x}{w} geq 1 – 0.5^{1/(rho-1)} quad Leftrightarrow quad rho geq cfrac{log(0.5)+log(1- x/w)}{log(1-x/w)}$$

In a previous problem, I solved for $$y$$ in the first equation. Here’s my work so far.

We know from part (b) that the minimum value of $$y$$ is given by
begin{align*} y &= left( 2(w-pi)^{1-rho} – (w-x)^{1-rho} right)^{1/(1-rho)} – w end{align*}
Which implies that the agent will accept a gamble that satisfies
begin{align*} y &geq left( 2(w-pi)^{1-rho} – (w-x)^{1-rho} right)^{1/(1-rho)} – w end{align*}
Define $$-gamma = 1-rho$$ where $$gamma geq 0$$
begin{align*} y &geq left( 2(w-pi)^{-gamma} – (w-x)^{-gamma} right)^{-(1/gamma)} – w \ y &geq left(frac{1}{ left( cfrac{2}{(w-pi)^gamma} – cfrac{1}{(w-x)^gamma} right)}right)^{1/gamma} \ end{align*}
For fixed $$gamma$$ we see that $$y$$ approaches $$infty$$ as
begin{align*} cfrac{2}{(w-pi)^gamma} &= cfrac{1}{(w-x)^gamma} \ 2(w-x)^gamma &= (w-pi)^gamma \ 2^{1/gamma}(w-x) &= w – pi \ (w-x) &= cfrac{w-pi}{2^{1/gamma}} \ x &= w – cfrac{w-pi}{2^{1/gamma}} \ x &= cfrac{2^{1/gamma}w – w – pi}{2^{1/gamma}} \ x &= cfrac{w(2^{1/gamma} – 1) – pi}{2^{1/gamma}} end{align*}

Now let $$pi = 0$$ (no risk premium)
begin{align*} x &= cfrac{w(2^{1/gamma} – 1)}{2^{1/gamma}} \ cfrac{x}{w} &= 1 – left(cfrac{1}{2}right)^{1/gamma} = 1 – left(cfrac{1}{2}right)^{1/(1-rho)} end{align*}

I don’t feel comfortable about setting $$pi=0$$. While it feels intuitive to set it equal to zero (have the gamble be a “free insurance policy”), if $$pi$$ were equal to $$0$$, the problem should have specified it. Is there a way I can show that $$pi$$ disappears in the solution without setting it equal to 0?

## java – Incorporating HttpSession into libGDX communication

I wrote my server-side code prior to learning libGDX and writing my client-side code. Gdx.net provides for the http get communication I designed for, except for session authentication. I say that based on not finding sessions mentioned in the API, and a couple heavies confirming it on the libGDX discord.

Are there any libraries / examples out there of libGDX developers who mirrored session authentication functionality? The key limitation here is I want to stay with http request/response communication.

Minus any such direction, my next step will be to try using the “javax.servlet” libraries I used server-side on the client, and forgo the http classes that come included in the Gdx.net package. I’m reluctant to take this step noting that libGDX has its own versions of lots of classes, for efficiency and to prevent memory leaks given how libGDX programs execute. It’ll be a while yet before my programming skills can detect and address such subtle issues. Also, I think that browsers and the server servlets run on participate in session architecture. With neither component in a libGDX PC app for “javax.servlet” to collaborate with, I’m doubtful this solution can work.

If it doesn’t work, I’ll think about moving up my goal of researching and learning how to use cloud hosting services. Some of these were recommended to me on discord as having frameworks with built-in support for authentication.

## website design – Designing for Incorporating multiple workspaces into one interface (WYSIWYG) with a live preview

I’m currently working on an editor for an interactive quiz program my mates have worked on. The quiz has interactive questions that require the user to interact with a passage (i.e. the photo below has a “passage select” question).

Currently, I’ve been designing an editor for the quiz and it seems like there are four important workspaces to be incorporated:

1. Navigation Bar to maneuver through lessons and its questions
2. A question editor that also allows users to link to a passage
3. A live preview where users can see what the quiz will look like in real time
4. A passage section that users can edit and also more easily how and what content to connect too

Currently, I’ve incorporated 1, 3, and 4 into my designs, and I’m wondering how to incorporate the passage section into the interface, without jumbling the workspace.

I’ve gotten feedback that the passage editing section should take precedence over the live preview, so I was wondering how I could harmonize everything together.

I have taken a look at this post and I’ve thought about potential solutions:

1. Squeeze all 4 workspaces into one screen and have them be adjustable (similar to Adobe, Google Web Design) – difference though is that those have live preview has a high-priority feature, while in my case, it’s more of like icing on the top

2. Have tabs to switch between live preview and the passage.

3. Have the live preview be more of a floating feature, kind of like the floating workspaces in Adobe that can be minimized or maximized or the mini video of Zoom.

4. Place the live preview or passage editor selection in the same workspace as the question editor (similar to editing and making posts on StackExchange!) Downside I see is that the user would have to do a bit of constant scrolling to see either a preview or the passage editor (like I am right now)

Any thoughts or feedback would be appreciated!

## marketing – What is the best method of incorporating ads/IAPs into your mobile game as an indie dev in 2020?

As the title reads – since the freemium model seems like the only viable for mobile games right now, which route do you tend to go as solo devs/small studios? Do you incorporate all the IAPs and ads you were planning to right away at launch or do you launch the game without them and wait with adding them until it gets some traction, so as not to scare away the initial userbase? Or maybe you incorporate some ads right away (like the less obtrusive ones – static banners at the bottom, for example) while waiting with interstitials/videos for longer?

Also, did you find like some things are a big no-no or that they simply don’t work like you’d like them to? Like, do you still use forced interstitials every X restarts, for example, or did you move away from this? What are your good practices you try to keep in mind?

Which methods proved more viable to make ends meet for you?

## .net – Incorporating immutable signatures in C#?

I realize this is a subjective question, but after studying F# and functional programming I’ve seen the benefits of immutability.

Now, I’m thinking of getting rid of mutability entirely in C# unless specifically required. In essence, where before I might have written a function with a signature like –

``````public static int F(List<string> input)
``````

I’m now paranoid if that function might mutate the list unless I want it to. So now I’m thinking of doing something like

``````public static int F(ImmutableList<string> input)
``````

Also, if I actually do want to mutate a list, before I’d do something like

``````public static void F(List<string> input)
``````

and mutate it directly, but now I’m thinking of doing something like this instead:

``````public static ImmutableList<string> F(ImmutableList<string> input)
``````

and just re-assigning the new list.

I don’t see this pattern widespread in C# though, even with the benefits of immutability. I’m wondering whether it would be wrong for me to transition to function signatures like this in C#, and if there’s a reason this isn’t more widespread?

## Javascript – Error while incorporating a library in Requirejs

I'm trying to implement a library of DataTables tables, the system I use to modularize dependencies. Personally, I have never worked with this JavaScript plugin. When I try to integrate the library of tables, I get an error message:

``````Uncaught Error: Mismatched anonymous define() module: function(E){return h(E,window,document)}
``````

According to what I read, it happens when a script is called with the same references that use the request, but I honestly do not know what to change to integrate it.

The required settings are as follows:

``````shim: {
'bootstrap': ('jquery'),
'sparkline': ('jquery'),
'tablesorter': ('jquery'),
'vector-map': ('jquery'),
'vector-map-de': ('vector-map', 'jquery'),
'vector-map-world': ('vector-map', 'jquery'),
'core': ('bootstrap', 'jquery'),
},
paths: {
'core': url+'assets/js/core',
'jquery': url+'assets/js/vendors/jquery-3.2.1.min',
'bootstrap': url+'assets/js/vendors/bootstrap.bundle.min',
'sparkline': url+'assets/js/vendors/jquery.sparkline.min',
'selectize': url+'assets/js/vendors/selectize.min',
'tablesorter': url+'assets/js/vendors/jquery.tablesorter.min',
'vector-map': url+'assets/js/vendors/jquery-jvectormap-2.0.3.min',
'vector-map-de': url+'assets/js/vendors/jquery-jvectormap-de-merc',
'vector-map-world': url+'assets/js/vendors/jquery-jvectormap-world-mill',
'circle-progress': url+'assets/js/vendors/circle-progress.min',
}
});
``````

As you can see, I have not changed anything about data tables because I do not know very well how to do it

The code invoked in the view to trigger the request is:

``````requirejs.config({
baseUrl: '.'
``````

});

If anyone knows how to integrate datatables, I would really appreciate it