text:
Q: Why is my card overlapping the fixed nav when I hover it? I have a problem when I hover my article with class="card" name inside my div class="container", it looks like the article overlaps the nav. How do I fix this without removing my transform scale in .card:hover? I want to make it without overlapping with the nav when I hover over it.

window.onscroll = function() {
  myFunction()
};

var navbar = document.querySelector(".myNav");

var sticky = navbar.offsetTop;

function myFunction() {
  if (window.pageYOffset >= sticky) {
    navbar.classList.add("sticky")
  } else {
    navbar.classList.remove("sticky");
  }
}
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;700&display=swap');
* {
  text-decoration: none;
  box-sizing: border-box;
  font-family: sans-serif;
}

body {
  background-image: url('/Website/Images/SPY_X_FAMILY.jpg');
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  min-height: 200vh;
  margin: 0;
  padding: 0;
}

.header-container {
  margin: 0;
  opacity: 0.885;
}

.container {
  padding: 10px;
  background-color: #FFA1C9;
  float: left;
  width: 75%;
  display: flex;
  flex-direction: column;
}

nav {
  background-color: #F94892;
  margin: 0 50px 50px 50px;
  border-radius: 5px;
  transition: 0.3s;
}

nav:hover {
  transform: scale(1.005);
  transition: 0.3s;
}

nav li {
  color: rgb(227, 118, 118);
  text-align: center;
  padding: 10px;
}

nav ul {
  margin-top: 0;
}

nav a {
  color: white;
  font-family: 'Quicksand';
  font-size: 20px;
}

.myHeader {
  text-align: center;
  background-color: #FFC4C4;
  margin: 20px 20px 0 20px;
  border-radius: 10px;
  padding: 12px;
}

header h1>img {
  width: 42%;
}

nav li {
  margin: 0;
}

nav a {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  position: relative;
  z-index: 0;
  font-family: 'Quicksand';
}

nav a::before {
  content: "";
  position: absolute;
  width: 0;
  height: 15px;
  background: rgb(182, 1, 32);
  bottom: 0;
  left: 0;
  z-index: -1;
  transition: 0.2s linear;
}

nav a:hover::before {
  width: 100%;
}

.card {
  background-color: #FBE5E5;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  margin: 1.25em;
  padding: 1.25em;
}

.card:hover {
  transform: scale(1.0025);
  transition: 0.2s;
  position: relative;
}

.content-container>h2 {
  margin: 10px;
}

/* text font-size */

h2 {
  font-size: 2.25em;
  color: rgb(212, 27, 58);
  font-family: sans-serif;
  font-weight: 700;
  margin: 20px;
}

p {
  font-size: 1.25em;
  color: F94892;
}

h3 {
  font-size: 1.25em;
  color: rgb(212, 27, 58);
}

h1 {
  margin: 0;
}

/* image */

.image-style {
  text-align: center;
  width: 100%;
  max-height: 300%;
  object-fit: cover;
  object-position: center;
}

/* sticky navbar */

.sticky {
  position: fixed;
  top: 0;
  width: 100%;
  margin: 0;
  transition: 0.3s;
  transform: scale(1.0025);
}

.sticky li {
  display: inline-block;
  padding-left: 50px;
}

/* Add some top padding to the page content to prevent sudden quick movement (as the navigation bar gets a new position at the top of the page (position:fixed and top:0) */

.sticky+nav {
  padding-top: 60px;
}

/* profile things */

.card-v2 {
  background-color: #FBE5E5;
  box-shadow: 0 4px 8px 0 rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  margin: 1.25em;
  padding: 1.25em;
}

.card-v2:hover {
  transform: scale(1.0025);
  transition: 0.2s;
  box-shadow: 0 5px 10px 5px #F94892;
}

.profile {
  background-color: #FFA1C9;
  padding: 5px;
  margin: 0;
  float: right;
  width: 25%
}

.profile img {
  width: 200px;
}

.profile header {
  text-align: center;
}

.profile-head {
  display: inline;
}

#aside {
  background-color: #FFA1C9;
  margin: 0;
}

.card-v3 {
  background-color: #FFC4C4;
  border-radius: 5px;
  margin: 1.25em;
  padding: 1.25em;
}

.card-v3:hover {
  box-shadow: 0 4px 8px 8px #efd6d6;
}

/* table */

.table-style {
  text-align: center;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="style.css">
  <title>My Problem</title>

Home

About

Other

Header 2

Lorem ipsum dolor sit amet consectetur adipisicing elit. Eum architecto culpa ab enim tempora atque corporis nam rem, exercitationem quasi cumque et quam quisquam odio, labore fugit molestias, quo quod?

Lorem

Header 3

          Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto inventore nisi provident quasi reiciendis odit reprehenderit ut non, voluptatum perspiciatis blanditiis illo a! Rem, recusandae ab commodi provident ex praesentium.

Header 2

Lorem ipsum dolor sit, amet consectetur adipisicing elit. Excepturi expedita soluta nihil, praesentium perferendis cum rerum similique ab? Natus saepe molestias reiciendis voluptas voluptatibus consectetur adipisci praesentium asperiores deleniti
          odio.

Header 2

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores tempora doloribus dicta quibusdam, corrupti quam maiores laboriosam quo voluptatum autem ea ad quaerat id suscipit magnam unde cupiditate, voluptates harum.

About Me

              Name:

              Tempat, tanggal lahir:

              Alamat:

              Agama:

If anything is missing from the snippet, you can check my jsfiddle here

A: What you're experiencing is something referred to as The Stacking Context which, if you think about it from a top-down perspective, is how elements are rendered in the browser. To solve this, you can set the parent element -- in this case the header-container -- to position: relative; and give it a z-index of 1 to override the default of 0. That will elevate it above the card which is using the default of 0 even when hovered.
Here's another good explanation for it as well: https://www.joshwcomeau.com/css/stacking-contexts/

window.onscroll = function() {
  myFunction()
};

var navbar = document.querySelector(".myNav");

var sticky = navbar.offsetTop;

function myFunction() {
  if (window.pageYOffset >= sticky) {
    navbar.classList.add("sticky")
  } else {
    navbar.classList.remove("sticky");
  }
}
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;700&display=swap');
* {
  text-decoration: none;
  box-sizing: border-box;
  font-family: sans-serif;
}

body {
  background-image: url('/Website/Images/SPY_X_FAMILY.jpg');
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  min-height: 200vh;
  margin: 0;
  padding: 0;
}

.header-container {
  margin: 0;
  opacity: 0.885;
  position: relative;
  z-index: 1;
}

.container {
  padding: 10px;
  background-color: #FFA1C9;
  float: left;
  width: 75%;
  display: flex;
  flex-direction: column;
}

nav {
  background-color: #F94892;
  margin: 0 50px 50px 50px;
  border-radius: 5px;
  transition: 0.3s;
  z-index: 2;
}

nav:hover {
  transform: scale(1.005);
  transition: 0.3s;
}

nav li {
  color: rgb(227, 118, 118);
  text-align: center;
  padding: 10px;
}

nav ul {
  margin-top: 0;
}

nav a {
  color: white;
  font-family: 'Quicksand';
  font-size: 20px;
}

.myHeader {
  text-align: center;
  background-color: #FFC4C4;
  margin: 20px 20px 0 20px;
  border-radius: 10px;
  padding: 12px;
}

header h1>img {
  width: 42%;
}

nav li {
  margin: 0;
}

nav a {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  position: relative;
  z-index: 0;
  font-family: 'Quicksand';
}

nav a::before {
  content: "";
  position: absolute;
  width: 0;
  height: 15px;
  background: rgb(182, 1, 32);
  bottom: 0;
  left: 0;
  z-index: -1;
  transition: 0.2s linear;
}

nav a:hover::before {
  width: 100%;
}

.card {
  background-color: #FBE5E5;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  margin: 1.25em;
  padding: 1.25em;
  transition: 0.2s;
}

.card:hover {
  transform: scale(1.0025);
  transition: 0.2s;
}

.content-container>h2 {
  margin: 10px;
}

/* text font-size */

h2 {
  font-size: 2.25em;
  color: rgb(212, 27, 58);
  font-family: sans-serif;
  font-weight: 700;
  margin: 20px;
}

p {
  font-size: 1.25em;
  color: F94892;
}

h3 {
  font-size: 1.25em;
  color: rgb(212, 27, 58);
}

h1 {
  margin: 0;
}

/* image */

.image-style {
  text-align: center;
  width: 100%;
  max-height: 300%;
  object-fit: cover;
  object-position: center;
}

/* sticky navbar */

.sticky {
  position: fixed;
  top: 0;
  width: 100%;
  margin: 0;
  transition: 0.3s;
  transform: scale(1.0025);
  z-index: 1;
}

.sticky li {
  display: inline-block;
  padding-left: 50px;
}

/* Add some top padding to the page content to prevent sudden quick movement (as the navigation bar gets a new position at the top of the page (position:fixed and top:0) */

.sticky+nav {
  padding-top: 60px;
}

/* profile things */

.card-v2 {
  background-color: #FBE5E5;
  box-shadow: 0 4px 8px 0 rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  margin: 1.25em;
  padding: 1.25em;
  z-index: 0;
}

.card-v2:hover {
  transform: scale(1.0025);
  transition: 0.2s;
  box-shadow: 0 5px 10px 5px #F94892;
}

.profile {
  background-color: #FFA1C9;
  padding: 5px;
  margin: 0;
  float: right;
  width: 25%
}

.profile img {
  width: 200px;
}

.profile header {
  text-align: center;
}

.profile-head {
  display: inline;
}

#aside {
  background-color: #FFA1C9;
  margin: 0;
}

.card-v3 {
  background-color: #FFC4C4;
  border-radius: 5px;
  margin: 1.25em;
  padding: 1.25em;
  z-index: 0;
}

.card-v3:hover {
  box-shadow: 0 4px 8px 8px #efd6d6;
}

/* table */

.table-style {
  text-align: center;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="style.css">
  <title>My Problem</title>

Home

Abouta>

Other

Header 2

Lorem ipsum dolor sit amet consectetur adipisicing elit. Eum architecto culpa ab enim tempora atque corporis nam rem, exercitationem quasi cumque et quam quisquam odio, labore fugit molestias, quo quod?

Lorem

Header 3

          Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto inventore nisi provident quasi reiciendis odit reprehenderit ut non, voluptatum perspiciatis blanditiis illo a! Rem, recusandae ab commodi provident ex praesentium.

Header 2

Lorem ipsum dolor sit, amet consectetur adipisicing elit. Excepturi expedita soluta nihil, praesentium perferendis cum rerum similique ab? Natus saepe molestias reiciendis voluptas voluptatibus consectetur adipisci praesentium asperiores deleniti
          odio.

Header 2

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores tempora doloribus dicta quibusdam, corrupti quam maiores laboriosam quo voluptatum autem ea ad quaerat id suscipit magnam unde cupiditate, voluptates harum.

About Me

              Name:

              Tempat, tanggal lahir:

              Alamat:

              Agama:

A: try to set the z-index of the nav to 100
nav {
    z-index: 100;
}


text:
Q: cant find iPhone simulator in application support I want to add photos to my iPhone 6.0 simulator but i cant find the folder in the Application Support. Not the iPad simulator either. Can it be somewhere else or do I have to download something?

A: Try this
finder -> go -> go to folder -> paste exactly the following:
~/Library/Application Support/iPhone Simulator/6.0/Media/DCIM/100APPLE/

you can place your photos here.
:)

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to move JSON-LD from in-line to in-a-file? I have an HTML document with JSON-LD published as follows:
<script type="application/ld+json">
    {
           "@context": {
               "gs1": "http://vocab.gs1.org/v1#",
               "xsd":"http://www.w3.org/2001/XMLSchema#"
           },
           "@id": "retailer:12345",
           "@type": "gs1:Offering",
           "gtin13":"5011476100111",
           "gs1:hasPrice": {
               "gs1:price": "2.49",
               "gs1:priceTypeCode": "USD",
               "@type":"gs1:Price"
           }
      }
</script>

This works as expected (meaning it is valid and visible using Google Structured Data Testing Tool and Structured Data Linter)
Using Same Origin (not Cross Origin), how to move the in-line JSON-LD to a file?
This approach fails:
<script type="application/ld+json" src="_URL_.json"></script>

This approach also fails:
<script type="application/ld+json">
        $(document).ready(function(){
            $.ajax({
                url: "_URL_.json",
                dataType: 'json',
                });
        });
</script>

How to correct my approach to create a solution where the JSON-LD is in file on my server, not in the HTML?
Next, assume my site is CORS-enabled.
How to publish the JSON-LD structure in a JSONP format so that another domain can subscribe to the JSON-LD data?

A: Tools like the Google Structured Data Testing Tool or the Structured Data Linter don't support external references. And probably many consumers of your JSON-LD neither.
If you want to do it anyway, you would have to use a link instead of a script element, because for the use as data block, the script element may not have a src attribute.
The variant with including the JSON-LD dynamically might work for consumers that support JavaScript for that purpose. (Google seems to support it; maybe it's only their testing tool that can't use it.)

A: You could generate your script tag dynamically:
<script>
  // do some ajax, get the JSON-LD as `data` and then...
  $.ajax(...).done(function(data) {
    var el = document.createElement('script');
    el.type = 'application/ld+json';
    el.text = JSON.stringify(data);
    document.querySelector('body').appendChild(el);
  });
</script>


text:
Q: Cookie not set and sent by Express Passport index.js
const express = require('express')
const session = require('express-session');
const MongoStore = require('connect-mongo')(session);
const MongoStore = connectMongo(session);
const app = express()

const sessionStore = new MongoStore({
    mongooseConnection: connection,
    collection: 'sessions'
})

app.use(session({
    secret: 'mysecret',
    resave: false,
    saveUninitialized: true,
    store: sessionStore,
    cookie: {
        maxAge: (1000 * 60)*10
    },
    httpOnly: true,
    secure: false
}));
app.use(passport.initialize());
app.use(passport.session());

passport.serializeUser((user, done) => {

    console.log(user._id: " + user._id);
    done(null, user._id)
})

const GoogleStrategy = passportGoogle.OAuth2Strategy

const strategy = app => {
  const strategyOptions = {
    clientID: GOOGLE_ID,
    clientSecret: GOOGLE_SECRET,
    callbackURL: `/auth/google/callback`
  }

  const verifyCallback = async (accessToken, refreshToken, profile, done) => {

    let [err, user] = await to(getUserByProviderId(profile.id))
    if (err || user) {
      return done(err, user)
    }

    const [createdError, createdUser] = await to(
      createUser({
        provider: profile.provider,
        ...
      })
    )

    return done(createdError, createdUser)
  }

  passport.use(new GoogleStrategy(strategyOptions, verifyCallback))

  app.get('/auth/google/callback',
    passport.authenticate('google'),
    (req, res) => {
      res.cookie('???what is default key set by PassportJS???', req.user._id);
      res.redirect(303, `/loggedByGoogle.html`);
    }

I succesfully
- logged in with Google,
- passport.serializeUser was invoked
- profile data was saved in MongoDB,
- redirection happened to `/loggedByGoogle.html`
but no cookies were sent to client
and there is no entry in "sessions" data store after login.

Do I have to explicitly set and send cookies myself?
Only after I added res.cookie('foo', 'bar');
ahead of
res.redirect(303, /loggedByGoogle.html);
I got some cookie on client side.
I though cookies were set internally by Passport after "serializeUser"
invocation.
Is there a default cookie name (key) set by Passport?
What am I missing?


text:
Q: toDataURL not a function I am trying to generate a url for the canvas. Here are the steps I followed:
var can = document.getElementsByTagName("canvas");
var src = can.toDataURL("image/png");

When I tried running the above code on firebug it throws an error :
TypeError: can.toDataURL is not a function

I am running firefox 8 on ubuntu.

A: Double check you are running toDataURL() the canvas object itself, not on the context object.

A: var can = document.getElementsByTagName("canvas");

this returns an array of canvas elements. you need to get the canvas by id.
var can = document.getElementById("canvasId");

A: Something not mentioned in the accepted answer: even when using an ID selector, jQuery's Sizzle returns an object/collection. So if you are getting this error while using jQuery, use the [0] appendage to access the first index of the element. If you are curious, the indices can be explored by using console.dir($('#canvasId));
For example, this perfectly normal selector would fail:
var src = $('#canvasId').toDataURL("image/png");

But this one would work (notice the extra parenthesis):
var src = ($('#canvasId')[0]).toDataURL("image/png");

A: getElementsByTagName returns a NodeList [docs], not a single element.
Simply access the first element of the list:
var src = can[0].toDataURL("image/png");

If you want to get the data URL for each canvas, then you have to iterate over the list. Otherwise, giving the canvas an ID and retrieving the reference with getElementById might be more convenient.

A: (SOLVED !)
I've encountered with this problem & i solved it . First of ALL you should check that you have included the CDN HTML2CANVAS.js in your script links in your head  tag . To do this you should paste this script in your  head  tag , after the jquery CDN :
(add this script below into your  head  tag )

in this CDN , the function 'toDataURL' have been defined & if you go to this link and search (with CTRL+F) on this script page , you could find toDataURL function . (which has been defined in this CDN)
NOW my head tag is like this below and it works :

A: This code is helpful for capture canvas image and download from a video.
capture() {

  var video = document.getElementById('video');
  var canvas = $('#canvas');
  canvas.attr('width', 300);
  canvas.attr('height', 300);
  canvas[0].getContext('2d').drawImage(video, 0, 0, canvas.width(), canvas.height());
  console.log(canvas);
  var download = document.getElementById("download");
  var image = canvas[0].toDataURL("image/png");
  download.setAttribute("href", image);
}

<video id="video" width="300">
        <source src="videoURL" type="video/mp4">
    </video>

<canvas id="canvas">

</canvas>

A: if you use jquery
var canvas = $('#myCanvasId');
var image = canvas[0].toDataURL('image/png');

if you use javascript
var canvas = document.getElementById('myCanvasId');
var image = canvas.toDataURL();


text:
Q: Photoshop Script Image Resizing With If Else Statement How to do Photoshop script for image resizing with if else statement. Example code:
// get a reference to the current (active) document and store it in a variable named "doc"
doc = app.activeDocument;

// change the color mode to RGB.  Important for resizing GIFs with indexed colors, to get better results
doc.changeMode(ChangeMode.RGB);

// these are our values for the END RESULT width and height (in pixels) of our image
var fWidth = 500;
var fHeight = 500;

// do the resizing.  if height > width (portrait-mode) resize based on height.      otherwise, resize based on width
if (doc.width < "1000px") {
    doc.resizeImage(null,UnitValue(fWidth,"px"));
}
else {
    doc.resizeImage(UnitValue(fWidth,"px"),null,null,ResampleMethod.BICUBIC);
}

This code will generate this. If width of image below than 1000px, it will resize to 500px (height auto based on original image size). I want to resize with specific size for width and height.
If images is 1000px X 500px, this script will resize image to 500px X 250px. I want it will be 500px X 500px. How can I do this?

A: The documentation for resizeImage shows the parameters are
resizeImage([width][, height][, resolution][, resampleMethod])

so simply change your resizeImage call to specify the height and width you want.


text:
Q: Setting [Authorize] attribute on signalr hub class works only when connecting to the hub and not before each method on the hub (ASP.NET Core 2.2) I'm trying to add authentication to my signalR hub but it works only for the 'negotiate' method and not for every request sent to the hub.
In Startup.cs under ConfigureService I added :
// Authentication
services.AddAuthentication(options =>
        {
            options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
            options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
        })
        .AddJwtBearer(options =>
        {
            options.TokenValidationParameters = GetTokenValidationParameters(authSettings.PublicKey);
            options.IncludeErrorDetails = true;
            options.Events = new JwtBearerEvents
            {
                OnMessageReceived = context =>
                {
                    var accessToken = context.Request.Query["access_token"];
                    var path = context.HttpContext.Request.Path;

                    if (!string.IsNullOrEmpty(accessToken) &&
                        (path.StartsWithSegments("/hubs")))
                    {
                        context.Token = accessToken;
                    }
                    return Task.CompletedTask;
                },
            };
        });

In the Configure method I added:
app.UseWhen(ctx => ctx.Request.Path.StartsWithSegments("/hubs"), config => config.UseAuthentication());

And added the [Authorize] attribute on the hub class:
[Authorize]
public class ProtocolMethodsHub : Hub<IProtocolMethodsHub>, IProtocolMethodsHub {}

I set a breakpoint in the OnMessageReceived but it is called only when connecting to signalR and not for each request the is sent through the websocket .
Is there a way to authenticate/authorize each request to the hub?

A: It feels wrong to per request add/remove middleware like this:
app.UseWhen(ctx => ctx.Request.Path.StartsWithSegments("/hubs"), config => config.UseAuthentication());

You can better handle that in the authorization part of the system. AddJwtBearer does not care if the incoing request contains a token or not. Just that, if thr request contains a token, then it should be valid. AddJwtBearer does care about what you are allowed to do, that job is the authorization part. All AddJwtBearer wants to do is to create a User object based on the incoming token.

A: SignalR uses different transports under the hood and each transport can behave a bit differently. For example, if it is using Websocket transport, you are creating a persistent connection between the server and the client and all of the requests go through this connection (which is different than normal HTTP requests) so it only checks the JWT validity during the establishment of the connection. For other transports, the checks happen more often but they still happen only when you are establishing the client connection to the server. In other words, you have already checked the JWT and you know it is valid when the requests start coming in, and SignalR does not double-check the JWT. If you would like to control the authorization and access by the JWT, you might want to either:

*

*Use different hubs with different levels of access.

*In your SignalR hub check the claims of the token to see if the user has access to what they are doing.

UPDATE: So after reading the comments, and I realized that you are looking to figure out what to do when a JWT is expired but the connection is still active. This would only be an issue for Websocket transport since it keeps the persistent connection. I do not believe there is a built-in way to handle this, so I can think of 2 different approaches:

*

*When creating the JWT, include a timestamp claim in the JWT so you can access it every time there is a request in your SignalR hub, if the timestamp is expired just close the connection and force the connection to create a new JWT (assuming you have reconnection logic in your client). Using this approach you can also do more complex checks, in addition to the timestamp, to make sure the JWT is still valid.

*In your client code have a schedule to automatically close and re-open the connection every few minutes. This can cause issues if you are trying to minimize the amount of time that the connection is interrupted.


text:
Q: Partial derivatives of a definite integral I have the following function which I need to evaluate and differentiate:
$$f(x,y)=\int_x^yg(t)dt$$
Firstly how do I find $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ ?
Next, for the evaluation of $g(t)$ - I have to evaluate it numerically as the function is complex.  However would I have to calculate the derivatives using this numerical procedure as well to be consistent with the evaluation?  Or would the analytical derivatives above suffice?


text:
Q: Is it possible to have a pipeline in Airflow that does not tie to any schedule? I need to have pipeline that will be executed either manually or programmatically, is possible with Airflow? Looks like right now each workflow MUST be tied to a schedule.

A: Just set the schedule_interval to None when you create the DAG:
dag = DAG('workflow_name',
          template_searchpath='path',
          schedule_interval=None,
          default_args=default_args)

From the Airflow Manual:

Each DAG may or may not have a schedule, which informs how DAG Runs
  are created. schedule_interval is defined as a DAG arguments, and
  receives preferably a cron expression as a str, or a
  datetime.timedelta object.

The manual then goes on to list some cron 'presets' one of which is None.

A: In Airflow, every DAG is required to have a start date and schedule interval*, for example hourly:
import datetime

dag = DAG(
    dag_id='my_dag',
    schedule_interval=datetime.timedelta(hours=1),
    start_date=datetime(2018, 5, 23),
)

(Without a schedule how would it know when to run?)
Alternatively to a cron schedule, you can set the schedule to @once to only run once.
*One exception: You can omit the schedule for externally triggered DAGs because Airflow will not schedule them itself.
However, that said, if you omit the schedule, then you need to trigger the DAG externally somehow.  If you want to be able to call a DAG programmatically, for instance, as a result of a separate condition occurring in another DAG, you can do that with the TriggerDagRunOperator.  You might also hear this idea called externally triggered DAGs.
Here's a usage example from the Airflow Example DAGs:
File 1 - example_trigger_controller_dag.py:
"""This example illustrates the use of the TriggerDagRunOperator. There are 2
entities at work in this scenario:
1. The Controller DAG - the DAG that conditionally executes the trigger
2. The Target DAG - DAG being triggered (in example_trigger_target_dag.py)

This example illustrates the following features :
1. A TriggerDagRunOperator that takes:
  a. A python callable that decides whether or not to trigger the Target DAG
  b. An optional params dict passed to the python callable to help in
     evaluating whether or not to trigger the Target DAG
  c. The id (name) of the Target DAG
  d. The python callable can add contextual info to the DagRun created by
     way of adding a Pickleable payload (e.g. dictionary of primitives). This
     state is then made available to the TargetDag
2. A Target DAG : c.f. example_trigger_target_dag.py
"""

from airflow import DAG
from airflow.operators.dagrun_operator import TriggerDagRunOperator
from datetime import datetime

import pprint

pp = pprint.PrettyPrinter(indent=4)

def conditionally_trigger(context, dag_run_obj):
    """This function decides whether or not to Trigger the remote DAG"""
    c_p = context['params']['condition_param']
    print("Controller DAG : conditionally_trigger = {}".format(c_p))
    if context['params']['condition_param']:
        dag_run_obj.payload = {'message': context['params']['message']}
        pp.pprint(dag_run_obj.payload)
        return dag_run_obj

# Define the DAG
dag = DAG(dag_id='example_trigger_controller_dag',
          default_args={"owner": "airflow",
                        "start_date": datetime.utcnow()},
          schedule_interval='@once')

# Define the single task in this controller example DAG
trigger = TriggerDagRunOperator(task_id='test_trigger_dagrun',
                                trigger_dag_id="example_trigger_target_dag",
                                python_callable=conditionally_trigger,
                                params={'condition_param': True,
                                        'message': 'Hello World'},
                                dag=dag)

File 2 - example_trigger_target_dag.py:
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator
from airflow.models import DAG
from datetime import datetime

import pprint
pp = pprint.PrettyPrinter(indent=4)

# This example illustrates the use of the TriggerDagRunOperator. There are 2
# entities at work in this scenario:
# 1. The Controller DAG - the DAG that conditionally executes the trigger
#    (in example_trigger_controller.py)
# 2. The Target DAG - DAG being triggered
#
# This example illustrates the following features :
# 1. A TriggerDagRunOperator that takes:
#   a. A python callable that decides whether or not to trigger the Target DAG
#   b. An optional params dict passed to the python callable to help in
#      evaluating whether or not to trigger the Target DAG
#   c. The id (name) of the Target DAG
#   d. The python callable can add contextual info to the DagRun created by
#      way of adding a Pickleable payload (e.g. dictionary of primitives). This
#      state is then made available to the TargetDag
# 2. A Target DAG : c.f. example_trigger_target_dag.py

args = {
    'start_date': datetime.utcnow(),
    'owner': 'airflow',
}

dag = DAG(
    dag_id='example_trigger_target_dag',
    default_args=args,
    schedule_interval=None)

def run_this_func(ds, **kwargs):
    print("Remotely received value of {} for key=message".
          format(kwargs['dag_run'].conf['message']))

run_this = PythonOperator(
    task_id='run_this',
    provide_context=True,
    python_callable=run_this_func,
    dag=dag)

# You can also access the DagRun object in templates
bash_task = BashOperator(
    task_id="bash_task",
    bash_command='echo "Here is the message: '
                 '{{ dag_run.conf["message"] if dag_run else "" }}" ',
    dag=dag)

A: Yes, this can be achieved by passing None to schedule_interval in default_args.
Check this documation on DAG run.
For example:
default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2015, 12, 1),
    'email': ['airflow@example.com'],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
    'schedule_interval': None, # Check this line
}


text:
Q: About partially polarized light and the degree of polariztion When I was taking Optics course, I found there were several questions about polarization of light. I use the textbook of Hecht.

*

*It seems that the definition of degree of polarization may be not so well-defined if $V=\frac{I_{max}-I_{min}}{I_{max}+I_{min}}$. For a elliptical polarized light, there is no natural polarized part, but still $V\neq 0$.

*I found it hard to deal with partially polarized light. First the definition. What is the definition of partially polarized light? Light with $0<V<1$?

*Is all partially polarized light can be presented by the superposition of a plane polarized light and a natural light? I suppose it is true but why? Is there any formal explanation?

*Consider a real problem. Suppose there is a beam of light incident on an air-glass interface with $n_{ti}=1.5$ at a certain degree, say $30°$. Then how to characterize the reflected light or the transmitted light since they are all partially polarized. What is $V$ for these lights? I gauss the answer may be $V=\frac{|r_p|^2-|r_s|^2}{|r_p|^2+|r_s|^2}$. But I can't convince my self why this correspondes to the definition above. (This is essentially a problem in Hecht.)
Thanks a lot! I am really confused with that.

A: Here is some possibly useful information from Goodman's "Statistical Optics."  (Sorry about the lack of symbol quality --  so much for cut/paste from a PDF)

Light from a thermal source is regarded as unpolarized if two conditions are
      met. First, we require that the intensity of the light passed by a polarization
      analyzer, situated in a plane perpendicular to the direction of propagatof the wave, be independent of the rotational orientation of the analyzer.
      Second, we require that any two orthogonal field components $u_x( P, t) $ and
      $u_y(P, t)$ have the property that $(u_x(t + T)u_t(t))$ is identically zero for all
      rotational orientations of the $X- Y$ coordinate axes and for all delays $T$.

Later, in section 4.3.3,

We define the degree of polarization of the wave as the ratio of
      the intensity of the polarized component to the total intensity,

I'd recommend reading section 4.3 in its entirety.

A:
It seems that the definition of degree of polarization may be not so well-defined if $V=\frac{I_{max}-I_{min}}{I_{max}+I_{min}}$. For a
  elliptical polarized light, there is no natural polarized part, but
  still $V\neq 0$.

This definition is used in measurements.  Elliptical polarized light can be fully polarized, i.e. $V=1$ (theoretically).  I really don't like that Hecht uses V here, as that is also used for visibility which is an interference thing (but I understand why, see below).
Specifically, we define the Stokes parameters
$$\mathbf{s} = \begin{pmatrix}s_0 \\ s_1 \\ s_2 \\ s_3\end{pmatrix}$$.
Then the degree of polarization $$\mathscr{P} = \frac{\sqrt{s_1^2 + s_2^2 + s_3^2}}{s_0}$$
Partial polarization is a statistical quantity, it is the result of taking the ensemble average over some domain of the irradiance projection through polarization elements.  This means that it is really a coherence (i.e. interference) phenomena.

I found it hard to deal with partially polarized light. First the definition. What is the definition of partially polarized light? Light
  with $0<V<1$?

This is because for a deterministic ideal, mathematical point in space-time, partial polarization doesn't exist.  Partial polarization is the statistical time average of a time or space or space-time region.  Yes, this definition implies that $0<V<1$.
This is because optical detectors only measure irradiance, not optical field.  In longer wavelength regions, antennas can capture both phase and amplitude and the polarization can be reconstructed from those parameters, but this is not the case for optical detectors.
Mathematically :
$s_0 = \langle E_x^2 + E_y^2\rangle\\
s_1 = \langle E_x^2 - E_y^2\rangle\\
s_2 = 2\langle E_xE_y\cos(\delta)\rangle\\
s_3 = 2\langle E_xE_y\sin(\delta)\rangle
$
where $E_x$ and $E_y$ are the classical electric field components in the $x$ and $y$ directions (in optics we use the $z$-axis as the direction of energy flux), both functions of $t$ of course, and
$$\langle f(t) \rangle = lim_{T \to \infty}\frac{1}{T}\int_0^T f(t) dt $$
is the time average, and $\delta$ is the phase difference between $E_x$ and $E_y$.
Open access source aren't great for this explanation, but this paper may help.

Is all partially polarized light can be presented by the superposition
  of a plane polarized light and a natural light? I suppose it is true
  but why? Is there any formal explanation?

Not a super-position of natural light and polarized light, but a super-position of purely polarized light and of completely depolarized light.  It is obvious why if we look at the definition of $\mathscr{P}$, if $\mathscr{P} = 0$, then the light is completely depolarized and $s_1 = s_2 = s_3 = 0$.
Then
$$\mathbf{s} = (1-\mathscr{P})\begin{pmatrix}s_0 \\ 0 \\ 0 \\ 0\end{pmatrix} + \mathscr{P}\begin{pmatrix}s_0 \\ s_1 \\ s_2 \\ s_3\end{pmatrix}$$
Assuming that the Stokes parameters are linear, (which follows from the linearity of optical fields in most dielectrics, air, etc.) then I'll leave it to you to verify this is correct.

Consider a real problem. Suppose there is a beam of light incident on
  an air-glass interface with $n_{ti}=1.5$ at a certain degree, say
  $30°$. Then how to characterize the reflected light or the transmitted
  light since they are all partially polarized. What is $V$ for these
  lights? I guess the answer may be
  $V=\frac{|r_p|^2-|r_s|^2}{|r_p|^2+|r_s|^2}$. But I can't convince my
  self why this corresponds to the definition above. (This is
  essentially a problem in Hecht.)

What you have written for $V$ here is called the diattenuation, not the depolarization.  This is the difference in amplitude between the the $s$ and $p$ polarizations reflected.  Remember that $s$ and $p$ are defined by the geometry and symmetries of the problem.


text:
Q: Fast Queries over subarrays Problem: Given an sorted array of integers a[N], I have to process queries of kind as follow

*

*[L R] p : find  sum of aiCp for all i=L...R

Constraints:
  N< 105
  1<=ai<=106
Suppose there are Q such queries , Then please suggest a better method to solve this problem. Some points to note are
All queries are given in advance , i.e. offline algorithm can work .
Also note that the array is sorted.
each element in the array is bounded by small number.
There are no updates to the array.
Thanks
PS: brute force approach is processing each query element by element which would give complexity: O(Q * N * (cost of n choose r) )  .


text:
Q: Install Ruby on Rails using rvm on Ubuntu 12.04 I am trying to install Ruby on Rails using rvm on ubuntu 12.04. I am following the steps given in https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm , but I am unable to install Rails successfully. When I run gem install rails, it does nothing.
Previously, by using the above link, I have successfully installed it several times. But this time, i couldn't.
Output of
gem install rails -V:
HEAD https //rubygems.org/specs.4.8.gz 302 Moved Temporarily
HEAD https //s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz
200 OK
GET https //rubygems.org/specs.4.8.gz
302 Moved Temporarily ...
GET https //rubygems.org/quick/Marshal.4.8/rack-1.4.5.gemspec.rz
302 Moved Temporarily

It always stops at this point. Need some guidance to successfully install it.

A: Step One — Install Ruby with RVM
Before we do anything else, we should run a quick update to make sure that all of the packages we download to our VPS are up to date:
sudo apt-get update

Once that's done, we can start installin
g RVM, Ruby Version Manager. This is a great program that lets you use several versions of Ruby on one server; however, in this case, we will just use it to install the latest version of Ruby on the droplet.
If you do not have curl on your system, you can start by installing it:
sudo apt-get install curl

To install RVM, open terminal and type in this command:
\curl -L https://get.rvm.io | bash -s stable

After it is done installing, load RVM. You may first need to exit out of your shell session and start up a new one.
source ~/.rvm/scripts/rvm

In order to work, RVM has some of its own dependancies that need to be installed. To automatically install them:
rvm requirements
You may need to enter your root password to allow the installation of these dependencies.
On occasion the zlib package may be reported as missing. The RVM page describes the issue and the solution in greater detail here.
Step Two — Install Ruby
Once you are using RVM, installing Ruby is easy.
rvm install ruby

The latest ruby is now installed. However, since we accessed it through a program that has a variety of Ruby versions, we need to tell the system to use the version we just installed by default.
rvm use ruby --default

Step Three — Install RubyGems
The next step makes sure that we have all the required components of Ruby on Rails. We can continue to use RVM to install gems; type this line into terminal.
rvm rubygems current

Step Four — Install Rails
Once everything is set up, it is time to install Rails. To start, open terminal and type in:
gem install rails

This process may take a while, be patient with it. Once it finishes you will have Ruby on Rails installed on your droplet.

A: i did this:
sudo apt-get install git
sudo apt-get install curl
curl -L https://get.rvm.io | bash -s stable --ruby
sudo apt-get install git-core
source ~/.rvm/scripts/rvm
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
rvm autolibs enable
rvm reload
rvm requirements
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
rvm install ruby-2.0
curl -L https://get.rvm.io | bash -s stable --rails

Hope, it helps.

A: Refer Installing rvm wih stable ruby, use this command
\curl -L https://get.rvm.io | bash -s stable --ruby

After successful installation of ruby, install rails as a gem.
gem install rails

A: The most basic Vagrant box you can find to get Rails on Ubuntu. (This uses Ubuntu 14, but you can just change the box, should work roughly the same).
https://github.com/joelgerard/rails-vagrant
Also, checkout the bootstrap.sh if you want straight forward BASH.


text:
Q: How to retrieve value on from in php? I am trying to retrieve value on php page but it's not retrieving value.
Here is my code
retrieve

<?php
include('conn.php');
$per_page = 3;
if($_GET)
{
$page=$_GET['page'];
}
$start = ($page-1)*$per_page;
$select_table = "select * from clientreg order by id limit $start,$per_page";
$variable = mysql_query($select_table);
?>
<form name="frmUser" method="post" action="">

*****

        <?php
        $i=1;
        $j=0;
        while($row = mysql_fetch_array($variable))
        {
        if($j%2==0)
$classname="evenRow";
else
$classname="oddRow";?>
         <tr class="<?php echo $classname;?>">
<input type="checkbox" name="users[]" value="<?php echo $row["id"]; ?>" >

        <?php
        $j++;}
        ?>

<input type="button" name="update" id="onclick" value="Update" /> <input type="button" name="delete" value="Delete"  onClick="setDeleteAction();" />
<input type="button" name="assign" id="assign" value="Assign" onClick="setLeadAssignAction();" />

<?php
$sql = mysql_query("SELECT *FROM login where  role=1");
while ($row = mysql_fetch_array($sql)){

?>

<input type="checkbox" name="eid[]" value="<?php echo $row["eid"]; ?>" ><?php echo $row["username"]; ?>

<?php
}
?>

</form>

<form class="form" method ="Post"action="" id="contact">
<?php
if(isset($_POST["submit"]) && $_POST["submit"]!="") {
$rowCount = count($_POST["users"]);
for($i=0;$i<$rowCount;$i++) {

$result = mysql_query("SELECT * FROM clientreg WHERE Id='" . $_POST["users"][$i] . "'");
$row[$i]= mysql_fetch_array($result);
echo "shakti";
  echo $row[$i]['id'];
  }
   }
?>

                Lead Owner: *

                <input type="text" name="leadowner[]" id="lead" placeholder="Lead Owner"value=""/>

                First Name: *

                <input type="text" name="fname"id="fname" placeholder="Fname"/>

                Last Name: *

                <input type="text" name="lname" id="lname" placeholder="Lname"/>

                Mobile No: *

                <input type="text" name="mobile"id="mobile" placeholder="Mobile"/>

                Email Id: *

                <input type="text"name="email" id="email" placeholder="Email"/>

            <input type="submit"  name="submit" value="Submit">
            </form>

Where am I wrong in this code?
Please sort out my problem
My problem is here
 if(isset($_POST["submit"]) && $_POST["submit"]!="") {
    $rowCount = count($_POST["users"]);

Any help will be appreciated
I have updated my code and added submit button.

A: You have two forms. Only the second form has a submit.
Form 1:
<form name="frmUser" method="post" action="">
<input type="checkbox" name="users[]" value="<?php echo $row["id"]; ?> ">
</form>

Form 2:
<form class="form" method ="Post"action="" id="contact">
<input type="submit"  name="submit" value="Submit">
</form>

The if construct does not receive the $_POST["users"], because it receives only the POST of the second submitted form.
$rowCount = count($_POST["users"]);

$rowCount will always be 0.
Form 2:
...
<?php
$rowCount = 0;
if ($_POST["users"] != "") {
     $rowCount = count($_POST["users"]);
} else if ($_POST["rowcount"] != "") {
     $rowCount = $_POST["rowcount"];
}
?>
...
<form class="form" method ="Post"action="" id="contact">
...
<input type="submit"  name="submit" value="Submit">
<input type="hidden"  name="rowcount" value="<?php echo $rowCount; ?>">
</form>

Then the variable $rowCount will contain the count of the rows after the submit of any of the 2 forms.


text:
Q: Стилизация вкладок в guake Пользую альтернативу терминалу guake, доволен. Но, как всегда хочется большего. Если есть информация о том существует ли такая возможность в guake, для разных вкладок использовать разное оформление и сохранять состояние вкладок после выключения, дайте знать
Спасибо


text:
Q: Alamofire public key pinning not validating other url I have a 3 baseURL these 3 are having different ssl certificate, I have downloaded one certificate and hardcoded in Xcode project even if I change the url request the app not blocks the request.
I am using this class
class APIManager {

    static let sharedInstance = APIManager()
    private var manager : SessionManager?
    func sessionManager() -> SessionManager {

        if let manage = self.manager {
            return manage
        }
        else {
            let serverTrustpolicies: [ String: ServerTrustPolicy] = ["url" : .pinPublicKeys(publicKeys: ServerTrustPolicy.publicKeys(), validateCertificateChain: true, validateHost: true)
            ]

            self.manager = SessionManager(
                serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustpolicies)
            )
            let configuration = URLSessionConfiguration.default
            configuration.timeoutIntervalForRequest = 30
            self.manager = SessionManager(configuration: configuration)
            return self.manager!
        }

    }
}

APIManager.sharedInstance.sessionManager().upload(multipartFormData: { (multipartFormData)
}

Can anyone explain to implement ?

A: You must explicitly set ServerTrustPolicy values for every host you want to validate. So when you create your policies dictionary, you need to pass every host.
let serverTrustPolicies: [String: ServerTrustPolicy] = ["url" : .pinPublicKeys(publicKeys: ServerTrustPolicy.publicKeys(), validateCertificateChain: true, validateHost: true)]

This should have your other base URLs added, with the appropriate policy set.


text:
Q: sprintf formats not as expected I've got a problem with rounding using sprintf. I get passed '%0.0f' as the format. sprintf rounds not as expected: 0.5 should be rounded to 1, instead it rounds to 0, which is against the general rounding rule, whereas 1.5, 2.5 etc. is being rounded correctly:
sprintf('%0.0f', 0.5)
=> "0"

sprintf('%0.0f', 1.5)
=> "2"

Why is this so and how can I achieve my expected behaviour?

A: sprintf performs banker's rounding, which rounds 0.5 to the nearest even number. This method is often used by statisticians, as it doesn't artificially inflate averages like half-up rounding.
The Float#round method (in Ruby 2.4+) accepts a parameter which can be one of:

*

*half: :up (the default)

*half: :down

*half: :even (banker's rounding)

Apparently you are expecting round's default, so you can just do a .round to your number before printing.

A:
how can I achieve my expected behaviour?

Round the float before you give it to sprintf:
2.4.0 :001 > sprintf('%0.0f', 0.5.round)
 => "1"

2.4.0 :002 > sprintf('%0.0f', 1.5.round)
 => "2"

A: This is expected behavior for printf. The default rounding mode is to round to the nearest valid value, and in case of a tie to pick the even number. Since 0.5 is treated as being in exactly the middle of 0 and 1, it tends to 0 because it is the even number.


text:
Q: Setting width relatively to the size of the grandparent div I have the structure that currently looks approximately like the snippet below; how can I make div2 to take the width 50% of its grandparent div, rather than 50% of its immediate parent?

    div1

    parent

      div2

A: We can do some maths. The width of the parent is P - 100px and you need to have P/2 so if you do X/2 + 50px where X = P - 100px you will have P/2. Also better use flex-grow:1 instead of width:100% to avoid the shrink effect and have the first div always at 100px

console.log($('#div2').width())
console.log($('#grandParent').width())

    div1

    parent

      div2

You can consider the use of CSS variable to make this easier:

console.log($('#div2').width())
console.log($('#grandParent').width())
:root {
 --w:100px;
}

    div1

    parent

      div2


text:
Q: $F : \mathbb{Z} \to \mathbb{Z}$, $F(n) = 2 -3n$. Is $F$ one-to-one? Onto?
Define $F : \mathbb{Z} \to \mathbb{Z}$ by the rule $F(n) = 2 -3n$, for all $n \in \mathbb{Z}$. Is $F$ one-to-one? Onto?

Now, I understand that one-to-one means that nothing in the co-domain is being pointed to twice.  I also understand onto; which means that every point in the codomain is being pointed to by a point in the domain.  Beyond that, I am unsure of where to start here, in terms of proving or disproving them.

A: Hints:

*

*Suppose $F(m) = F(n)$, that is $2-3m = 2-3n$; what can you say about the relationship between $m$ and $n$?

*Let $k \in \mathbb{Z}$. Can you solve $f(n) = k$? First solve the equation $2 - 3n = k$ for $n$, then check to see whether or not $n \in \mathbb{Z}$.


text:
Q: Find consecutive sequence and suggest next number in sequence I'm trying to create a procedure that will:

*

*take any number as an input e.g. 102

*find the sequence range it belongs e.g. 100 to 103

*return a suggested next number to the user e.g. 104
The table itself will look something like this:

Num

100

101

102

103

110

111

112

113

114

115

120

121

Ideally the output of the query would return something like this:

start
end
nextNr

100
103
104

110
115
116

120
121
122

I this what I'm trying to do is linked to some kind of Gap and Island technique.
I had a look at trying something from here but couldn't quite get it to work.
Gaps and Islands Link
This is what I tried coming up with...
WITH cteSource(ID, Seq, Num)
AS(
    SELECT d.ID, f.Seq, f.Num
    FROM (
        SELECT
            ID,
            ROW_NUMBER() OVER (PARTITION BY ID ORDER BY MIN(SeqNo)) AS Grp,
            MIN(SeqNo) AS StartSeqNo,
            MAX(SeqNo) AS EndSeqNo
        FROM
            (
            SELECT 1 ID, Num SeqNo,
               Num - ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY Num) AS RN
            FROM
            Number
            ) AS a
        GROUP BY ID, RN
        ) d
    CROSS APPLY (
            VALUES (d.Grp, d.EndSeqNo + 1),(d.Grp -1, d.StartSeqNo -1)
            ) AS f(Seq, Num)
)
SELECT ID, MIN(Num) AS StartSeqNo, MAX(Num) AS EndSeqNo, MAX(Num) + 1 as NextNr
FROM cteSource
GROUP BY ID, Seq
HAVING COUNT(*) = 2

The result looks like this:

StartSeqNo
EndSeqNo
NextNr

104
109
110

116
119
120

Here's the setup:
CREATE TABLE [dbo].[Number](
    [Num] [int] NULL
)
GO

INSERT INTO Number
(Num)
VALUES
(100),
(101),
(102),
(103),
(110),
(111),
(112),
(113),
(114),
(115),
(120),
(121)

A: Perhaps this will help.
Select [Start]  = min(num)
      ,[End]    = max(num)
      ,[NextNr] = max(num) + 1
 From (
        Select *
              ,Grp = num - row_number() over (order by num)
         From  number
      ) A
 Group By Grp

Results
Start   End     NextNr
100     103     104
110     115     116
120     121     122

A: Your first subquery works fine to get groups and start and end number:
  SELECT
            ROW_NUMBER() OVER (PARTITION BY ID ORDER BY MIN(SeqNo)) AS Grp,
            MIN(SeqNo) AS StartSeqNo,
            MAX(SeqNo) AS EndSeqNo
        FROM
            (
            SELECT 1 ID, Num SeqNo,
               Num - ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY Num) AS RN
            FROM
            Number
            ) AS a
        GROUP BY ID, RN

You just then needlessly complicated it instead of just using EndSeqNo + 1 for NextNr:
WITH CTE_Groups AS
(
        SELECT
            ROW_NUMBER() OVER (PARTITION BY ID ORDER BY MIN(SeqNo)) AS Grp,
            MIN(SeqNo) AS StartSeqNo,
            MAX(SeqNo) AS EndSeqNo
        FROM
            (
            SELECT 1 ID, Num SeqNo,
               Num - ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY Num) AS RN
            FROM
            Number
            ) AS a
        GROUP BY ID, RN
)
SELECT *, EndSeqNo + 1 AS NextNr
FROM
CTE_Groups

EDIT: and with further removing unnecessary partitons and extra columns
WITH CTE_Groups AS
(
        SELECT
            MIN(SeqNo) AS StartSeqNo,
            MAX(SeqNo) AS EndSeqNo
        FROM
            (
            SELECT  Num SeqNo,
               Num - ROW_NUMBER() OVER (ORDER BY Num) AS RN
            FROM
            Number
            ) AS a
        GROUP BY RN
)
SELECT *, EndSeqNo + 1 AS NextNr
FROM
CTE_Groups


text:
Q: fix error 404 with practice basic spring-mvc-app I study Java and  use the tutorial and ran into a problem "error 404 " with description : "The origin server did not find a current representation for the target resource or is not willing to disclose that one exists." making "hello world" with web.xml, pom.xml, applicationContextMVC.xml, jsp-file and contoller(java class) + html file(view). It's elementary programm.
To solve the problem I used the Internet, some chats with java guru, but it didn't do any good :(
My app use spring-webmvc, spring-web, spring-context, spring-core <- 6.0.5 version also maven(ide) and tomcat 9.0.73 ; java 17
Some screens: click
My suspicions of Tomcat or maven-war-plugin...
I'd appreciate any help

A: Problem solvded!
Because i use Thymeleaf version 3.1.1 and and i wrote in pom.xml version for  spring-core, spring-context,spring-wrv,spring-webmvc version 6.0.5.
Solving is replacing 6.0.6 to 5.3.24 in pom.xml


text:
Q: Upper part of a view with rounded corners while on top of an ImageView Android-Java
All I want to know is how to achieve the highlighted part in the image whereas the upper part of a view has rounded corners while on top of another View where that view acts as the background, I've tried following Material Design's guidelines as to how use shapes or looking around the internet for something similar, yet came up with nothing.
XML FILE
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/background_light"
    android:theme="@style/gymTheme"
    android:fitsSystemWindows="true"
    >

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/main.appbar"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:fitsSystemWindows="true"
        >
    <com.google.android.material.appbar.CollapsingToolbarLayout
        android:id="@+id/main.collapsing"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginStart="48dp"
        app:expandedTitleMarginEnd="64dp"
        >

        <ImageView
            android:id="@+id/backdrop"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:fitsSystemWindows="true"
            android:src="@drawable/aagym"
            app:layout_collapseMode="parallax"
            />

        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/main.toolbar"
            android:layout_width="match_parent"
            app:title="@string/search_hint"
            android:layout_height="?attr/actionBarSize"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:layout_collapseMode="pin"
            />
    </com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>

<androidx.core.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <fragment
        android:id="@+id/nav_host_fragment"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:defaultNavHost="true"
        app:navGraph="@navigation/specific" />

</androidx.core.widget.NestedScrollView>

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_margin="10dp"
    android:src="@drawable/ic_baseline_favorite_border_24"
    app:layout_anchor="@id/main.appbar"
    app:layout_anchorGravity="bottom|right|end"
    />

<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"

    android:layout_marginBottom="10dp"
    app:menu="@menu/gym_details_menu"
    app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"
    />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

This is how my Layout looks like

A: Why are you using fragment inside nested scrolled view? You can replace it with a custom view or include a view.
To achieve this you need to put a shape drawable with rounded corners, then add it as background in the first parent view of the nested fragment of yours. Finally, add some margin-top to the nested scroll view so you can hide the empty spaces from the rounded corners. Keep in mind that your parent's view must not have a background color just the child under the shape.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/colorAccent" />
    <corners
        android:bottomLeftRadius="0dp"
        android:bottomRightRadius="0dp"
        android:topLeftRadius="40dp"
        android:topRightRadius="40dp" />
</shape>


text:
Q: Can't get port handle from LPT1 I'm writing a program which reads from file and send to printer to print.
I set "HP Laser Jet 4" as default printer and checked "LPT1" in printer properties of "HP Laser Jet 4". Print spooler is also running (Windows 7).
The problem is hPort always returns INVALID_HANDLE_VALUE.
I don't have a real printer. Is it a problem?
#include "stdafx.h"
#include <windows.h>

int main()
{
    HANDLE hPort = CreateFile(_T("LPT1:"), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    if(hPort != INVALID_HANDLE_VALUE) {
        printf("success");
    } else {
        printf("%i", GetLastError());
    }
    return 0;
}

A: Why you try for open LPT port. This is realy need for you?
If printer (e.g. HP Laser Jet 4 or any other) installed in OS and you want to write to it directly without using printer driver, you can write data (from file, for example) as showed bellow:
TCHAR *pPrinterName = TEXT("HP Laser Jet 4");
TCHAR *pFileName = TEXT("c:\filename.prn");
HANDLE hPrinter = NULL;
DOC_INFO_1 docinfo;
FILE *pfile = NULL;
DWORD dwBytesWritten = 0L;
BYTE data[1024];
DWORD dwCount = 0L;

if (OpenPrinter(pPrinterName, &hPrinter, NULL))
{
  docinfo.pDocName = TEXT("RAW Output Document Name");
  docinfo.pOutputFile = NULL;
  docinfo.pDatatype = TEXT("RAW");

  DWORD dwPrtJob = StartDocPrinter(hPrinter, 1, (LPBYTE)&docinfo);

  if (dwPrtJob > 0)
  {
    if (0 == _tfopen_s(&pfile, pFileName, TEXT("rb")))
    {
      while (!feof(pfile))
      {
        dwCount = (DWORD)fread(&data, 1, 1024, pfile);
        WritePrinter(hPrinter, &data, dwCount, &dwBytesWritten);
      }
      fclose(pfile);
    }
  }
  EndDocPrinter(hPrinter);
  ClosePrinter(hPrinter);
}

May be, this code has some errors. I am do not test it. I am simply cut it from one my old project.
In same manner you can send file (that contains printer commands - PCL/PJL for HP PCL5/PCL6 printers, for example) to any printer/port.

A:
The problem is hPort always returns INVALID_HANDLE_VALUE.
I don't have a real printer. Is it a problem?

This is a problem, if you do not have a real LPT1 (LPT2...) ports, but not a printer device or printer driver installed.
Check in device manager or PC-hardware, if LPT1 port is really present.
For really presented LPT1 port, you code must return "success"
If LPT1 does not really presented in you PC you code ( GetLastError() ) must return 2 ( ERROR_FILE_NOT_FOUND ).


text:
Q: Android, dynamic (tab)fragments with parameters from resource file? I have built something similar to the FragmentTabHost that shows/hides/... a list of fragments. For now the layout of the host including the tab fragments were defined in a xml layout. Now I want to decouple the host from the hosted fragments. Creating and adding the fragments dynamically is not the real problem. But I don't see a nice way to store the parameters for the fragments in android resource files.

a) How can I keep a list of tabs in a resource file to fill the tabHost with? I am thinking about an array of Strings containing the tab fragments class names. (Class.forName()..., new instance() ...). But this can't be the best idea?

b) How can I keep parameters for the tab fragments as convenient as with a normal layout file? I need a tab title and some fragments are actually containers and need to know which sublayouts they should use. So I have stylable attributes as well.

I hope I am overlooking something because at the moment I don't see any way to keep that data conveniently in a single resource file.


text:
Q: How to Generate JHipster Entities with @Version Annotation? I need JHipster to generate entities with @Version annotation through JDL studio.
So far, I could find this link but only with suggestions.
Is there a directive to generate Entities with @Version whether in AbstractAuditingEntity or in each entity?


text:
Q: Why does Vertx throws a warning even with blocking attribute? I have a Quarkus application where I use the event bus.
the code in question looks like this:
    @ConsumeEvent(value = "execution-request", blocking = true)
    @Transactional
    @TransactionConfiguration(timeout = 3600)
    public void consume(final Message<ExecutionRequest> msg) {
        try {
            execute(...);
        } catch (final Exception e) {
            // some logging
        }
    }

    private void execute(...)
            throws InterruptedException {
        // it actually runs a long running task, but for
        // this example this has the same effect
        Thread.sleep(65000);
    }

Why do I still get a
WARN  [io.ver.cor.imp.BlockedThreadChecker] (vertx-blocked-thread-checker) Thread Thread[vert.x-worker-thread-0,5,main] has been blocked for 63066 ms, time limit is 60000 ms: io.vertx.core.VertxException: Thread blocked

I'm I doing something wrong? Is the blocking parameter at the ConsumeEvent annotation not enough to let that handle in a separate Worker?

A: Your annotation is working as designed; the method is running in a worker thread. You can tell by both the name of the thread "vert.x-worker-thread-0", and by the 60 second timeout before the warnings were logged. The eventloop thread only has a 3 second timeout, I believe.
The default Vert.x worker thread pool is not designed for "very" long running blocking code, as stated in their docs:

Warning:
Blocking code should block for a reasonable amount of time (i.e no more than a few seconds). Long blocking operations or polling operations (i.e a thread that spin in a loop polling events in a blocking fashion) are precluded. When the blocking operation lasts more than the 10 seconds, a message will be printed on the console by the blocked thread checker. Long blocking operations should use a dedicated thread managed by the application, which can interact with verticles using the event-bus or runOnContext

That message mentions blocking for more than 10 seconds triggers a warning, but I think that's a typo; the default is actually 60.
To avoid the warning, you'll need to create a dedicated WorkerExecutor (via vertx.createSharedWorkerExecutor) configured with a very high maxExcecuteTime. However, it does not appear you can tell the @ConsumeEvent annotation to use it instead of the default worker pool, so you'd need to manually create an event bus consumer, as well, or use a regular @ConsumeEvent annotation, but call workerExectur.executeBlocking inside of it.


text:
Q: Dropdown Menu Disappearing I'm having trouble getting my dropdown menu to stay visible. When I mouse over to the menu, the submenu tabs will show up and stay there for a second but then go away. This seems to be a common problem, but I'm not sure what I need to change in my code, nor what html I'd even need to post here to get the problem fixed.
Could anyone look at my site and tell me what is wrong? http://www.studywithstyleblog.com
I'd really appreciate it!
Thanks

A: Now define your #menus li ul{top:100%;}
as like this
#menus li ul{top:100%;}

A: you just need to Add "Top:0px;" in "#menus li ul" CSS
Updated CSS

#menus li ul {
 z-index: 9999;
 position: absolute;
 left: -999em;
 height: auto;
 width: 175px;
 top: 0px;
 margin: 0;
 padding: 0;
}


text:
Q: Inset shadow on non-square-objects in Chrome I'm trying to create a webpage with some tabs and I want the tabs that are not selected to "lie behind" the active tab. I've got different tabs with different appearances, one is plain square but the other is a trapezoid.
I've managed to create the shadow effect on the square tab by using
"-webkit-box-shadow: inset 0 -10px 30px -10px #555;"

but that doesn't work for the trapezoid.
This is a simplified example of my code:
HTML

CSS
#first-tab {
    position:relative;
    float: left;
    background-color: #ED3627;
    -webkit-box-shadow: inset 0 -10px 30px -10px #555;
    width: 100px;
    height: 70px;
}

#second-tab {
    position:relative;
    float: left;
    margin-left: 50px;
    border-bottom: 70px solid #365F91;
    border-right: 40px solid transparent;
    height: 0;
    width: 60px;
    -webkit-box-shadow: inset 0 -10px 30px -10px #555; /* Doesn't work */
}

#main-content {
    clear:both;
    position:relative;
    float: left;
    height: 100px;
    width: 250px;
    background-color: #365F91;
}

JSFiddle: http://jsfiddle.net/Nx9ex/
Does anyone have any suggestions how I can fix this?
It only has to work for Chrome!
Thanks!

A: Not perfect, but can be a start:
demo
It didn't work because the second tab had really a height of 0px, and was in top of the trapezoid, the visible portion being the border.
I changed the method of creating a trapezoid, now it has all the space and the corner is hide setting there a transparent background:
#second-tab {
    position:relative;
    float: left;
    margin-left: 50px;
    background: linear-gradient(-114deg, transparent 30px, #365F91 31px);
    height: 70px;
    width: 100px;
    -webkit-box-shadow: inset 0 -10px 30px -10px #555; /* Doesn't work */
}

The remaing problem is that the shadow is slightly visible in the transparent border


text:
Q: nginx url rewrite with string substitution I need to catch if my urls contain a small substr, keep the url as it is and rewrite only that small part, how can I accomplish this?
For example:
http://foobar.com/foo-bar-substrtocatch-baz

should become
http://foobar.com/foo-bar-changedsubstr-baz

Thanks in advance...

A: rewrite    ^(.*)substrtocatch(.*)$    $1changedsubstr$2;


text:
Q: Android : Support MapFragment Returns null I have updated the android SDK to 5.0 and my previous project is not working on it(which worked correctly in 4.4.2).
I have an class which extends fragment
public class MapFragment extends Fragment{
//
}

In this class i have inflated a layout with google support mapfragment
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/map_tile_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="visible" >

    <RelativeLayout
        android:id="@+id/full_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <fragment
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            class="com.google.android.gms.maps.SupportMapFragment" />

        <Textview
            <!-- dfh
            fgh -->
        />

    </RelativeLayout>

</RelativeLayout>

When i do this in my code it return null
    SupportMapFragment fragment = (SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map);

This same line worked for me in Android4.4.2 but after updation there is some problem...
Do anyone found the solution...

A: I've found the answer and it works for me
Instead of this
 SupportMapFragment fragment = (SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map);

I've changed as
SupportMapFragment  fragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);


text:
Q: Converting SQL Result Sets to XML I am looking for a tool that can serialize and/or transform SQL Result Sets into XML. Getting dumbed down XML generation from SQL result sets is simple and trivial, but that's not what I need.
The solution has to be database neutral, and accepts only regular SQL query results (no db xml support used). A particular challenge of this tool is to provide nested XML matching any schema from row based results. Intermediate steps are too slow and wasteful - this needs to happen in one single step; no RS->object->XML, preferably no RS->XML->XSLT->XML. It must support streaming due to large result sets, big XML.
Anything out there for this?

A: Not that I know of.  I would just roll my own.  It's not that hard to do, maybe something like this:
#!/usr/bin/env jruby

import java.sql.DriverManager

# TODO  some magic to load the driver
conn = DriverManager.getConnection(ARGV[0], ARGV[1], ARGV[2])
res = conn.executeQuery ARGV[3]

puts "<result>"
meta = res.meta_data
while res.next
  puts "<row>"

  for n in 1..meta.column_count
    column = meta.getColumnName n
    puts "<#{column}>#{res.getString(n)}</#{column}"
  end

  puts "</row>"
end
puts "</result>"

Disclaimer: I just made all of that up, I'm not even bothering to pretend that it works.  :-)

A: In .NET you can fill a dataset from any source and then it can write that out to disk for you as XML with or without the schema. I can't say what performance for large sets would be like. Simple :)

A: With SQL Server you really should consider using the FOR XML construct in the query.
If you're using .Net, just use a DataAdapter to fill a dataset.  Once it's in a dataset, just use its .WriteXML() method.  That breaks your DB->object->XML rule, but it's really how things are done.  You might be able to work something out with a datareader, but I doubt it.

A: Another option, depending on how many schemas you need to output, and/or how dynamic this solution is supposed to be, would be to actually write the XML directly from the SQL statement, as in the following simple example...
SELECT
    '<Record>' ||
        '<name>' || name || '</name>' ||
        '<address>' || address || '</address>' ||
    '</Record>'
FROM
    contacts

You would have to prepend and append the document element, but I think this example is easy enough to understand.

A: dbunit (www.dbunit.org) does go from sql to xml and vice versa; you might be able to modify it more for your needs.

A: Technically, converting a result set to an XML file is straight forward and doesn't need any tool unless you have a requirement to convert the data structure to fit specific export schema. In general the result set gets the top-level element of an XML file, then you produce a number of record elements containing attributes, which effectively are the fields of a record.
When it comes to Java, for example, you just need appropriate JDBC driver for interfacing with DBMS of your choice addressing the database independency requirement (usually provided by a DBMS vendor), and a few lines of code to read a result set and print out an XML string per record, per field. Not a difficult task for an average Java developer in my opinion.
Anyway, the more concrete purpose you state the more concrete answer you get.

A: In Java, you may just fill an object with the xml data (like an entity bean) and then use XMLEncoder to get it to xml. From there you may use XSLT for further conversion or XMLDecoder to bring it back to an object.
Greetz, GHad
PS: See http://ghads.wordpress.com/2008/09/16/java-to-xml-to-java/ for an example for the Object to XML part... From DB to Object multiple more way are possible: JDBC, Groovy DataSets or GORM. Apache Common Beans may help to fill up JavaBeans via Reflection-like methods.

A: I created a solution to this problem by using the equivalent of a mail merge using the resultset as the source, and a template through which it was merged to produce the desired XML.
The template was standard XML, with a Header element, a Footer element and a Body element.  Using a CDATA block in the Body element allowed me to include a complete XML structure that acted as the template for each row.  In order to include a fields from the resultset in the template, I used markers that looked like this <[FieldName]>.  The template was then pre-parsed to isolate the markers such that in operation, the template requests each of the fields from the resultset as the Body is being produced.
The Header and Footer elements are output only once at the beginning and end of the output set.  The body could be any XML or text structure desired.  In your case, it sounds like you might have several templates, one for each of your desired schemas.
All of the above was encapsulated in a Template class, such that after loading the Template, I merely called merge() on the template passing the resultset in as a parameter.


text:
Q: MVVM Light - communicating an items selection to the ViewModelSeletor The latest MVVM Light toolkit uses IoC in the ViewModelLocator (VML) to serve up instances of ViewModels.
Those instances are served from Read Only instance properties (i.e Not Static)
The samples show a MainViewModel exposed from the VML but not Parent View Child View
My Main View is looking at a List of Persons exposed by MainViewModel.
When one of the Person items is tapped in the Main View I want to navigate to PersonView. That PersonView would be bound to a PersonViewModel.
Would PersonViewModel be exposed from VML? If so what would the MainViewModel do to communicate the tapping of PersonViewModel? It cannot set the PersonViewModel in VML as that propery is only a Get.
I have used MVVM Light in the past and used Ready Write properties on the VML

A: This is a the exact situation where one would use the MVVM Light Messenger Class. You would first register your Person View with the VML, much like your MainView is linked up
Add this to your ViewModelLocator Constructor:
SimpleIoc.Default.Register<PersonViewModel>();

Add this outside the constructor (use snippet mvvmlocatorproperty):
    /// <summary>
    /// Gets the PersonView property.
    /// </summary>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
        "CA1822:MarkMembersAsStatic",
        Justification = "This non-static member is needed for data binding purposes.")]
    public PersonViewModel PersonView
    {
        get
        {
            return ServiceLocator.Current.GetInstance<PersonViewModel>();
        }
    }

And make sure your View is hooked up like so:
<Window x:Class="MvvmLight1.PersonView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ignore="http://www.ignore.com"
    mc:Ignorable="d ignore"
    DataContext="{Binding PersonView, Source={StaticResource Locator}}">

Now, hook up an Event to Command on your ListBox ItemTemplate
  <i:Interaction.Triggers>
       <i:EventTrigger EventName="PreviewMouseUp">
            <cmd:EventToCommand Command="{Binding OpenPersonCommand}"/>
       </i:EventTrigger>
  </i:Interaction.Triggers>

Make sure to include these two namespaces in your XAML window decleration:
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"

Now you are all hooked up to use the Locator.
As far as messaging, to open a new View you create a Message.  Below is my view model, and I will explain after
public class MainViewModel : ViewModelBase
{
    /// <summary>
    /// Initializes a new instance of the MainViewModel class.
    /// </summary>
    public MainViewModel()
    {
        OpenPersonCommand = new RelayCommand(() =>
            {
                Messenger.Default.Send<Person>(new Person() { FirstName = "Daryl" }, "OPENPERSONVIEW");
            });
    }

    /// GOT THIS USING mvvminpc snippet
    /// <summary>
    /// The <see cref="OpenPersonCommand" /> property's name.
    /// </summary>
    public const string OpenPersonCommandPropertyName = "OpenPersonCommand";

    private ICommand _openPersonCommand;

    /// <summary>
    /// Sets and gets the OpenPersonCommand property.
    /// Changes to that property's value raise the PropertyChanged event.
    /// </summary>
    public ICommand OpenPersonCommand
    {
        get
        {
            return _openPersonCommand;
        }

        set
        {
            if (_openPersonCommand == value)
            {
                return;
            }

            RaisePropertyChanging(OpenPersonCommandPropertyName);
            _openPersonCommand = value;
            RaisePropertyChanged(OpenPersonCommandPropertyName);
        }
    }
}

}
Make sure to include GalaSoft.MvvmLight.Command, GalaSoft.MvvmLight.Messaging to get this to work.  What you are doing is sending a message to anyone who recieves that type of message (in this case a Person object), with that exact token (in this case my token is a string "OPENPERSONVIEW", the second paramater.  I usually use Enumerators, but this will work for simplicity sake).
Now, in the code behind of MainView.xaml, add this in the constructor:
 Messenger.Default.Register<Person>(this, "OPENPERSONVIEW", (myPerson) =>
        {
            PersonView view = new PersonView();
            view.ShowDialog();
            Messenger.Default.Send<Person>(myPerson, "PASSVARIABLE");
        });

What we have done is we have registered to recieve any message that is passed with a Person object, and has a token of "OPENPERSONVIEW".  Once we receive that message in the Code Behind, we are instantiating a new PersonView.  Once that person view is instantiated, we are sending another message with our Person Object, that will only be received by Messenger listeners that are listening for the token "PASSVARIABLE".
Now to get the actual value from Main view model into your person view model you will use another messenger to recieve the message sent with token "PASSVARIABLE".  In your constructor for your PersonViewModel, add this:
 Messenger.Default.Register<Person>(this, "PASSVARIABLE", (myPerson) =>
            {
                ThisPerson = myPerson;
            });

And make sure to have a property called ThisPerson like such in the View Model (created using mvvminpc snippet from MVVM Light):
 /// <summary>
    /// The <see cref="ThisPerson" /> property's name.
    /// </summary>
    public const string ThisPersonPropertyName = "ThisPerson";

    private Person _thisPerson;

    /// <summary>
    /// Sets and gets the ThisPerson property.
    /// Changes to that property's value raise the PropertyChanged event.
    /// </summary>
    public Person ThisPerson
    {
        get
        {
            return _thisPerson;
        }

        set
        {
            if (_thisPerson == value)
            {
                return;
            }

            RaisePropertyChanging(ThisPersonPropertyName);
            _thisPerson = value;
            RaisePropertyChanged(ThisPersonPropertyName);
        }
    }

Basically, what we have done is used the MVVM Light Messenger class to pass around data, but it is all loosely coupled.  None of the Registered Messegers care what is passed to them, or from whom, they are just listening for their Token, and doing what is asked of them.
I know this is long, but please comment and I will go through step by step where you run into problems.  I just found a lot of answers to MVVM Light questions would tell one little part, but not the whole picture.
There are other ways to do this also, but this is the basic MVVM-Light out of box way.


text:
Q: two interfaces, multiple inheritance combine into one container? I stumbled upon the following problem: I have two packages A and B working fine for each own. Each has its own interface and his own implementation. Now i made a package C combining a adapter of A with a concrete Implemenation of B. C actually only implements the Interface of A and is only inheritating and using the Interface of B internally for now. Most of the times that was enough to have only access to the Interface A from a Container, but now i need the methods from B accessible too. Here is the simple example:
//----Package A----
class IA
{virtual void foo() = 0;};
// I cant add simply bar() here, it would make totally no sense here...

class A : public IA
{virtual void foo() {doBasicWork();} };

//----Package B----
class IB
{virtual void bar() = 0;};

class B1 : public IB
{
    //Some special implementation
    virtual void bar() {}
};

class B2 : public IB
{
    //Some special implementation
    virtual void bar() {}
};
// + several additional B classes  , with each a different implementation of bar()

//---- Mixed Classes
class AB1 : public B1, public A
{
void foo() {A::foo(); B1::bar();}
};

class AB2 : public B2, public A
{
void foo() {A::foo(); B2::bar();}
};

// One Container to rule them all:
std::vector<IA*> aVec;
AB1 obj1;
AB2 obj2;

int main(){
    iAvector.push_back(&obj1);
    iAvector.push_back(&obj2);
    for (std::vector<IA>::iterator it = aVec.begin(); it != aVec.end(); it++)
    {
        it->for(); // That one is okay, works fine so far, but i want also :
//      it->bar(); // This one is not accessible because the interface IA
                           // doesnt know it.
    }
    return 0;
}

/* I thought about this solution: to inherit from IAB instead of A for the mixed
   classes, but it doesnt compile,
stating "the following virtual functions are pure within AB1: virtual void IB::bar()"
which is inherited through B1 though, and i cant figure out where to add the virtual
inheritence. Example:

class IAB : public A, public IB
{
//  virtual void foo () = 0; // I actually dont need them to be declared here again,
//  virtual void bar () = 0; // do i?

};

class AB1 : public B1, public IAB
{
    void foo() {A::foo(); B1::bar();}
};
*/

The question is, how to achieve a combination of both Packages A and B, so that both Interfaces are accessible from one Container, while all the implementation details from A and B still get inherited?

A: The obvious solution is to create a combined interface:
class IAB : public virtual IA, public virtual IB
{
};

, have your AB1 and AB2 derive from it (in addition to their
current derivations), and keep IAB* in the vector.
This means that B1 and B2 must also derive virtually from
IB; given the direction things seem to be going, A should
probably also derive virtually from IA.
There are strong arguments that inheritance of an interface
should always be virtual.  Without going that far: if a class is
designed to be derived from, and it has bases, those bases
should be virtual (and arguably, if a class is not designed to
be derived from, you shouldn't derive from it).  In your case,
you're using the classic mixin technique, and generally, the
simplest solution is for all inheritance in a mixin to be
virtual.


text:
Q: Where to put X11 drivers configuration in Ubuntu Lucid? Since hal is removed from Lucid, where now can I put all those little configuration tweaks for mouse and other input devices?
In particular, I want to configure ThinkPad trackpad to enable scrolling with middle button. In hal, it was done with
<match key="info.product" string="TPPS/2 IBM TrackPoint">
    <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
    <merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
    <merge key="input.x11_options.ZAxisMapping" type="string">4 5</merge>
    <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
    <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
    <merge key="input.x11_options.EmulateWheelTimeout" type="string">200</merge>
</match>

A: I've managed to find the right place. It's /usr/lib/X11/xorg.conf.d/. There's already some configuration files that can be used as examples but surprisingly man xorg.conf have good enough documentation about all new Match keywords.
The example from the post can be translated to the following snippet (in a file /usr/lib/X11/xorg.conf.d/20-trackpoint.conf)
Section "InputClass"
    Identifier      "Trackpoint"
    MatchProduct    "TPPS/2 IBM TrackPoint"
    MatchDevicePath "/dev/input/event*"
    Option          "EmulateWheel" "true"
    Option          "EmulateWheelButton" "2"
    Option          "ZAxisMapping" "4 5"
    Option          "XAxisMapping" "6 7"
    Option          "Emulate3Buttons"   "true"
    Option          "EmulateWheelTimeout" "200"
    Option
EndSection

Note: for Ubuntu 10.10 you should place your config files in /usr/share/X11/xorg.conf/ instead.


text:
Q: How to catch error messages inside async functions correctly? app.get('/someFunction', someFunction);

async function someFunction(req, res) {
  try {
    await functionWithError(parameter);
    res.send('success');
  } catch (err) {
    console.log(err); //works
    res.send(err); //does not
  }
}

async function functionWithError(parameter) {
  return (result = await query('SELECT * from table where column = ?', [
    parameter,
  ]));
}

The error in functionWithError is that 'query' is not defined. In try-catch, catch fires correctly but res.send(err) is blank, however console.log(err) works.

A: Could it be circular structure to JSON error? I suppose that as I cannot see your query function.
Can you also try
console.log(JSON.stringify(err)) //works ?
If you got error of // ⛔ TypeError: Converting circular structure to JSON then it is the circular structure issue, that blocks you just "send" as you cannot send a circular object.
For still wanting to send circular object, refer to: https://github.com/WebReflection/flatted#flatted

A: An error object being thrown here, Should use err.name or err.message.
Reference : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error


text:
Q: flutter webview forced into darkmode This is probably a problem that only happens on xiaomi devices, where the webviews are forced into darkmode when the system is in darkmode. this results in an ugly looking webview, i've tried adding
<item name="android:forceDarkAllowed">false</item>

to the file android/app/src/main/res/values/styles.xml but it didn't work.
styles.xml file :
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame  -->
        <item name="android:forceDarkAllowed">false</item>
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>

    <!-- Theme applied to the Android Window as soon as the process has started.
         This theme determines the color of the Android Window while your
         Flutter UI initializes, as well as behind your Flutter UI while its
         running.

         This Theme is only used starting with V2 of Flutter's Android embedding. -->
    <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:forceDarkAllowed">false</item>
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>

     <style name="Theme.AppName" parent="Theme.MaterialComponents.DayNight">
        <item name="android:forceDarkAllowed">false</item>
    </style>
</resources>

A: To change the content you need to use the setForceDark method of the webview settings to make it change its contents as well. A compatibility version of this method can be found in the AndroidX webkit package.
Add the following dependency to your gradle build:
implementation 'androidx.webkit:webkit:1.3.0'

(1.3.0 is the minimum required version of this package. But higher versions should work as well.)
And add the following lines of code to your webview intitialization:
if(WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
WebSettingsCompat.setForceDark(myWebView.getSettings(),
WebSettingsCompat.FORCE_DARK_ON);
}

Hope this works Credit


text:
Q: Mysql uses the Yearweek function to retrieve last week's data, New Year's problem The YearWeek is not working as expected, for me.
SELECT YEARWEEK(date_format('2022-01-03','%Y-%m-%d'),1)-1`

The actual results : 202200
Expect the result : 202152

MySQL version: 8.0.19

A: SELECT YEARWEEK(DATE_SUB(STR_TO_DATE('2022-01-03','%Y-%m-%d') ,INTERVAL 7 DAY))


text:
Q: JBAS011445: Failed to get adapter for persistence provider using WildFly We are in the process to migrate Java 7 and JBoss 7 to Wildfly and Java 8.
In the process there is an error.
  16:38:51,323 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.subunit."foo_all.ear"."foo_sb.jar".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."foo_all.ear"."foo_sb.jar".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of subdeployment "foo_sb.jar" of deployment "foo_all.ear"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_45]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_45]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011445: Failed to get adapter for persistence provider 'de.foo.FooHibernatePersistenceProvider'
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.getPersistenceProviderAdaptor(PersistenceUnitServiceHandler.java:861)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:259)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleJarDeployment(PersistenceUnitServiceHandler.java:153)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:128)
    at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    ... 5 more

16:38:51,354 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "foo_all.ear")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"foo_all.ear\".\"foo_sb.jar\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"foo_all.ear\".\"foo_sb.jar\".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of subdeployment \"foo_sb.jar\" of deployment \"foo_all.ear\"
    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011445: Failed to get adapter for persistence provider 'de.foo.FooHibernatePersistenceProvider'"}}

The ear file can be deployed and the server can be started. But after the ear file has been created a subdeployment has to be deployed in the root directory of the main deployment.
The persistence xml looks like this:
   <?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_1.xsd"
    version="2.1">
    <persistence-unit name="foo">
        <provider>de.foo.srv.persistenceprovider.fooHibernatePersistenceProvider</provider>
        <jta-data-source>java:/foo</jta-data-source>
        <jar-file>foo_sb.jar</jar-file>
        <properties>
            <property name="jboss.as.jpa.adapterModule" value="org.jboss.as.jpa.hibernate:4" />
        </properties>
    </persistence-unit>
</persistence>

I have already installed the ojdbc7.jar and tested the connection. Required Jar's has been connected as in JBoss 7. This worked well in JBoss 7. I don't know why it does not work with Wildfly.
Please help!

A: I removed the hibernate property and it worked.
<property name="jboss.as.jpa.adapterModule" value="org.jboss.as.jpa.hibernate:4" />

A: Try to remove hibernate.jar from wildfly/lib. It's bundled in wildfly itself and could cause such problems.