text:
Q: Showing the selected value on the handler of range input as the value changes I have a range input which is having circle shaped handler. I used css to make the handler look like circle. Now that Im trying to find a way to show the value selected inside that circle. But I didn't find any way to do that even after long time. So here I am. Is there any way to do the same ? and one more thing I need to fill the colors on the left and right side of the handler based on the value selected. Can you please suggest how do i do it ? Any help would be appreciated.
Here is the code I used
<input type="range" min="0" max="10"/>

input[type=range]{
    -webkit-appearance: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 300px;
    height: 5px;
    background: #ddd;
    border: none;
    border-radius: 3px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    border: 1px solid #e95e57;
    height: 32px;
    width: 32px;
    border-radius: 50%;
    background: white;
    margin-top: -14px;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]:focus::-webkit-slider-runnable-track {
    background: #ccc;
}

A: I can suggest not very cross-browser solution using canvas as background:

function renderValue(value) {
    var ctx = document.getCSSCanvasContext('2d', 'value', 32, 32);

    ctx.fillStyle = '#FFF';
    ctx.fillRect(0, 0, 32, 32);

    ctx.font = 'bold 18px Arial';
    ctx.fillStyle = '#888';
    ctx.textAlign = 'center';
    ctx.fillText(value, 15, 21);
}

var input = document.querySelector('input')
input.oninput = function() {
    renderValue(this.value);
}
renderValue(input.value);
input[type=range] {
    -webkit-appearance: none;
}
input[type=range]::-webkit-slider-runnable-track {
    width: 300px;
    height: 5px;
    background: #ddd;
    border: none;
    border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    border: 1px solid #e95e57;
    height: 32px;
    width: 32px;
    border-radius: 50%;
    margin-top: -14px;
    background: -webkit-canvas(value) no-repeat 0 0;
}
input[type=range]:focus {
    outline: none;
}
input[type=range]:focus::-webkit-slider-runnable-track {
    background: #ccc;
}

div.test  {
    background: -webkit-canvas(clouds) no-repeat 0 0;
    height: 100px;
    width: 100px;
    border: 1px red solid;
}

canvas {
    border: 1px red solid;
}
<input type="range" min="0" max="10" data-value="3" />

A: I have kind of a solution, that should work cross browser, but it is pretty ugly and has the problem, that there is a text over the button which makes it only dragable on the sides (if somebody has a solution for this please feel free to tell):
HTML
<input id="range" type="range" min="0" max="10"/>

0

JavaScript
function updateRangeVal(){
    var offLeft = Math.floor(($('#range').val() / $('#range').attr('max')) * $('#range').width() - ((($('#range').val() / $('#range').attr('max')) * $('#range').width() - $('#range').width()/2) / 100) * 24);
    var offLeftAbs = $('#range').offset().left - 8 + offLeft;
    $('#rangeval').css({"top": ($('#range').offset().top-8)+"px", "left": offLeftAbs +"px"});
    $('#rangeval').html($('#range').val());
}

$('#range').on('input', function(){
    updateRangeVal();
});

updateRangeVal();

CSS
#rangeval{
    position: absolute;
    height: 16px;
    width: 16px;
    text-align: center;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input[type=range]{
    -webkit-appearance: none;
    position: absolute;
    left: 200px;
    top: 300px;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 300px;
    height: 5px;
    background: #ddd;
    border: none;
    border-radius: 3px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    border: 1px solid #e95e57;
    height: 32px;
    width: 32px;
    border-radius: 50%;
    background: white;
    margin-top: -14px;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]:focus::-webkit-slider-runnable-track {
    background: #ccc;
}

fiddle
the offsets on the slider are just for testing purposes

A: Here is an answer that covers both aspects mentioned. You can also have multiple range inputs on the same page and all will work individually.
Note: I did use a couple of lines of Markai's code. Thanks to him.

*

*HTML

  <input type="range" min="0" max="10" id="myRange"/>

1

  <input type="range" min="0" max="10" id="mySecondRange"/>

1

*jQuery
$(document).ready(function(){
  updateRangeValue($('input[type=range]'));
  $('input[type=range]').on('input change',function(){
    var input = $(this);
    updateRangeValue(input);
  });
});
function getRangeGradient(color1,color2,value,maximum){
  var gradient = "linear-gradient(to right, ";
  var breakPoint = (value/maximum)*100;
  var attrValue = gradient + color1 + " 0%, " + color1 + " " + breakPoint + "%, " + color2 + " " + breakPoint + "%, " + color2 + " 100%)";
  return attrValue;
}
function updateRangeValue(input){
  var selectedColor = "#428bca";
  var nonSelectedColor = "#ddd";
  var value = input.val();
  var maximum = input.attr('max');
  var inputWidth = input.width();
  var background = getRangeGradient(selectedColor, nonSelectedColor, value, maximum);
  var offLeft = Math.floor((value / maximum) * inputWidth - (((value / maximum) * inputWidth - inputWidth/2) / 100) * 24);
  var offLeftAbs = value == maximum ? input.offset().left - 15 + offLeft : input.offset().left - 10 + offLeft;
  input.next('.text').css({'left': offLeftAbs +'px'});
  input.next('.text').html(value);
  input.css('background', background);
}

*CSS
.range-wrapper {
  overflow: hidden;
  padding: 5px 0px;
}
.range-wrapper > div {
  position: relative;
  top: -15px;
  width: 5px;
}
.range-wrapper > .text {
  pointer-events: none;
}
input[type=range]{
  -webkit-appearance: none;
  background: linear-gradient(to right, #428bca 0%, #428bca 50%, #ddd 50%, #ddd 100%);
}
input[type=range]::-webkit-slider-runnable-track {
  width: 300px;
  height: 5px;
  border: none;
  border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  border: 1px solid #e95e57;
  height: 32px;
  width: 32px;
  border-radius: 50%;
  background: white;
  margin-top: -14px;
  cursor: pointer;
}
input[type=range]:focus {
  outline: none;
  background: linear-gradient(to right, #428bca 0%, #428bca 50%, #ddd 50%, #ddd 100%);
}

Here is the jsFiddle link.
Hope this helps.


text:
Q: Selecting multiple items with jQuery Sortable()? I need to drag multiple items simultaneously within a jquery sortable container. In this case, it's a series of nested divs within a parent div which has the sortable() behavior applied. Any suggestions?

A: If you are asking if you can select multiple items (say 1, 3, and 7 in one instance, and 3,4, and 8 in another), I do not believe jquery has a way to do this currently, since the event is tagged to onclick.
On the other hand, if you want to keep certain items grouped (1 and 2 are always together), just put them together in the div.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Comunicar funciones en extensión de chrome de popup.js y document.js Estoy desarrollando una extensión para usuarios de la comunidad donde uso un manifest que luce de la siguiente forma (V3):
    {
      "name": "gfhdhdfhfdh",
      "version": "1.0",
      "description": "gfhdhdfhfdh",
      "manifest_version": 3,
      "author": [
        {
          "author1": {
            "name": "gfhdhdfhfdh",
            "email": "gfhdhdfhfdh@gmail.com",
            "secction": "gfhdhdfhfdh"
          },
          "author2": {
            "name": "gfhdhdfhfdh",
            "email": "example@gmail.com",
            "secction": "Base Kit"
          }
        }
      ],
      "background": {
        "service_worker": "background.js"
      },
      "action": {
        "default_popup": "src/html/popup.html",
        "default_title": "gfhdhdfhfdh",
        "default_icon": {
          "32": "src/img/32.png",
          "48": "src/img/48.png",
          "64": "src/img/64.png",
          "128": "src/img/128.png"
        }
      },
      "icons": {
        "32": "src/img/32.png",
        "48": "src/img/48.png",
        "64": "src/img/64.png",
        "128": "src/img/128.png"
      },
      "content_scripts": [
        {
          "matches": ["https://*.com/*"],
          "js": ["src/js/document.js"],
          "css": ["src/css/style_links.css"],
          "run_at": "document_end"
        }
      ],
      "permissions": [
        "tabs",
        "activeTab",
        "bookmarks",
        "unlimitedStorage",
        "storage"
      ],
      "host_permissions": ["*://*/*"]
    }

el popup.js es donde estoy capturando la configuración deseada por el usuario; en teoría esta configuración será aplicada a la url actual abierta; por ahora tengo esto:
document.addEventListener("DOMContentLoaded", function () {

    let apply = document.getElementById('atsu-apply');
    let normal = document.getElementById('atsu-color-normal');
    let visited = document.getElementById('atsu-color-visited');
    let closed = document.getElementById('atsu-color-closed');

    normal.addEventListener("input", function (e){
        //e.preventDefault();
        IntefaceColor();
    });

    visited.addEventListener("input", function (e){
        //e.preventDefault();
        IntefaceColor();
    });

    closed.addEventListener("input", function (e){
        //e.preventDefault();
        IntefaceColor();
    });

});

function IntefaceColor(){
    let color_normal = document.getElementById('atsu-color-normal').value;
    let color_visited = document.getElementById('atsu-color-visited').value;
    let color_closed = document.getElementById('atsu-color-closed').value;

    console.log()
    chrome.runtime.sendMessage({setcolor: [{normal:color_normal,visited:color_visited,closed:color_closed}]});
}

como pueden observas estoy tratando de llamar a window.setColorLink y me da error por que no esta definido, reconozco que es cierto... esta funcion en realidad esta en otro archivo document.js y este es su contenido:
console.log('document.js');
chrome.runtime.onMessage.addListener(message => {
    console.log(message);
    if (message.hasOwnProperty('setcolor')) {
        console.log(message);
        setColorLink(message.normal,message.visited,message.closed);
    }
});

function setColorLink(color_normal, color_visited, color_closed) {
    var style = document.createElement('style');
    style.setAttribute('id', 'atsu-style');
    style.innerHTML = `
                        a.question-hyperlink,
                        a.answer-hyperlink {
                            font-family: Calibri;
                            font-weight: 100;
                            font-style: italic;
                        }

                        a.question-hyperlink,
                        a.answer-hyperlink {
                            color: `+ color_normal + `;
                        }

                        a.question-hyperlink:visited,
                        a.answer-hyperlink:visited  {
                            color: `+ color_visited + ` !important;
                        }
                        `;

    var elementExists = document.getElementById("atsu-style");
    if (elementExists) {
        elementExists.innerHTML = style;
    } else {
        document.head.appendChild(style);
    }
    var links_questions = document.getElementsByClassName("question-hyperlink");
    var values = [].map.call(links_questions, function (element) {
        let herf = element.href;
        let title = element.innerHTML
        console.log(title);
        if (title.indexOf('[cerrada]') !== -1) {
            element.style.color = color_closed;
        }
    });
}

el objetivo de setColorLink es evaluar los anchor de la sitio actual abierto (no del popup de la extensión), y aplicarles un css especifico.
el problema es que no logro comunicas los archivos popup.js y document.js para que tengan el alcance de lo anterior descrito. si alguien me aclara esto y el ámbito de uso de popup.js y document.js y background.js se los agradecería, ya que no me quedo clara la documentacion en ingles.
Actualización:
pude determinar que de lado de la pestaña del navegador se ejecuta document.js y de lado de la extensión se esta ejecutando popup.js y background.js
entonces alguno de popup.js y background.js necesito que consuma una funcion de document.js y eso es lo que no logro hacer.
no logro que se ejecute; que en la medida que en el popup se cambian los colores; vaya cambiando los colores del link, en tiempo real.

A: Como bien dices, el backgorund y el pop se ejecutan aparte, vamos a llamarlo "lado de la extensión" y el document.js se ejecuta como un script más del sitio web.
La tarea de nosotros es comunicarnos desde el "lado de la extensión" hacia el document.js, esto se puede hacer de forma muy fácil gracias a los eventos.
En tu popup.js debes de enviar una petición que irá dirigido exclusivamente a tu document.js y esto se hace obteniendo el id del tab en el que es llamado el popup y luego de esto ya podemos enviar la información que queramos.
async function IntefaceColor(){
    let color_normal = document.getElementById('atsu-color-normal').value;
    let color_visited = document.getElementById('atsu-color-visited').value;
    let color_closed = document.getElementById('atsu-color-closed').value;
    await chrome.tabs.query({active: true}, async function(tabs) {
      let tab = tabs[0]
      await chrome.tabs.sendMessage(tab.id, {"colors":[color_normal, color_visited, color_closed]});
    });
}

Con esto estamos enviando un objeto a la pestaña donde se ha abierto el popup ahora solo nos faltaría recibir y procesar esto en el document.js para eso debemos añadir un escuchador del evento onMessage
chrome.runtime.onMessage.addListener(function(msg, sender, sendResponse) {
    if(msg.colors){
       //haces lo que quieras
    }
});


text:
Q: Have the monetdb's developers tested any other compression algorithm on it? Have the MonetDb's developers tested any other compression algorithm on it before?
Perhaps they have tested other compression algorithms ,but it's really had a negative performance impact.
So why haven't they improved this database's compression performance?
I am a student from China. MonetDb is really interesting me and I want to try to improve its compression performance.
So, I should make sure that any body have done this before.
It would be my grateful if you could answer my question.
That is because i really need this.
Thank you So much.

A: MonetDB only compresses String (Varchar and char) types using dictionary compression and only if the number of unique strings in a column is small.
Integrating any other kind of compression (even simple ones like Prefix-Coding, Run-length Encoding, Delta-compression, ...) need a complete rewrite of the system because the operators have to be made compression-aware (which pretty much means creating a new operator).
The only thing that may be feasible without a complete rewrite is having dedicated compression operators the compress/decompress data instead of spilling to disk. However, this would be very close to the memory compression apple implemented in Mavericks

A: MonetDB compresses columns using PFor compression. See http://paperhub.s3.amazonaws.com/7558905a56f370848a04fa349dd8bb9d.pdf for details. This also answers the your question about checking other compression methods.
The choice for PFOR is because of the way modern CPU's work, but really any algorithm that doesn't work with branches but with (only) arithmetics will do just fine. I've hit similar speeds with arithmetic coding in the past.


text:
Q: Using Angular matcher for route throws "Consider changing the function expression into an exported function" I wonder if you guys can help with this code! because I think I'm going out of my mind
This is the \helpers\matcher.ts(4,12):
import { UrlMatcher , UrlSegment } from "@angular/router";

export function match(path: string): UrlMatcher {
    return function matcher(url: UrlSegment[], group) {
        console.log(path, url, group);
        if (url.length > 0 && url[0].path === path) {
            return { consumed: [url[0]] };
        }
        return null;
    };
}

This is the error I get when I do ng build --prod

ERROR in src\app\app.module.ts(124,30): Error during template compile of 'AppModule'
Function expressions are not supported in decorators in 'rootRouterConfig'
  'rootRouterConfig' references 'match'
  'match' contains the error at src\app\shared\helpers\matcher.ts(4,12)
  Consider changing the function expression into an exported function

But it compiles and works perfect with ng build and ng serve.
Here is the app.routes path
export const rootRouterConfig: Routes = [

    { path: ':param', component: HomeComponent,
        children: [
            { matcher: match('job-spec/:id'), component: JobSpecDetailsComponent },
            { path: '**',  redirectTo: '404' },
        ]
    },
];

And here is the app.module
@NgModule({
    imports: [
        ....
        RouterModule.forRoot(rootRouterConfig, {
            useHash: false,
            scrollPositionRestoration: 'enabled',
            anchorScrolling: 'enabled',
        }),
        ....

A: I cannot test it but try the following:
export function match(url: UrlSegment[]): UrlMatcher {
    if (url.length > 0 && url[0].path === path) {
       return { consumed: [url[0]] };
    }
    return null;
}

And use it as:
{ matcher: match, component: JobSpecDetailsComponent },

The URL has the path, but not sure your need why you want to pass the path again. Use the path statically and see if it compiles, and then figure it out your path.


text:
Q: Adding Days To C# Nullable DateTime Object Not Performing In While Loop I am writing some production code here, and having to add some code of my own design on top of code that is already a bit problematic. I have a loop that helps calculate dates based on a certain pay period.
The problem I am encountering is that my Nullable DateTime objects are not changing at all when having values added to them by using the DateTime?.Value.AddDays() function call. When  I run through this code, the nextPayDate object and its value stay the same even though I add to it during my loop. Said behavior is not useful and also is creating an endless loop. Thoughts?
public static List<DateTime?> GetLPSPaymentDates(Applicant applicant, int loanTermType, DateTime deliveryConfirmationDate)
{

    if (applicant == null)
    {
        throw new Exception("The applicant you are wanting to set an LPS for is null");
    }

    DateTime? firstPaymentDate = DateTime.Today;
    DateTime? secondPaymentDate = DateTime.Today;
    DateTime? lastPayDate = applicant.MainEmployer.LastPayDate;
    DateTime? nextPayDate = applicant.MainEmployer.NextPayDate;

    DateTime? earliestPossiblePaymentDate =   deliveryConfirmationDate.AddDays(10);

    int daysToAdd = 0;
    if (lastPayDate != null && nextPayDate != null)
    {
        var tempDate = nextPayDate;
        while (tempDate.Value <= earliestPossiblePaymentDate.Value)
        {
            daysToAdd =     IncrementPaymentDateByTermType((TermTypes)loanTermType);
            nextPayDate.Value.AddDays(daysToAdd);
            firstPaymentDate.Value.AddDays(daysToAdd);
        }
        if (firstPaymentDate == DateTime.Today)
        {
            firstPaymentDate = nextPayDate;
        }
        secondPaymentDate = firstPaymentDate.Value.AddDays(daysToAdd);
    }
    else
    {
        throw new Exception("Could not find applicant's last or next pay date.");
    }

    List<DateTime?> firstAndSecondDates = new List<DateTime?>()
    {
        firstPaymentDate,
        secondPaymentDate
    };

    return firstAndSecondDates;

}

public static int IncrementPaymentDateByTermType(TermTypes termType)
{
    int numberOfDaysToAdd;

    switch (termType)
    {
        case TermTypes.BiWeekly:
            numberOfDaysToAdd = 14;
            break;
        case TermTypes.Weekly:
            numberOfDaysToAdd = 7;
            break;
        default:
            numberOfDaysToAdd = 1;
            break;
    }
    return numberOfDaysToAdd;
}

A: AddDays returns a new object as the result instead of updating the existing object.  Try:
daysToAdd = IncrementPaymentDateByTermType((TermTypes)loanTermType);
nextPayDate = nextPayDate.Value.AddDays(daysToAdd);
firstPaymentDate = firstPaymentDate.Value.AddDays(daysToAdd);

A: Didn't test it, but this should help (given your while loop logic is correct)
while (tempDate.Value <= earliestPossiblePaymentDate.Value)
{
    daysToAdd = IncrementPaymentDateByTermType((TermTypes)loanTermType);
    tempDate = nextPayDate.Value.AddDays(daysToAdd); // <<= updating tempDate
    firstPaymentDate.Value.AddDays(daysToAdd);
}


text:
Q: how to change position of the list in the navbar So I'm really new and taking this class on Udemy; but the navigation bar isn't working even though I am straight up copying the instructor at this point.
What I want it to do is that to list the list on the right side of the creen, which isn't happening.

        Tindog
         <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

      </button>

                Contact

                Pricing

                Download

A: I think your code is working fine here
Please Check if you are using the correct CDN or version


text:
Q: Android systrace command error I wanted to use the systrace.py command to generate trace.html file, i used the command like this:

systrace.py -t 5 -o trace.html

then i got the error:

ValueError: preexec_fn is not supported on Windows platforms


text:
Q: How to update a specific child in Retrofit 2 (Android) How would I be able to update a specific child in Retrofit2 when there are more than one data(s).
As you can see on the attached file, I have two data/passenger profile. I'd like to update the balance of the first passenger profile with the one that has tagID: 613421. How would that be possible?

public interface APIServicePassenger {

@GET("/passengers")
Call<List<Passenger>> getPassengers();

@PUT("/passengers")
Call<List<Passenger>> updatePassengerProfile(@Field("balance") int balance);
}

But I don't know how to use the PUT request
public class Config {

public static final String BASE_URL = "http://busartery.....";

public static Retrofit getClient() {
    Retrofit retrofit = null;

    if (retrofit == null) {
        retrofit = new Retrofit.Builder()
                .baseUrl(Config.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }
    return retrofit;
}
}

I don't know if I'm doing the right thing.
if (!medtCustomerID.getText().toString().trim().isEmpty() &&
                    !medtCustomerName.getText().toString().trim().isEmpty()) {
                balance += amountLoad;

                final Call<List<Passenger>> passengerCallList = servicePassenger.getPassengers();
                passengerCallList.enqueue(new Callback<List<Passenger>>() {
                    @Override
                    public void onResponse(Call<List<Passenger>> call, Response<List<Passenger>> response) {
                        if (response.isSuccessful()) {
                            List<Passenger> passengerList = response.body();

                            if (passengerList.size() != 0) {
                                for (int i = 0; i <passengerList.size(); i++) {
                                    String name = passengerList.get(i).getName();
                                    if (name.equals(medtCustomerName.getText().toString().trim())) {
                                        //to update that specific data
                                        Passenger passenger = new Passenger(balance);

                                        Call<List<Passenger>> callPassList = servicePassenger.updatePassengerProfile(
                                                passenger.getBalance());
                                        callPassList.enqueue(new Callback<List<Passenger>>() {
                                            @Override
                                            public void onResponse(Call<List<Passenger>> call, Response<List<Passenger>> response) {
                                                if (response.isSuccessful()) {
                                                    Toast.makeText(LoaderActivity.this, "Successfully loaded.\n New Load " +balance, Toast.LENGTH_SHORT).show();
                                                }
                                            }

                                            @Override
                                            public void onFailure(Call<List<Passenger>> call, Throwable t) {
                                                Toast.makeText(LoaderActivity.this, "onFailure(update): " +t.getMessage(), Toast.LENGTH_LONG).show();
                                            }
                                        });
                                    }
                                }
                            }
                        }
                    }

                    @Override
                    public void onFailure(Call<List<Passenger>> call, Throwable t) {
                        Toast.makeText(LoaderActivity.this, "onFailure(btnLoad) :"+t.getMessage(), Toast.LENGTH_LONG).show();
                    }
                });
            }

A: itsnt about your client code, but your server code.
REST allows you to update something using @PUT
The code you posted can't update only part of the node on the server.
and the interface:
@PUT("/passengers")
Call<List<Passenger>> updatePassengerProfile(@Field("balance") int balance);

wont update it either because it won't know wich part of the list you are updating, u should provide it with a passenger ID
@PUT("/passengers")
Call<List<Passenger>> updatePassengerProfile(@Field("balance") int
balance,@Field("id") String id);

ps and you ca probably loose the @Field annotation.
Again this willl work only if the server supports it


text:
Q: javascript looping problem

addbutton() adds a search button to end of the li tags, but when i run, it's looping for only 43 times. so it's adding the search button for the first 43 li tags. what is your thoughts, why is looping broken?
edit:
more information,
-i tried function on a page that contains 131 li tags. and function is working for the first 43 li tag,
-i tried for both of google chrome and firefox, results are same.
i tried to alert(o.length). there is no problem, it return true number, "131".

A: Well, there's certainly a bug on this line:
str += decodeURIComponent(keyword);

That should be
str += encodeURIComponent(keyword);

That may be the problem, decodeURIComponent may be blowing up on some input text because you're using it on strings that aren't URL-encoded.
Barring that:
You'll need to look at the actual text in the li elements as they're being processed. It's clearly not just a numbers thing, the code works just fine in Chrome.
I recommend using Chrome's Dev tools (Shift+Ctrl+I) to set a breakpoint in the function and walk through it with your actual test data. Or use the Firebug add-on for Firefox to do the same.


text:
Q: Environment-specific web.xml in grails? What's the best way to build environment-specific web.xml entries in grails?
I need to make certain modifications for production only, as they break running locally.
Any thoughts?

A: Here's the solution that's i'm using, from the guy over at death-head.ch
first install the templates
grails install-templates

then customize the web.xml you'll find in src/templates/war/web.xml.  I chose to make a web_dev.xml and a web_prod.xml and delete the web.xml.    I wanted web_prod.xml to contain a security-constraint block. anyway...
Place the following in BuildConfig.groovy:
// #########################################################
// ## Can't use environment switching block because BuildConfig doesn't support it.
// ##    @url http://jira.grails.org/browse/GRAILS-4260
// ## So use this workaround:
// ##   @url http://death-head.ch/blog/2010/09/finally-solved-the-base-authentication-in-grails/
// #########################################################

switch ("${System.getProperty('grails.env')}") {
  case "development":
    if (new File("/${basedir}/src/templates/war/web_dev.xml").exists()) {
        grails.config.base.webXml = "file:${basedir}/src/templates/war/web_dev.xml"
    }
    break;
  default:
    if (new File("/${basedir}/src/templates/war/web_prod.xml").exists()) {
        grails.config.base.webXml = "file:${basedir}/src/templates/war/web_prod.xml"
    }
    break;
}

Good luck!

A: You can create scripts/_Events.groovy with an event handler for the 'WebXmlEnd' event which is fired once Grails and the plugins have finished making their changes. Update the XML with plain search/replace or via DOM methods by parsing the XML and write out the updated file:
import grails.util.Environment

eventWebXmlEnd = { String filename ->

   if (Environment.current != Environment.PRODUCTION) {
      return
   }

   String content = webXmlFile.text

   // update the XML
   content = ...

   webXmlFile.withWriter { file -> file << content }
}

A: I've never tried it, but it should be possible to specify the grails.config.base.webXml parameter in BuildConfig.groovy dependant on the current environment.
There's a list of available BuildConfig settings here

EDIT
Actually, due to this issue, this isn't a way forward :-(  Maybe passing the property like:
grails -Dgrails.config.base.webXml=/path/to/web.xml

Is all that's possible?


text:
Q: unfamiliar subset notation While reading this paper (section 3.3) I came across an unfamiliar notation:
"Given an expanded query set Q, we extract $Q_s |q_i \nsubseteq q_j|q_i,q_j \in Q_s $ "
Here Q is a set of elements. Can someone please explain what the notation means?
My inference is that $q_i$ is not a subset of $q_j$ but, that doesn't make sense because $q_i$ and $q_j$ are elements in a set.

A: The notation is nonstandard and rather confusing, but the subsequent example makes it clear. While the elements are not sets, they are strings, and the authors seem to be (ab)using subset notation between two strings to represent being a substring (i.e. one string appears as a contiguous section of the other). So $Q_s$ is the subset of all elements in $Q$ which are not substrings of any other element. Equivalently it is the smallest subset of $Q$ such that everything in $Q$ is a substring of (or equal to) something in $Q_s$


text:
Q: Nav links broken and I'm building my website directly in HTML, CSS, and JS for the first time. Everything was working perfectly until I signed up for an iOS app called Clone, which I synced with my GitHub account. Inside my faq.html file, I added one space between a link and a word in a paragraph, just as a test.
Afterward, the nav menu on the FAQ page broke and all the <s turned red in VS Code. At the suggestion of @Samirovic, I changed the page icon img src to include _s instead of spaces, which fixed the < errors.
But the URL problem is still happening. The nav menu works on every page except for the FAQ page, which I updated in Clone. On that page, I still get a 404 error page and the URL is doubled within quotes for some reason (which is what causes the error).
URL Example: https://studiooriley.github.io/"https://studiooriley.github.io/contact"
I can't figure out why using the Clone app to add a single space to an FAQ question would cause these issues. I have triple-checked my nav links and can confirm that they're correct. I've been researching for the last six hours and can't find any way to fix this or even anyone else with the same issue.
I would love any help you can provide! I will admit, I'm very new to coding and GitHub, and I didn't understand branches until now, so this all happened in my main branch. I have since made a couple of adjustments in a new branch and in the main branch. I hope you can help. Thank you!
Here's a picture of my HTML in VS Code.

A: Because of the spaces in the image name inside the src , you must use _ between words


text:
Q: Has anyone experience with recursive problems in Aleph? I am currently working on my Symbolic AI homework in Aleph and I have been working on it for hours, but I am still where I was at the beginning, I hope some of you can help me or give me hints.
So the first exercise was to look at the recursive example in Aleph of the implementation of member/2 and check how this works, and I think, I understand that:
mem.b:
% Simple illustration of the learning of recursive predicates
%       in Aleph
% To run do the following:
%       a. Load Aleph
%       b. read_all(mem).
%       c. induce.

% :- modeh(*,mem(+any,+list)).
% :- modeb(*,mem(+any,+list)).
% :- modeb(1,((+list) = ([-any|-list]))).

:- mode(*,mem(+any,+list)).
:- mode(1,((+list) = ([-any|-list]))).

 :- set(i,3).
 :- set(noise,0).

 :- determination(mem/2,mem/2).
 :- determination(mem/2,'='/2).

The next exercise is to implement an Aleph algorithm for another recursive problem, for example rev/2 or append/3, I tried this for hours, but I don't really know how to start or what to do. Here is how I implemented it at the moment:
rev.b ( I tried many things and commented all things out for now, but tbh I am really confused atm):
% Simple illustration of the learning of recursive predicates
%       in Aleph
% To run do the following:
%       a. Load Aleph
%       b. read_all(rev).
%       c. induce.

% :- mode(*, rev(+startlist,+startreversed,+result)).
% :- mode(1, ((+startlist) = ([-any|-startlistlist]))).
% :- mode(1, ((-result) = ([+any|+result]))).
% :- mode(1, ((-list) = (+result))).

% :- mode(*,rev(+startlist,+endlist)).
% :- mode(1, (length(+startlist, -length) = length(+endlist, -length))).
% :- mode(*,rev(+startlist,-result)).
% :- modeb(*,mem(+any, ([+any|+list]))).
% :- modeb(1, ((-result) = ([+any|+result]))).
% :- modeb(1, ((+list) = (-endlist))).
% :- modeb(1, ((+list) = (-startlist))).
% :- modeb(1, ((+endlist) = ([-any|-endlist]))).
% :- modeb(1, ((+startlist) = ([-any|-startlist]))).
% :- modeb(1, ((-result) = ([+any]))).

%:- mode(*, rev(+startlist, +list)).
%:- modeb(*, ((+startlist) = (+list), (+startlist) = ([-any|-startlist]))).
%:- modeb(*, ((-startlist) = ([+anyend|+anystart]))).
% :- modeb(1, ((+startlist) = ([-any|-startlist]))).
%:- modeb(*, ((+startlist) = ([-anystart|-anyend]))).
%:- modeb(1, ((+startlist) = ([-any|-startlist]))).
%:- modeb(1, ((+list) = ([-any|-list]))).

:- mode(*, rev(+list, +list)).
:- mode(1, ((+list) = ([-anystart|-anyend]))).
:- mode(1, ((-list) = ([+anystart]))).
:- mode(1, ((-list) = ([+anyend]))).
:- mode(1, ((-list) = ([+anyend|+anystart]))).

% :- mode(1, (([+endlist]) = ([+list|+any]))).%, (+starlist) = ([-any|-startlist]))).
% :- mode(1, ((+startlist) = ([-any|-list]))).%, (+endlist) = ([-anyt|-listt]))).

:- set(i,2).
:- set(noise,0).

:- determination(rev/2, rev/2).
% :- determination(rev/3, rev/3).
% :- determination(rev/2, mem/2).
% :- determination(rev/2,rev/2).
% :- determination(rev/2,length/2).
:- determination(rev/2,'='/2).
% :- determination(rev/3, '='/2).

If anyone wants to see my positive and negative example files, please let me know, but I think the main issue is in the background knowledge file, I dont really understand much of it, tbh. Has anyone any hints/tips/help?


text:
Q: sklearn запрос по api mutual_info_regression Хочу получить взаимную информацию каждых 2х признаков через метод ближайшего соседа. В mutual_info_regression предустановлено 3 признака для расчетов. работающий код:
selector = SelectKBest(mutual_info_regression, k='all').fit(X, y)

Как сделать для 2х признаков?
Приведенные ниже варианты вызывают ошибки:
from sklearn.feature_selection import SelectKBest,mutual_info_regression
selector = SelectKBest(mutual_info_regression, k='all').fit(X, y,**{'n_neighbors':2})
selector = SelectKBest(mutual_info_regression(**{'n_neighbors':2}), k='all').fit(X, y)
selector = SelectKBest(mutual_info_regression(n_neighbors=2), k='all').fit(X, y)
selector = SelectKBest(mutual_info_regression,n_neighbors=2, k='all').fit(X, y)

При попытке зайти через make_scorer:
scoring = make_scorer(mutual_info_regression, greater_is_better=True, n_neighbors = 2)

selector = SelectKBest(scoring, k='all').fit(feat, targ)

ошибка:

TypeError: call() takes at least 4 arguments (3 given)

A: Решение, через partial. Можно заменить существующую функцию, которой уже переданы аргументы переопределение функции:
from functools import partial
scorer_function = partial(mutual_info_regression, n_neighbors=2)
selector = SelectKBest(scorer_function, k='all').fit(X, y)


text:
Q: Version number in jar file name - how to set classpath in manifest file properly? I have a set of jars which will eventually be deployed as an ear to WebSphere. When each of these jars is built, the manifest file gets a Class-Path entry with all the jars that are dependencies. Later, when the ear is deployed, these entries are used by WebSphere to determine the visibility.
Up to now, we used jar names without versions, but we want to introduce jar names with versions in it (like foo-1.0.0.jar). The problem is the following:
When I build a jar file, I might depend on foo-1.0.0.jar, so that this jar goes into the manifest file. Later, when the ear file is built, foo-1.0.5.jar is included because this is the stable version. Now my manifest file contains a reference to a file that is not included in the ear. What can I do about it? Or did I miss something important?


text:
Q: UPDATED How do I fix IF/DISPLAY and program math? [UPDATED] I have a program that needs to print the total of column one and column two (WORKING). Then it is suppose to display total of column one divided by the total of column two (.--)(not working). Then display the corresponding letter grade(not working). Then do the same thing for the test section. At the very end display the overall percent (.--) and the corresponding grade.(not working)
Program code:
   ENVIRONMENT DIVISION.
   INPUT-OUTPUT SECTION.
   FILE-CONTROL.

       SELECT GRADES-FILE-IN
           ASSIGN TO 'GRADES.SEQ'
           ORGANIZATION IS LINE SEQUENTIAL.

       SELECT GRADES-FILE-OUT
           ASSIGN TO 'GRADES.RPT'
           ORGANIZATION IS LINE SEQUENTIAL.

   DATA DIVISION.
   FILE SECTION.
   FD  GRADES-FILE-IN.
   01  GRADES-RECORD-IN.
       05  ASG-TEST-ID-IN                 PIC X(14).
       05                                 PIC X.
       05  ACTUAL-POINTS-IN               PIC 9(3).
       05                                 PIC X.
       05  AVAILABLE-POINTS-IN            PIC 9(3).

   FD  GRADES-FILE-OUT.
   01  GRADES-RECORD-OUT               PIC X(80).

   WORKING-STORAGE SECTION.
   01  ARE-THERE-MORE-RECORDS       PIC X(3)       VALUE 'YES'.
   01  WS-AVERAGE                   PIC XX.
   01  WS-LETTER                    PIC XX.
   01  WS-TOTAL-ACTUAL              PIC 9(4)       VALUE ZERO.
   01  WS-TOTAL-AVAILABLE           PIC 9(4)       VALUE ZERO.
   01  WS-TOTAL-PERCENT             PIC 9V999      VALUE ZERO.
   01  WS-GRAND-TOTAL-ACTUAL        PIC 9(4)       VALUE ZERO.
   01  WS-GRAND-TOTAL-AVAILABLE     PIC 9(4)       VALUE ZERO.
   01  WS-GRAND-TOTAL-PERCENT       PIC 9V99       VALUE ZERO.

   01  DETAIL-LINE.
       05  DL-ASG-TEST-ID                  PIC X(14).
       05                                  PIC X(3).
       05  DL-ACTUAL-POINTS                PIC Z,ZZ9.
       05                                  PIC X(3).
       05  DL-AVAILABLE-POINTS             PIC Z,ZZ9.

   01  TOTALS-LINE.
       05                              PIC X(6)       VALUE 'TOTALS'.
       05                              PIC X(11)      VALUE SPACES.
       05  TL-POINTS-ACTUAL            PIC Z,ZZ9.
       05                              PIC X(3)       VALUE SPACES.
       05  TL-POINTS-AVAILABLE         PIC Z,ZZ9.
       05                              PIC X(2)       VALUE SPACES.
       05                              PIC X(7)       VALUE 'Percent'.
       05                              PIC X          VALUE SPACES.
       05                              PIC X          VALUE '='.
       05                              PIC X          VALUE SPACES.
       05  TL-PERCENTAGE               PIC Z.ZZ.
       05                              PIC X(2)       VALUE SPACES.
       05                              PIC X(5)       VALUE 'Grade'.
       05                              PIC X          VALUE SPACES.
       05                              PIC X          VALUE '='.
       05                              PIC X          VALUE SPACES.
       05  TL-LETTER-GRADE             PIC XX.

   01  GRAND-TOTALS-LINE.
       05                              PIC X(11)      VALUE 'FINAL GRADE'.
       05                              PIC X(17)      VALUE SPACES.
       05                              PIC X(7)       VALUE 'Percent'.
       05                              PIC X          VALUE SPACES.
       05                              PIC X          VALUE '='.
       05                              PIC X          VALUE SPACES.
       05  GT-PERCENTAGE               PIC Z.ZZ.
       05                              PIC X(2)       VALUE SPACES.
       05                              PIC X(5)       VALUE 'Grade'.
       05                              PIC X          VALUE SPACES.
       05                              PIC X          VALUE '='.
       05                              PIC X          VALUE SPACES.
       05  GT-LETTER-GRADE             PIC XX.

   PROCEDURE DIVISION.
   100-MAIN.
       OPEN INPUT GRADES-FILE-IN
       OPEN OUTPUT GRADES-FILE-OUT

       PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO'
           READ GRADES-FILE-IN
               AT END
                   MOVE 'NO ' TO ARE-THERE-MORE-RECORDS
               NOT AT END
                   PERFORM 200-PROCESS-ONE-RECORD
           END-READ
       END-PERFORM

       PERFORM 300-PRINT-TOTALS-LINE
       PERFORM 500-PRINT-FINAL-TOTALS-LINE

       CLOSE GRADES-FILE-IN
       CLOSE GRADES-FILE-OUT
       STOP RUN.

   200-PROCESS-ONE-RECORD.
       IF ASG-TEST-ID-IN = 'Test #1'
           PERFORM 300-PRINT-TOTALS-LINE
       END-IF
       MOVE ASG-TEST-ID-IN TO DL-ASG-TEST-ID
       MOVE ACTUAL-POINTS-IN TO DL-ACTUAL-POINTS
       MOVE AVAILABLE-POINTS-IN TO DL-AVAILABLE-POINTS
       MOVE DETAIL-LINE TO GRADES-RECORD-OUT
       WRITE GRADES-RECORD-OUT.
       COMPUTE WS-TOTAL-ACTUAL = WS-TOTAL-ACTUAL + ACTUAL-POINTS-IN
       COMPUTE WS-TOTAL-AVAILABLE = WS-TOTAL-AVAILABLE + AVAILABLE-POINTS-IN.
       COMPUTE WS-TOTAL-PERCENT ROUNDED = WS-TOTAL-ACTUAL / WS-GRAND-TOTAL-AVAILABLE.

   300-PRINT-TOTALS-LINE.
       MOVE WS-TOTAL-ACTUAL TO TL-POINTS-ACTUAL
       MOVE WS-TOTAL-AVAILABLE TO TL-POINTS-AVAILABLE
       MOVE WS-TOTAL-PERCENT TO TL-PERCENTAGE
       MOVE TOTALS-LINE TO GRADES-RECORD-OUT
       WRITE GRADES-RECORD-OUT AFTER ADVANCING 1 LINES
       MOVE SPACES TO GRADES-RECORD-OUT
       WRITE GRADES-RECORD-OUT AFTER ADVANCING 3 LINES

       ADD WS-TOTAL-ACTUAL TO WS-GRAND-TOTAL-ACTUAL
       ADD WS-TOTAL-AVAILABLE TO WS-GRAND-TOTAL-AVAILABLE
       ADD WS-TOTAL-PERCENT TO WS-GRAND-TOTAL-PERCENT

       MOVE ZERO TO WS-TOTAL-ACTUAL
       MOVE ZERO TO WS-TOTAL-AVAILABLE
       MOVE ZERO TO WS-TOTAL-PERCENT.

   400-CALCULATE-LETTER.

       EVALUATE WS-AVERAGE
       WHEN <= .59
           MOVE 'E' TO WS-LETTER
       WHEN <= .66
           MOVE 'D' TO WS-LETTER
       WHEN <= .69
           MOVE 'D+' TO WS-LETTER
       WHEN <= .72
           MOVE 'C-' TO WS-LETTER
       WHEN <= .76
           MOVE 'C' TO WS-LETTER
       WHEN <= .79
           MOVE 'C+' TO WS-LETTER
       WHEN <= .82
           MOVE 'B-' TO WS-LETTER
       WHEN <= .86
           MOVE 'B' TO WS-LETTER
       WHEN <= .89
           MOVE 'B+' TO WS-LETTER
       WHEN <= .94
           MOVE 'A-' TO WS-LETTER
       WHEN OTHER
           MOVE 'A+' TO WS-LETTER
       END-EVALUATE.

   500-PRINT-FINAL-TOTALS-LINE.
       MOVE WS-GRAND-TOTAL-PERCENT TO GT-PERCENTAGE
       MOVE WS-AVERAGE TO GT-LETTER-GRADE
       MOVE GRAND-TOTALS-LINE TO GRADES-RECORD-OUT
       WRITE GRADES-RECORD-OUT.

The current RPT file prints out this:
Assignment #1       10      10
Assignment #2       28      30
Assignment #3       45      50
Assignment #4      109     130
Assignment #5       95     100
Assignment #6        0       0
Assignment #7        0       0
Assignment #8        0       0
Assignment #9        0       0
Assignment #10       0       0

TOTALS             287     320  Percent =       Grade =

Test #1              9      12
Test #2             18      18
Test #3             28      37
Test #4             19      25
Test #5             43      55
Test #6             15      23
Test #7              0       0
Test #8              0       0
Test #9              0       0

TOTALS             132     170  Percent =  .41  Grade =

FINAL GRADE                 Percent =  .41     Grade =

Needs to print exactly like:
Assignment #1       10      10
Assignment #2       28      30
Assignment #3       45      50
Assignment #4      109     130
Assignment #5       95     100
Assignment #6        0       0
Assignment #7        0       0
Assignment #8        0       0
Assignment #9        0       0
Assignment #10       0       0

TOTALS             287     320  Percent =  .90  Grade = B+

Test #1              9      12
Test #2             18      18
Test #3             28      37
Test #4             19      25
Test #5             43      55
Test #6             15      23
Test #7              0       0
Test #8              0       0
Test #9              0       0

TOTALS             132     170  Percent =  .78  Grade = C

FINAL GRADE                     Percent =  .84  Grade = B-

A: 200-Process... issues
you have
   COMPUTE WS-TOTAL-ACTUAL = WS-GRAND-TOTAL-ACTUAL + ACTUAL-POINTS-IN
   COMPUTE WS-TOTAL-AVAILABLE = WS-GRAND-TOTAL-AVAILABLE + AVAILABLE-POINTS-IN.
   COMPUTE WS-TOTAL-PERCENT ROUNDED = WS-GRAND-TOTAL-ACTUAL / WS-GRAND-TOTAL-AVAILABLE.

it would help is you used the same variable on both sides of the - sign
   COMPUTE WS-TOTAL-ACTUAL = WS-TOTAL-ACTUAL + ACTUAL-POINTS-IN
   COMPUTE WS-TOTAL-AVAILABLE = WS-TOTAL-AVAILABLE + AVAILABLE-POINTS-IN.
   COMPUTE WS-TOTAL-PERCENT ROUNDED = WS-TOTAL-PERCENT ROUNDED / WS-GRAND-TOTAL-AVAILABLE.

400- issues
it would help adding a few else and end-if in, Also try moving the value to the output record instead of using a display
Change
         IF WS-AVERAGE <= .59
               DISPLAY 'E'
         IF WS-AVERAGE <= .66

to
           IF WS-AVERAGE <= .59
               move 'E'    to ...
           else
              IF WS-AVERAGE <= .66
                 ...
              else
                 ...
              end-if
           end-if

The evaluate statement would be much better option though
evaluate true
when WS-AVERAGE <= .59
     move 'E'    to ...
when WS-AVERAGE <= .66
     ...

Getting the Grade to work
In 300- you need to call 400- and move the grade result to the output record
300-PRINT-TOTALS-LINE.
       MOVE WS-TOTAL-ACTUAL TO TL-POINTS-ACTUAL
       MOVE WS-TOTAL-AVAILABLE TO TL-POINTS-AVAILABLE
       MOVE WS-TOTAL-PERCENT TO TL-PERCENTAGE

       perform 400-CALCULATE-LETTER
       move  WS-LETTER              to TL-LETTER-GRADE

       MOVE TOTALS-LINE TO GRADES-RECORD-OUT
       WRITE GRADES-RECORD-OUT AFTER ADVANCING 1 LINES


text:
Q: annotation with parameter for aspect I have an aspect usable with an annotation:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface DumpToFile {

}

And the join point:
@Aspect
@Component
public class DumpToFileAspect {

  @Around("@annotation(DumpToFile)")
  public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {

    ...
    // I likte to read out a parameter from the annotation...
    Object proceed = joinPoint.proceed();

    ...

    return proceed;
  }
}

I can use the aspect successfully on a method with @DumpToFile; however, I would like to pass a parameter to the annotation and retrieve it's value inside my aspect.
Eg. @DumpToFile(fileName="mydump"). Can anybody show me how to do that?

A: Change your @Around to:
@Aspect
@Component
public class DumpToFileAspect {

  @Around("@annotation(dumpToFileAspect)")
  public Object logExecutionTime(ProceedingJoinPoint joinPoint, DumpToFile dumpToFileAspect) throws Throwable {

    ...
    // I likte to read out a parameter from the annotation...
    String fileName = dumpToFileAspect.getFileName();
    Object proceed = joinPoint.proceed();

    ...

    return proceed;
  }
}

A: You should be able to pass the annotation interface to the interceptor method. I haven't tried myself though.
Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface DumpToFile {

      String fileName() default "default value";

}

In DumpToFileAspect -
@Aspect
@Component
public class DumpToFileAspect {

  @Around("@annotation(dtf)")
  public Object logExecutionTime(ProceedingJoinPoint joinPoint, DumpToFile dtf) throws Throwable {

    ...
    // I likte to read out a parameter from the annotation...

    System.out.println(dtf.fileName); // will print "fileName"

    Object proceed = joinPoint.proceed();

    ...

    return proceed;
  }
}

A: You can use this:
 @Around("@annotation(dumpFile)")
  public Object logExecutionTime(ProceedingJoinPoint joinPoint,DumpToFile dumpFile)

Inside the @annotation must be the DumpToFile parameter name.
See the documentation for details


text:
Q: Word Find/Map between Several Columns I have the below data in excel [which contains hundreds of rows]:

I am trying to find/map the words in the column "Form Word" (columnA) against the column "Form Word Orig." (columnC) and retrieve the root word which matches between "Root Results" (columnB) and "Root Results - Multiple Options" (columnD).
Note: The solution needs to find the matching ROOT from the several options (columnD) which are grouped by the Form word (columnC)
The solution would generate results something like this following:

If you could help provide a formula OR Visual Basic based solution I would be grateful.
Thank you in advance.

A: Try the next code, please:
Sub testFind_Mapp_Col()
  Dim sh As Worksheet, arr1 As Variant, arr2 As Variant, i As Long, j As Long

  Set sh = ActiveSheet 'use here your sheet
  arr1 = sh.Range("A2:B" & sh.Range("A" & Rows.count).End(xlUp).Row).Value
  arr2 = sh.Range("C2:E" & sh.Range("C" & Rows.count).End(xlUp).Row).Value

  For i = 1 To UBound(arr1)
    For j = 1 To UBound(arr2)
        If arr1(i, 1) = arr2(j, 1) Then
            If UCase(arr2(j, 2)) = Ucase(arr1(i, 2)) Then arr2(j, 3) = arr1(i, 2): Exit For
        End If
    Next j
  Next i
  sh.Range("C2").Resize(UBound(arr2), UBound(arr2, 2)).Value = arr2
End Sub


text:
Q: How to incorporate an unicode symbol from STIX? I'm trying to import the symbol \leftouterjoin from STIX. I read in the documentation that this symbol is identified as the Unicode U+27D5. I have seen several examples where a symbol is inserted in the following way:
\DeclareFontEncoding{LS2}{}{}
\DeclareFontSubstitution{LS2}{stix}{m}{n}
\DeclareSymbolFont{joins}{LS2}{stixfk}{m}{n}
\DeclareMathSymbol{\LeftOuterJoin}{\mathbin}{joins}{"FF}

However "FF do not correspond with the slot of the symbol \leftouterjoin. The slot "FF defines a different symbol. Is not clear to me how to determine the slot from its Unicode. How can I determine it?

A: To work with pdftex the stix package re-arranges the characters into fonts with 256 characters, so not in Unicode position.
Just copying the definition from stix.sty (if you do not want the whole package) shows the numbers to use

\documentclass{article}

\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix}{m}{n}
\DeclareSymbolFont{symbols2}      {LS1}{stixfrak} {m} {n}
\DeclareMathSymbol{\leftouterjoin}            {\mathop}   {symbols2}{"11}

\begin{document}

$a \leftouterjoin b$

\end{document}


text:
Q: Undefined is not a function when using connect I'm trying to set up a simple HTTP server with connect on the node REPL. I tried the following,
var connect = require('connect');
var http = require('http');

var app = connect()
  .use(connect.favicon())
  .use(connect.logger())
  .use(function(req,res) {
    res.end('Hello World\n');
});

But I get the following error,
TypeError: undefined is not a function
    at repl:1:33
    at REPLServer.defaultEval (repl.js:132:27)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:279:12)
    at REPLServer.emit (events.js:107:17)
    at REPLServer.Interface._onLine (readline.js:214:10)
    at REPLServer.Interface._line (readline.js:553:8)
    at REPLServer.Interface._ttyWrite (readline.js:830:14)
    at ReadStream.onkeypress (readline.js:109:10)

I've already seen this question and answer but it doesn't seem to help. I already made sure that connect was installed in my node_modules directory.
What am I doing wrong?

A: I know why it's not working. Since I'm using version 3.3.5 of connect, they no longer provide certain middleware. They have been removed and you have to hunt for them manually. According to their GitHub readme,

Some middleware previously included with Connect are no longer supported by the Connect/Express team, are replaced by an alternative module, or should be superseded by a better module.


text:
Q: maximum number of arguments postgresql function can take I have a view consists of two table. Let's say table TableA and table TableB.
Now table A has got around 20 columns and table B has go 4 columns.
TableA (
  id datatype,
  uid datatype,
  .
  .
  .
  18 more);

TableB (
  id datatype,
  uid datatype,
  a_id datatype,
  amount datatype,
  CONSTRAINT tablea_tableb_fkey FOREIGN KEY (a_id)
      REFERENCES tablea (id) MATCH SIMPLE
      ON UPDATE RESTRICT ON DELETE RESTRICT,
);

So there is one to many relationship between TableA and TableB. Now I have written the view as follows...
CREATE OR REPLACE VIEW AB AS
 SELECT a.id, a.uid, ..., array_agg(b.amount) AS amounts
   FROM TableA a
   JOIN TableB b ON a.id = b.a_id
  GROUP BY i.id;

Now I want to write insert rule for this view which I am doing by writing a helper function. The function takes around 18 parameters (except id, uid has default value) for inserting into TableA and 1 parameter which is an Array for TableB.
So the total parameters for function is 19. I want to know what is the maximum number of arguments that I can pass to function in postgresql? Is it wise to send this many number of arguments? Is there any better way to write the function for this many number of arguments?

A: FUNC_MAX_ARGS is one compilation parameter (you can change it and recompile), and on my 9.2 source code is 100.
If you have more parameters, then using a arrays is a good idea.


text:
Q: Trying to append text with number I have an ID Cell in my worksheet that is numerical, and used to control row ID. I use the following line of code:
ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 + 1

to increment the ID number each time a new line is inserted. It works well to increment that cell each time when my macro runs, but I would like to append the worksheet Tab Name on the front of the number. That is when my macro shows an (Runtime Error '13', Type mismatch) with the following line:
ActiveCell.FormulaR1C1 = TabName & ActiveCell.FormulaR1C1 + 1

TabName is generated from the following Function:
    Function TabName() As String
     Application.Volatile
     TabName = ActiveSheet.Name
    End Function

Any suggestions how I can get this to work?
Regards,
S Dimm

A: Since you are already using the ActiveCell property you might want to continue down that road with the ActiveSheet property.
ActiveCell = _
  ActiveSheet.Name & Replace(ActiveCell.Value, ActiveSheet.Name, vbNullString) + 1

You have to remove the Workbook.Name property in order to add 1 to the increment then prefix the new number with the worksheet name again.


text:
Q: Grid with 6 Squares in Flutter (2x3)
How can i create this kind of Layout? I failed to do it with 2 Columns and 3 Rows. I want to display 6 Cards or Containters from 1-6 in a Scaffold body. I tried it with this Code and it looks good on my emulator, but on my real phone it creates a space at the bottom. The height is wrong i guess
Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(

          centerTitle: true,
        ),
        body: GridView.count(
          crossAxisCount: 2,
          children: List.generate(6, (index) {
            return CustomContainer(number: index+1,);
          }),
        ));
}

class CustomContainer extends StatelessWidget {
  final int number;
  CustomContainer({@required this.number});

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () => print("Hallo, $number wurde geklickt"),
      onDoubleTap: () => print("Hallo, $number wurde geklickt"),
      child: Container(
        child: Card(
          child: Center(child: Text(number.toString())),
        ),
      ),
    );
  }
}

A: You need to set aspect ratio of GridView widget's child. You can calculate it by dividing item's height by its width and you can get those from MediaQuery class. kToolbarHeight is height of the AppBar and statusBarHeight is height of the status bar
Widget build(BuildContext context) {
    var size = MediaQuery.of(context).size;

    final double statusBarHeight = MediaQuery.of(context).padding.top;
    final double itemHeight =
        (size.height - kToolbarHeight - statusBarHeight) / 4;
    final double itemWidth = size.width / 2;

    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
      ),
      body: GridView.count(
        crossAxisCount: 2,
        childAspectRatio: itemHeight / itemWidth,
        shrinkWrap: false,
        children: List.generate(6, (index) {
          return CustomContainer(
            number: index + 1,
          );
        }),
      ),
   );
}


text:
Q: Relativistic Transverse Doppler Effect In Minkowski spacetime, two observers, $A$ and $B$, are moving at uniform speeds $u$ and $v$, respectively, along different trajectories, each parallel to the y-axis of some inertial frame $S$. Observer $A$ emits a photon with frequency $\nu_{A}$ that travels in the x-direction in $S$ and is received by observer $B$ with frequency $\nu_B$. Show that the Doppler shift $\frac{\nu_B}{\nu_A}$ in the photon frequency is independent of whether $A$ and $B$ are travelling in the same direction or opposite directions.
Relevant equations: $$\frac{\lambda}{\lambda'} = \frac{\nu_B}{\nu_A} = \gamma(1-\beta\cos\theta)$$
Aberration formula:
$$\cos\theta' = \frac{\cos\theta - \beta}{1-\beta\cos\theta} = -\beta$$
(for transverse case)
The answer is apparently that  the Doppler shift is independent of the relative direction of motion. I have tried to transform to the frame $S'$ where $B$ is stationary, finding the velocity of $A$ using the addition of velocities formula - to then get gamma. I have used the abberation formula to insert $\cos\theta'$ into the Doppler shift formula above to get $\frac{\nu_B}{\nu_A} = \gamma(1+\beta^2)$. Plugging in the velocity of the emitter $A$ in frame $S'$ doesn't seem to get the required result.

A: Before answering your question, please be informed that I use the following correct form of your first equation:
$$\nu_B=\nu_A \frac{1+\frac{w}{c}\cos\theta_A}{\sqrt{1-\frac{w^2}{c^2}}}\space ,$$
where $w=\frac{u+v}{1+{uv}/{c^2}}$ is the relativistic velocity of $A$ as measured by $B$. (Assume that $A$ and $B$ recede from each other along $y_A$ and $y_B$.) However, remember that using the aberration formula, we should find the original angle of emission in $A$'s frame of reference, while the emission angle is calculated as $\theta_S=\pi/2$ in $\boldsymbol S$. Therefore, we must consider $A$'s velocity of $u$ WRT $S$, rather than $w$:
$$\cos \theta_A=\frac{\cos \theta_S-\frac{u}{c}}{1-\frac{u}{c}\cos \theta_S}=-\frac{u}{c} \space.$$
Subtituting the second equation in the first one and using $w=\frac{u+v}{1+{uv}/{c^2}}$ implies:
$$\nu_B=\nu_A \frac{1-\frac{wu}{c^2}}{\sqrt{1-\frac{w^2}{c^2}}}=\nu_A × \frac{c^2-\frac{u(u+v)}{1+uv/c^2}}{c\sqrt{c^2-\frac{u^2+v^2+2uv}{(1+uv/c^2)^2}}}=\nu_A \frac{c^2-u^2}{c\sqrt{c^2+\frac{u^2v^2}{c^2}-u^2-v^2}}=\nu_A \sqrt{\frac{c^2-u^2}{c^2-v^2}}\space .$$
As you see, if you change $u$ into $-u$, or $v$ into $-v$, the result remains the same.


text:
Q: image in div doesn't display anything i'm trying to insert an image in a div container using css and html, but it doesn't display any image.
html code:

css:
#quoteContainer {
    color: #898989;
    background:#F9F9F9;
    border: solid 1px #ddd;
    border-radius:10px;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    box-shadow: 0px 0px 10px #888;
    -moz-box-shadow: 0px 0px 10px #888;
    -webkit-box-shadow: 0px 0px 10px #888;
    margin:65px auto;
    padding:15px;
    width:500px;

}

    .start_img {
     background: url(image/img1.png);
     border: dotted 2px black;
     width:200px;
     height:20px;
    }

apart from the img, not even the border shows. i tried using the  tag in html to insert the image inside the div, that doesn't work either. is there anything wrong with the code?

A: That's because a span is an inline element by nature, and won't accept arbitrary width nor height values. You'll have to either make it a block/inline-block element (Wasn't there a question about that yesterday?) or fill it with content.
It would most certainly work with an img element if you set the src property.
And, as already said yesterday, if you want your empty elements to display properly throughout browsers, make sure you fill them with at least an

A: The span element, being an inline element, cannot take a width and a height.
Did you try the following?

A: You need to change the span from being inline:
.start_img {
     background: url(image/img1.png);
     border: dotted 2px black;
     width:200px;
     height:20px;
     display:inline-block;
    }

And put something in the span.

A: if you have in a big content & and they floated give that divs & span float/
When an element cant take width, you have to try add;
display:block;

to your class/
and for your divs;
display:block;
width:204px;
height:24px;

but as Pekka said;

works fine//

A: Maybe you don't have the image uploaded properly? Double check that and all of your syntax because these all seem like reasonable and sensible explanations. You could just do:


text:
Q: Proving $\lim_{r\to 0^+} \frac{r^{\frac{3}{2}}(\ln r +1)^2}{r^2-1} = 0$ What is the shortest (or most elegant) way to prove:
$$\lim_{r\to 0^+} \frac{r^{\frac{3}{2}}(\ln r +1)^2}{r^2-1} = 0$$
I've tried writing it as
$$\lim_{r\to 0^+} \frac{(\ln r +1)^2}{r^{\frac{1}{2}}-r^{-\frac{3}{2}}}$$
and then using L'Hospital rule. Which seems to be working. (after using L'Hospital twice)
Is there a more elegant (or shorter) way to prove this?

A: The limit is $0$ iff the numerator goes to $0$.
FOILing it out you get:
$$r^{3/2}(\ln^2 r+2\ln r+1)$$
which goes to $0$ iff $r^{3/2}\ln^2 r$ does by using the squeeze theorem and the fact that
$$0 \le r^{3/2}(\ln r+1)^2\le 2r^{3/2}\ln^2 r$$
The RHS goes to zero iff $2(r^{3/4}\ln r)^2$ does, i.e. iff $r^{3/4}\ln r$ does.
Here we finally write this as a ratio:
$$\lim_{r\to 0^+} {\ln r\over r^{-3/4}}=-{4\over 3}\lim_{\to 0^+}{r^{-1}\over r^{-7/4}}$$
$$=-{4\over 3}\lim_{r\to 0^+}r^{3/4}=0$$


text:
Q: What are the gains of converting normal method to static? As it is clear from question, if I convert a normal method to static what gains will I made?

A: You will gain clarity, because static makes it clear that the method doesn't depend on an object state. You will also facilitate reusability because static methods may be used in more contexts (i.e. when you don't have an instance of the class).
In general, it's not really a question of gain, it's a question of semantics: does your method depend on the object state? If so, make it non-static. In all other cases, make it static.

A: Apart from the semantic reasons mentioned above, static methods are generally faster (due to not having to create an object to call the method). They are subject to compile-time optimisations and as far as I recall, the CLR also performs some special optimisations on them.

A: Static function normally used for utility stuffs like ConverThisTypeToThatType(), and you can call them without having object of its class.
Ex: MessageBox.Show("Something");
here MessageBox is a Class and Show is static method in it, so we dont need to create object of MessageBox to call Show.


text:
Q: angular2 get component css from backend configuration Is there a way to get component css from the Backend configuration? like liferay
I have a component and this component provides textbox for the user to enter css code. Whatever css user enters in the texbox should reflect in component.
component html

I am h1 tag

I am h2 tag

Editor

Output

Editor

Output

A: No one answered so answering my own question. Actually this is very simple. Just create a style tag and apply css

I am h1 tag

I am h2 tag

component
export class SomeComponent implements OnInit {
  color = 'red';
  ngOnInit() {
    const css = `h2 {color: green} img {background: ${this.color}`; // we can get this css from backend also
    const head = document.getElementById('dynamicStyle');
    const style = document.createElement('style');
    style.type = 'text/css';
    style.appendChild(document.createTextNode(css));
    head.appendChild(style);
  }
}


text:
Q: Classloader Java 11 migration issue I am migrating an app from java 8 to java 11. I did most of the upgrade but got stuck with the following exception.

class com.teamhub.plugins.sitemaps.jobs.SitemapUpdateJob cannot be cast to class org.quartz.Job (com...SitemapUpdateJob is in unnamed module of loader com...utils.ChildFirstClassLoader @bb39957; org.quartz.Job is in unnamed module of loader org.akhikhl.gretty.FilteringClassLoader @247667dd)

The application uses the normal context class loader but it loads plugins into the classpath using the ChildFirstClassLoader which on java 8 worked like a charm. In Java 11 though, it fails.
Looks like the issue is that the parent classloader loaded Job, and the child, ChildFirstClassLoader failes to use that to cast an implemented job.
public class ChildFirstClassLoader extends URLClassLoader {

    private static final Set<String> FORCE_IN_PARENT = new HashSet<String>();  //ImmutableSet.of("");

    private ClassLoader system;

    public ChildFirstClassLoader(URL[] classpath, ClassLoader parent) {
        super(classpath, parent);
        system = getSystemClassLoader();
    }

    @Override
    protected synchronized Class<?> loadClass(String name, boolean resolve)
            throws ClassNotFoundException {
        // First, check if the class has already been loaded
        Class<?> c = findLoadedClass(name);
        if (c == null) {
            try {
                // checking local
                c = findClass(name);
            } catch (ClassNotFoundException | SecurityException e) {
                c = loadClassFromParent(name, resolve);
            }
        }
        if (resolve)
            resolveClass(c);
        return c;
    }

    @Override
    protected Class<?> findClass(String name) throws ClassNotFoundException {
        for (String pkg : FORCE_IN_PARENT){
            if (name.startsWith(pkg)) {
                throw new ClassNotFoundException();
            }
        }

        return super.findClass(name);
    }

    private Class<?> loadClassFromParent(String name, boolean resolve) throws ClassNotFoundException {
        // checking parent
        // This call to loadClass may eventually call findClass
        // again, in case the parent doesn't find anything.
        Class<?> c;
        try {
            c = super.loadClass(name, resolve);
        } catch (ClassNotFoundException | SecurityException e) {
            c = loadClassFromSystem(name);
        }
        return c;
    }

    private Class<?> loadClassFromSystem(String name) throws ClassNotFoundException{
        Class<?> c = null;
        if (system != null) {
            // checking system: jvm classes, endorsed, cmd classpath,
            // etc.
            c = system.loadClass(name);
        }
        return c;
    }

    @Override
    public URL getResource(String name) {
        URL url = findResource(name);
        if (url == null)
            url = super.getResource(name);

        if (url == null && system != null)
            url = system.getResource(name);

        return url;
    }

    @Override
    public Enumeration<URL> getResources(String name) throws IOException {
        /**
         * Similar to super, but local resources are enumerated before parent
         * resources
         */
        Enumeration<URL> systemUrls = null;
        if (system != null) {
            systemUrls = system.getResources(name);
        }
        Enumeration<URL> localUrls = findResources(name);
        Enumeration<URL> parentUrls = null;
        if (getParent() != null) {
            parentUrls = getParent().getResources(name);
        }
        final List<URL> urls = new ArrayList<URL>();
        if (localUrls != null) {
            while (localUrls.hasMoreElements()) {
                URL local = localUrls.nextElement();
                urls.add(local);
            }
        }
        if (systemUrls != null) {
            while (systemUrls.hasMoreElements()) {
                urls.add(systemUrls.nextElement());
            }
        }
        if (parentUrls != null) {
            while (parentUrls.hasMoreElements()) {
                urls.add(parentUrls.nextElement());
            }
        }
        return new Enumeration<URL>() {
            Iterator<URL> iter = urls.iterator();

            public boolean hasMoreElements() {
                return iter.hasNext();
            }

            public URL nextElement() {
                return iter.next();
            }
        };
    }

    public InputStream getResourceAsStream(String name) {
        URL url = getResource(name);
        try {
            return url != null ? url.openStream() : null;
        } catch (IOException e) {
        }
        return null;
    }

    @Override
    public String toString() {
        return String.format("ChildFirstClassLoader [system=%s, getURLs()=%s, getParent()=%s]",
                system, Arrays.toString(getURLs()), getParent());
    }


text:
Q: How do you use grep with man command? I saw a guy how used this command man ssh grep -e "version number" and then got the option printed out for him. But when I do the same command, I get the same result as man ssh. So can the video be outdated and the command looks different now, or did he use some kind of magic?

A: It's likely that the video showed:
man ssh | grep -e "version number"

instead, and the pipe symbol (|) was visually obscured or missed.


text:
Q: three.js: transforming coordinates from camera space to scene space I'm trying to place a cube relative to the camera, rather than relative to the scene. The thing is, to place it in the scene (which I have to do make it show), I have to know the scene coordinates that correspond to the cubes camera space coordinates. I found this function "projectionMatrixInverse" in THREE.Camera. It has a nice function called "multiplyVector3" which I hoped would enable me to transform a vector (1,1,1) back to scene space like this:
var camera, myvec, multvec; // (and others)
camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, - 2000, 1000 );
camera.position.x = 200;
camera.position.y = 100;
camera.position.z = 200;

myvec = new THREE.Vector3(1,1,1);
console.log("myvec: ", myvec);
multvec = camera.projectionMatrixInverse.multiplyVector3(THREE.Vector3(1,1,1));
console.log("multvec: ", multvec);

the thing is, on the console i get:
myvec: Object { x=1, y=1, z=1}
TypeError: v is undefined
var vx = v.x, vy = v.y, vz = v.z;

multiplyVector3 simply doesn't accept my myvec, or says it's undefined, even though the console says it's an object. I don't get it.

A: The camera is located at the origin of it's coordinate system, and looks down it's negative-Z axis. A point directly in front of the camera has camera coordinates of the form ( 0, 0, z ), where z is a negative number.
You convert a point p
p = new THREE.Vector3(); // create once and reuse if you can

p.set( x, y, z );

from camera coordinates to world coordinates like so:
p.applyMatrix4( camera.matrixWorld );

camera.matrixWorld is by default updated every frame, but if need be, you can update it yourself by calling camera.updateMatrixWorld();
three.js r.95

A: This may also be what you're after:
scene.add( camera );

brick.position.set( 0, 0, -1 );
camera.add( brick );


text:
Q: Which versions of the .NET Framework support the System.Threading namespace? Which version of the .NET Framework introduced the System.Threading namespace? Is it possible to use this in a .NET Framework 3.0 application?
Edit: My application depends on the Thread class.

A: The System.Threading namespace has been there since the first version - here is the documentation for version 1.1.
Some of the versions following have added classes and functionality, so it really depends on what you want to use.

A: As far as i know it was present sice Version 1.1. Sure you can!

A: .NET 1.1 introduced this namespace as seen in the documentation.

A: The System.Threading namespace has been there since at least .NET 1.1, so you should be fine using it in a .NET 3.0 application.
Of course, that doesn't mean all of the classes defined within this namespace were there from the beginning, but you don't specify any particular class of interest in your question.

A: The System.Threading namespace has been around since the 1.0 version of .Net was released.
However this probably isn't what you need to be concerned about.  Programs don't take dependencies on namespaces, they take dependencies on types within a namespace.  While the System.Threading namespace has been around since 1.0 many of the types within it didn't appear until later versions.
Could you tell us what type it is that you want to depend on?


text:
Q: How can I beat Al Gore in a fight? Okay. So it seems that the only way to unfriend Al Gore is to beat the crap out of him. Straightforward enough.
Unfortunately, between his boring presentations on Global Warming which put me to sleep, and his trio of very well armed and armored Secret Service personnel, I'm finding that easier said than done. Unfortunately, my various adult and supernatural friends, like Mr. Slave, Jesus, Mr. Hanky, and that dude from the Chinese Restaurant, are unwilling to come to my aid. This leaves me in something of a pickle, as Butters would say.
How do I beat up the Vice President before he and his bodyguards kill me?

A: Stock up on speed potions - If you have the cash to buy a supply of the speed+attack coffee from the Twitch Bros shop, do so, but you'll want all the speed potions you can carry. You'll probably have a sufficient supply of PP restoring potions, but they are also fairly useful, so ensure you have plenty.
First important point, get the timing on blocking the global warming presentation correct. The screwed status it inflicts is largely ignorable (This fight will not last 99 turns, one way or another), but the sleep is utterly debilitating.
The secret to beating heavily armored foes who are beyond your ability to defeat normally, I've found, is to control the flow of battle as much as is humanly possible. Unfortunately, being a boss - Al Gore is immune to some of the best statuses to achieve this. So, every turn drink a speed potion to attack twice. Your buddy, however, should probably be feeding you PP restoration items on his turn.
Use your best Defense Down abilities on your first two attacks against Gore. And follow that up with as much damage and DoT as you can - stacking bleed is awesome if you can do it efficiently. Ideally, once he summons his guards he should be almost dead, to the point where the DoT will finish him off in a turn or two so that you can ignore him.
Lastly, block everything! It sounds obvious, but blocking everything can mean the difference between the guards killing you in one round and two rounds. And two rounds means you have an opportunity to heal. Granted, getting the timing right can be tricky sometimes.
Equipment
Ultimately, what you're wearing and wielding is up to you (Although I recommend at least one of your weapons have an AoE component), but some of the patches/strap-ons are considerably more useful than others.
For weapons (try to avoid any that are already covered by your abilities):

*

*Ice Damage is one of the best things you have, IMHO, as it applies slow to enemies, giving you more free hits (bosses may be immune to slow, I can't remember).

*Bleed can stack up to 5 times dealing devastating DoT, no matter what their armor is.

*Fire and Gross for additional DoT.

Armor:

*

*Have at least one patch that grants PP, go for the one that is likely to be triggered most often.

*The rest are up to you - If you're a fighter, then you may want a +armor patch, because some of your abilities do more damage based on armor, but I honestly find most of the patches lack-luster, providing very little benefit.

Buddies
I found Butters to be the best for this fight; keep using his basic attack until the guards are summoned and then use Professor Chaos. All of the attacks on Professor Chaos's wheel are powerful, but what I found the most useful was the shield, as it gives some much needed breathing room against these well-armed foes.
Kenny's unicorn summon is another great ability; massive damage and bleed - although my success rate for the QTE is about 75%, and being down an ally for a few turns means all the damage is directed at you.
If they are available to you at this point, Jimmy might be able to temporarily sleep the guards, allowing you to focus on Gore, and deal with one enemy at a time. Stan's in-combat buddy command can lower an opponent's defense while still allowing him to attack.
As I mentioned, controlling the flow of battle is critical when you are outclassed. So if your buddy's health is critical, consider switching them out. If they drink a speed potion, they can attack on the first turn and switch out on the second. And even without a speed potion - it saves you from needing to revive them on the next turn - and the switched in buddy has full HP and PP if they haven't been used yet.

A: I finally beat him as a level 8 thief.  I suck at twitch so nothing relying on defense worked for me. What did was:
1- Speed potions for double attacks (backstab on Gore and mug on a guard)
2- First Butters attack: Prof. Chaos (I suck at twitch so I just hoped for one of the 2 helpful attacks: the chaos hammer that stuns them all for one round, or the shield, but if you're good at twitch, go for the shield)
3- After Butters 1st round, he should feed you with a power potion each round until he's very hurt, then bring Kenny (I only had Kenny and Butters).
4- Use Kenny's Unicorn on middle row (guard + Gore). Gore should go down from this by this point.
5- As soon as Gore goes down, do keep the middle guard stunned. Better if you can pull a double attack with stuns on him and another guard.
After this it was just mop up.

A: I just beat this boss last night as a level 9 warrior. Took me a few tries to get this right though. First you need to block that "boring presentation" attack. DON'T LOOK at the screen and instead focus on your characters and you will see the opportunity to block the sleep/screwed attack. After that:

*

*Try and get burn status on the boss as well as 5 bleed (and maybe grossed out if you can manage it) so that he'll continue to drain HP even after his buddies show up (believe me that damage over time will inflict more than your attacks). Customize your weapons so you can accomplish this.

*Once his cronies show up, get burn status on all of them too. If you're using speed potions each round, you should be a be able to hit two per round. You can also

*Once all the buddies are defeated, as a warrior you can use the Charge attack to lower the boss's defense making him much easier to hit.
The idea here is nail those timed hits when it comes to blocking. Using large health potions to keep alive helps a great deal as well. Best of luck (if you haven't beaten him already).

A: I finally beat him using Stan. You have to keep Al Gore bleeding and on fire, and Grossed out if possible, so add those "strap-ons" to your weapons."
Stock up on Speed potions, Large Health Potions, Revive Potions and make sure you have a few Power Potions and Cure Potions.
Make sure that all your weapons have as many add-ons and your costume as many patches as possible.  You want to be as armored as you can.  You and your buddy are going to have to revive each other for several rounds--four strong attacks will take out one of you.  Focus on keeping up the health of at least one of you .  Also, when you get a chance, buy the Perk that makes sure that Revival Potions give you FULL POINTS!
First thing, give your friend a Cure potion, to wake them up!
The Secret Service agents all have high defenses, at first, you will literally take off 1 of their many points for each attack (their points go up with your level, at level ten, the two lower Secret Service had over 1200 points and the highest one had over 2400), there are various special attacks that take down defenses.  I used the Circum-Scythe attack first on each one (my character is a Jew.), then attacked with either Missile of Slowing or Longsword (both with fire additions).  Then Stan used his sword (twice, with Speed Potion).  Butters' hammer didn't seem to work as well, although several people have reported beating Al Gore with Butters as a buddy.
Start with the lower agents and focus your attacks, make sure one is down before you start on the next (This is a good tip in general!).  Finish with Al Gore.  I read on a forum that you have to keep him bleeding, and he does go down relatively fast (300-400 points per round, he starts at over 5000 for a level 10 player).  In the first round, try get Al Gore on fire and/or bleeding.  He will still keep regenerating points, but not as many. Once you focus on him, you want to make sure he doesn't regenerate more points (about a quarter of his HP, I think) than you're taking off of him.
It took me at LEAST 20 tries, probably more to get through this fight.  Good luck.

A: I beat him as a level 11 Jew and I used Cartman as my buddy.
First I would use Circum-scythe to apply 2 stacks of Bleed and Defense Down, then use the curses of Cartman which deal massive electric damages.
When his mobs showed, I used Plague of Egypt and called the frogs rain, the fire rain and the crickets then I used the second spell of Cartman (don't remember the name) to deal massive fire damage to everyone.
From this point I spammed Sling of David and curses to get rid of him.

A: At first try as lvl 9 thief I got down to 1 special agent and suddenly lost like 100% of my health from the "screwed" effect in one turn, and lost, which sucked since I could have won if I just cured myself.
Each other attempt at battling him went from bad to worse, I would die in 2-3 turns...Which means I was extremely lucky the first time.
So luck and reflexes are the key if you want to win in a head to wall situation, if you don't block everything especially concussion grenade, you will die immediately.
Otherwise if you have enough health/armor to survive few turns, you will need a lot of armor reduction, or spells that ignore armor, also try to kill the agent in the middle first since his concussion grenade is far too dangerous, then 2 other agents and lastly Al Gore.

Fortunately I heard of a smarter way to win this, and it is with the use of Jimmy. After encountering elves you will be able to select Jimmy to as your partner (which I haven't noticed for quite some time).

Now once you have him in your party you can go battle Al.
After he calls reinforcements use Jimmy's "lullaby" spell as soon as you can, if you succeed this will put asleep 3 agents leaving you to fight just Al Gore, and pick off agents one by one.
And make sure to use his "Power chord" ability before each lullaby, in order to restore your PP so you can always have enough for Lullaby.

A: If you have the option to use Kyle as your partner use him, I couldn't beat Al Gore without him.
Use Kyles 16pp attack and also use lots of speed potions they help a lot...
This was even harder then the nazi zombie Kenny boss.

A: Do a perfect Nagasaki and you can beat him in one hit.

A: Nagasaki = 1 hit death kill easy


text:
Q: Through 3 dices undistinguishable. Probability that the result has three different result We through 3 not distinguishable dices.
1) What is the probability that 2 dices has same number and the other one a different number ?
2) What is the probability that the three dices has different number.

Attempt
1) I did in two different way. First I say that the first dice has $6$ possibility, the second one, only one possibility and the last one, 5 possibilities. Since there is no order, we multiply by $3!$. At the end, we get $6\cdot 5\cdot 3!$
2) First dice has 3 possibilities, second dice two possibilities and the last one 4 possibilities. Since there is no order, we get $6\cdot 5\cdot 4\cdot 3!$.

I try to do in a different way, I see the problem  i.e. I take as sample space $$\{\{i,j,k\}\mid i\in \{R_1,...,R_6\}, j\in\{G_1,...,G_6\}, k\in \{B_1,...,B_6\} \},$$
where $R_i$ is a red ball with the number $i$, $B_i$ is the blue ball with a number $i$ and $G_i$ is a green ball with the number $i$.
1) To have 3 ball of different color with 2 ball with the same number and one with an other number, I take $\binom{6}{2}$ number. Then I take $\binom{2}{1}$ number and $\binom{3}{2}$ ball. I only have 1 choice for the last ball. To finish, I get $$\binom{6}{2}\binom{3}{2}\binom{3}{2}\binom{2}{1}=6\cdot 5\cdot 3,$$
which is twice less than previous.
2) Same, I take $\binom{6}{3}$ color. Then $\binom{3}{2}$ number and $\binom{3}{2}$ color. Then $\binom{2}{1}$ ball in a color and all other ball are determinated. Finally, I get
$$\binom{6}{3}\binom{3}{2}\binom{3}{2}\binom{2}{1}=6\cdot 5\cdot 4\cdot 3$$
which is also twice less than previous. So why doing like that is wrong ? I don't really see where I loose cases.

A: you have 1 number that is part of a pair, and one number that is not.
And 3 possible orderings.  (xxy, xyx, yxx)
And $6^3$ ways to roll 3 dice.
$\frac {6\cdot 5\cdot 3}{6^3} = \frac {15}{36}$
alternatively we could say that there are
$6\cdot 5 \cdot 4$ ways to roll 3 dice such that none match.
and 6 ways such that all 3 match.
$1 - \frac {6\cdot 4\cdot 3 + 6}{6^3} = 1 - \frac {21}{36} = \frac {15}{36}$

A: Answer to your question (2) is $\frac{\binom{8}{5}}{6^3}=0.259259$, if you consider the results(123,132,231,213,321,312) as same and not different. If you consider these results as different, then the probability is $\frac{120}{216}$
Answer to your question(1) is already given by Doug M


text:
Q: Insert SQL statement not working on button press, but other statements do In the Code below, the 'Insert into Accounting' command does not work, but the Insert command before that and the Update command after does work. Before updating, The user of the program selects a row from a data grid, and the values from the datagrid transfer to the textboxes.
    private void btnUpdate_Click(object sender, EventArgs e)
    {
        if (txtProdName.Text != "" && txtProdPrice.Text != "" && txtProdSupplier.Text != "")
        {
            if (MessageBox.Show("Update Product?", "Update Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                double PricePast = 0;
                double.TryParse(dataSupply.SelectedRows[0].Cells["ProdPriceSupply"].Value.ToString(), out PricePast);
                if (double.Parse(txtProdPrice.Text) != PricePast)
                {
                    int PastQuantity = Convert.ToInt32(dataSupply.SelectedRows[0].Cells["ProdQuantitySupply"].Value);

                    DateTime ProdPriceDate = DateTime.Now;
                    string ProdPriceDateString= ProdPriceDate.ToString("MM-yyyy");
                    con.Open();
                    cmd = new SqlCommand(@"insert into Prices
                                        (ProdIDPrice,PriceDate,PastPrice,PriceQuantity,PriceDateMonth)
                                                Values
                                        ('" + txtProdID.Text + "','" + ProdPriceDate + "','" + PricePast + "','"+PastQuantity+"','"+ProdPriceDateString+"');", con);

                    cmd.ExecuteNonQuery();
                    con.Close();

                    con.Open();
                    cmd = new SqlCommand(@"Insert into Accounting
                                    (AcctTotalPrice,AcctDateMonth,AcctQuantity)
                                     VALUES
                                     ('" + txtProdPrice.Text + "','" + ProdPriceDateString + "','1')", con);
                    cmd.ExecuteNonQuery();
                    con.Close();

                    con.Open();
                    cmd = new SqlCommand(@"Update Supply Set ProdConstantQuantity = 1, ProdQuantity = ProdQuantity + '"+PastQuantity
                                          +"' where ProdID = '"+txtProdID.Text+"';", con);
                    cmd.ExecuteNonQuery();
                    con.Close();
                }

A: Make the value '1' for AcctQuantity an integer 1 instead of it being inside quotes.


text:
Q: WindowsIdentity Token in Legacy ASP I've created a .Net library at work that is used by all of our developers. The security part of it uses Microsoft AzMan for the security backend. In order to create a security (AzMan) ClientContext I have to pass it a token value (as a uint). This is all fine an dandy until I needed to make a COM wrapper for our common library so some of our legacy pages could take advantage of it without being rewritten for now.
I cannot figure out how to get the token value to pass to AzMan from legacy ASP. The COM wrapper is setup to run as a COM Server and runs as a specific  user that we use here for all COM objects, therefor the common library can't just pull the identity using .Net.
Any ideas?

A: Are you using anonymous logons in the IIS configuration? If you use Windows Authentication and do the following in classic ASP you should get the logged on user:
Request.ServerVariables("LOGON_USER")

A: In classic ASP you have to get the token from an external COM object.
It has been a long time since I have dealt with classic ASP... but someone on here who has dealt with impersonation in classic ASP might have some code snippet that they can share.

A: If your not able to get to token, you could always use the IAzApplication.InitializeClientContextFromName while retrieving the user name from the request in your asp page and passing it to your com+ component.
http://msdn.microsoft.com/en-us/library/aa377363(VS.85).aspx


text:
Q: NextJS app deployed on Vercel: unable to complete requests from APIs - How to use own API endpoints? I've tried deploying my NextJs app to Vercel and have faced quite some issues. And now I feel stuck again.
I am able to fetch all my data from my DB (MongoDB)successfully, using getStaticProps on the components and fetching right away from the DB. But I am having issues making any API requests to interact with the DB.
Everything works fine when I work locally running npm run dev but not when I try to run it on the Vercel server.
My env variables seem to be returning the right addresses to apply the API requests though.
Anytime I try to attempt a request (POST, DELETE, PATCH...) it fails. It is showing me now the error:

I have looked into adjusting my headers to enable CORS following this docs: https://vercel.com/guides/how-to-enable-cors
I have both created a next.config.cjs file as indicated, and also tried to add a middleware to my handler.
I am using axios to make the requests. And this is how I make them.
axios.defaults.baseURL =
    process.env.NODE_ENV === "development" ?
        "http://localhost:3000"
        : `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`;

export const createBeer = (beerData: NewBeerData | NewBeerData[]) => axios.post('/api/beers', beerData);

export const getAllBeers = () => axios.get<BeerData[]>('/api/beers');

export const updateBeerData = (beerID: string | ObjectId, beerData: BeerData) => axios.patch(`/api/beers/${beerID}`, { ...beerData });

export const deleteBeer = (beerID: string | ObjectId) => axios.delete(`/api/beers/${beerID}`);

For example, on the Edit form, I will call the updateBeerData function inside the component after receiving the data from the form.
I have defined my API routes inside my /api folder as recommended for a NextJS app. I defined a file to handle all routes as such:
/pages/api/beers/[[...params]].ts
import { ObjectId } from "mongodb";
import { NextApiRequest, NextApiResponse } from "next";
import clientPromise from "../../../../lib/mongodb";
import type { BeerData, NewBeerData } from "../../../types/beers";

// base default url here?

const allowCors = (fn: any) => async (req: any, res: any) => {
    res.setHeader('Access-Control-Allow-Credentials', true);
    res.setHeader('Access-Control-Allow-Origin', '*');
    // another common pattern
    // res.setHeader('Access-Control-Allow-Origin', req.headers.origin);
    res.setHeader('Access-Control-Allow-Methods', 'GET,OPTIONS,PATCH,DELETE,POST,PUT');
    res.setHeader(
        'Access-Control-Allow-Headers',
        'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version'
    );
    if (req.method === 'OPTIONS') {
        res.status(200).end();
        return;
    }
    return await fn(req, res);
};

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
    const client = await clientPromise;
    // creates and use a db called "test"
    const db = client.db();
    const collection = db.collection("beers");
    // console.log('params', req.params);
    // console.log('req.query', req.query);
    // console.log('req.body', req.body);
    console.log(" ~ file: index.ts:16 ~ handler ~ req.method", req.method);

    switch (req.method) {
        case 'GET':
            try {
                const beers = await collection.find({}).toArray();
                // console.log(" ~ file: index.ts:15 ~ handler ~ beers", beers);
                res.status(200).json(beers);
            } catch (error) {
                console.log(" ~ file: index.ts:22 ~ handler ~ get error", error);
                res.status(500).json({ message: 'Error fetching beers' });
            }
            break;
        case 'POST':
            const newBeers: NewBeerData | NewBeerData[] = req.body;
            try {
                const result = await (Array.isArray(newBeers)
                    ? db.collection('beers').insertMany(newBeers)
                    : db.collection('beers').insertOne(newBeers));

                res
                    .status(201)
                    .json(result);
            } catch (error: any) {
                console.log(" ~ file: index.ts:36 ~ handler ~ post error", error);
                res.status(500).json({ message: 'Error adding new beers' });
                throw new Error(error).message;

            }
            break;
        case 'PATCH':
        case 'patch':
            // case 'PUT':
            try {
                // const { _id } = req.body;
                const updateData = req.body;
                delete updateData._id;
                const [id] = req.query.params as string[];
                // console.log('req.query.param', req.query.params);
                // console.log(" ~ file: [[...params]].ts:55 ~ handler ~ id", id);
                // console.log(" ~ file: index.ts:49 ~ handler ~ _id", _id);
                await collection.updateOne({ _id: new ObjectId(id) }, { $set: { ...req.body } },
                    // {
                    // new: true,
                    // }
                );

                const beer = await collection.findOne({ _id: new ObjectId(id) });
                // console.log(" ~ file: index.ts:53 ~ handler ~ beer", beer);
                res.status(200).json(beer);
            } catch (error) {
                console.log(" ~ file: index.ts:49 ~ handler ~ patch error", error);
                res.status(500).json({ message: 'Error updating beer' });
            }
            break;
        case 'DELETE':
            try {
                const [_id] = req.query.params as string[];
                const beer = await collection.deleteOne({ _id: new ObjectId(_id) });
                // console.log(" ~ file: [[...params]].ts:76 ~ handler ~ beer", beer);
                res.json(beer);
            } catch (error) {
                res.status(500).json({ message: 'Error deleting product' });
            }
            break;
        default:
            // res.status(405).end();
            res.status(405).json({ message: 'Method not allowed' });
            break;
    }
}

module.exports = allowCors(handler);

Before, and after making those 2 CORS (config  file and the middleware) change, I am still getting the same error. They all seem to go to the default case and return a 405 error: Method not allowed
I am not sure what I am doing wrong or missing. How can I use my API endpoints on the production environment, on Vercel?

A: Alright. A simple fix to this headache.
Basically the use of the VERCEL system environment variables were not the right one to use for my app to work. As they add the deployment id in the URL, and this does not work to fetch your own APIs apparently.
the PRODUCTION_URL should be one we set, and not use their default one.
For instance:
PRODUCTION_URL = https://<project-name>.vercel.app

and don't use NEXT_PUBLIC_VERCEL_URL
It fixed my issue, now I can interact with the app in production mode.