text:
Q: Finding the coordinates of a perpendicular bisector Okay, so in the question, I think I understood part $a$ and $b$ (although I'm not sure) and for part $c$ I'm getting a bit confused.
Question:
The line 1(1) passes through the points $P (−1, 5)$ and $Q(11, 11)$.
(a) Find an equation for $11$ in the form $y = mx + b$ where $m$ and $c$ are constants.
The line L(2) passes through the point $R(9, 0)$ and is perpendicular to $11$ . The lines 1(1) and 1(2) intersect at the point $S$.
(b) Calculate the coordinates of S.
(c) Show that the length of $RS$ is $\sqrt{80}$.
Okay, so for part a I got: $2y=x+5$ part b: the gradient will be $-2$ then $y-0=-2(x-9)$, giving me $y=−2x+18$, giving me the coordinates $(9, 18)$ part c: for this part, would I just get the point $R$ and point $S$ and use the equation of the distance of a line?
I think I know the theory but for some reason I can't get it right. Can you explain please? It would be greatly appreciated. Thanks!

A: @Debby
Your part a) is wrong, please check your calculations.
$ y=\frac{x+11}{2} $
for the equation that passes through the points. Can you get m and b?
Use the slope from the last question and get the negative reciprocal of it. The equation that passes through (9,0) and is perpendicular to the first one is:
$ y=-2 x+18$
The point of intersection of those two equations is done by solving them simultaneously you will get (5,8). Please work through that on your own.
For c)
You use the distance formula, you will get:
$ 4 \sqrt{5} = \sqrt{80}$


text:
Q: What's the best way to deal with dead branches in TFS? In TFS, what is the best way to mark dead branches?  Do you move your branch?  Branch release it?  Delete it?  Rename it?  What problems have you run into for each of these approaches?  What are the good points?
It would be nice if there were a simple interface solution that would simply mark or filter the current view if a particular branch was tagged as dead.  That way you wouldn't have to do something permanent like rename or delete a branch . . .

A: Deletion isn't permanent, so I'd go with this option.
You can then opt whether or not to view deleted items in SCE (Tools -> Options -> Source Control -> Visual Studio Team Foundation Server -> Show deleted items in the Source Control Explorer).
And you can choose to undelete the branches if necessary.

A: After merging back to the trunk we do delete them much easier than having to cloak them in workspaces, see Ian's about deletes not being permanent.

A: We move our dead branches to an archive area of the project.

*

*Because the branches are cheap in
TFS, there is not a space concern.

*Deletion can cause bizarre problems when someone attempts to add something new with the same name.

*Moving them enables continued use of features like Annotate (a.k.a. blame), which allows drilling through branches to see a full history of changes.

redpajama_set_name: RedPajamaStackExchange


text:
Q: If statement won't work inside a while loop This is my first post so sorry for any misunderstandings you may have, I made this calculator in C++ and it worked wonderful so I decided to make it in java. When I run the program it gives me no errors but my if statements inside my while loop don't work
import java.util.Scanner;

public class ohmlaw
{
    public static void main(String args[])
 {
    float current;
    float resistance;
    float voltage;
    String calchoice = new String();
    Scanner cc = new Scanner(System.in);
    System.out.println("OHMCAL, OHM'S LAW CALCULATOR BY RASHAAD BRYAN");
    System.out.println();
    System.out.println();
    System.out.println();
    System.out.println("Instructions");
    System.out.println("If you want to calculate the voltage type voltage");
    System.out.println("If you want to calculate the current type current");
    System.out.println("If you want to calculate the resistance type resistance");
    System.out.println("If you want to stop the program type stop");
    System.out.println();
    System.out.println();
    System.out.println();
    System.out.print("Please enter calculation choice ");
    calchoice = cc.nextLine();
    System.out.println();
    while (calchoice != "stop")
    {
        if (calchoice == "current")
        {
            System.out.print("Please enter voltage (V) ");
            voltage = cc.nextFloat();
            System.out.println();
            System.out.print("Please enter resistance () ");
            resistance = cc.nextFloat();
            System.out.println();
            current = voltage/resistance;
            System.out.println("The current is = " + current  + "A");
            System.out.println();
        }
        if (calchoice == "voltage")
        {
            System.out.print("Please enter current (V) ");
            current = cc.nextFloat();
            System.out.println();
            System.out.print("Please enter resistance () ");
            resistance = cc.nextFloat();
            System.out.println();
            voltage = current * resistance;
            System.out.println("The voltage is = " + voltage  + "V");
            System.out.println();
        }
        if (calchoice == "resistance")
        {
            System.out.print("Please enter Voltage (V) ");
            voltage = cc.nextFloat();
            System.out.println();
            System.out.print("Please enter current (I) ");
            current = cc.nextFloat();
            System.out.println();
            resistance = voltage/current;
            System.out.println("The resistance is = " + resistance  + "");
            System.out.println();
        }
        System.out.print("Please enter calculation choice ");
        calchoice = cc.nextLine();
        System.out.println();
        System.out.println();
    }
    System.out.println("Thank you for using OHMCAL, have a nice day :D");
    System.out.println();
}

}

A: Comparing strings in Java using == doesn't do what you want. Use calchoice.equals(...) instead.

A: just use .equals() instead of ==


text:
Q: Script to keep the latest 5 files and rest will be moved to other destination Source path:
/var/log/
Here I have 4 folders named ad1nrld,ad2nrld,icp1rmnrl,icp2rmnrl
I can move all the files to the other destination named /home/spsy/logs_bkp. But I want to keep latest 5 files in each folders (ad1nrld,ad2nrld,icp1rmnrl,icp2rmnrl) of this /var/log path and rest will be moved to /home/spsy/logs_bkp path.
At source path,
/var/log/ad1nrld - Only latest 5 files will be present and rest will be moved to /home/spsy/logs_bkp/ad1nrld path
I have tried the below code for moving the files and they are successfully moved. But I am unable to keep latest 5 files in the respective folders.
for i in `ls -1rt | egrep 'nrld|mnrl'`
do
cd $i
mv *log /home/spsy/logs_bkp/$i
echo "files moved for &i"
cd ..
done

The below part is not working while I am adding the code to keep latest 5 files.
for i in `ls -1rt | egrep 'nrld|mnrl'`
do
cd $i
count_files=`ls -lrt | wc -l`
if [ $count_files -gt 5 ];
then
tomove=$(($count_files-5))
for part in `ls -1rt`
do
if [ $tomove -gt 0 ]
then
mv $part /home/spsy/logs_bkp/$i
tomove=$(($tomove-1))
echo "files moved for &i"
cd ..
fi
done
fi
done

A: zsh is generally available on Solaris unless you installed a stripped down version of it, so you should be able to do:
#! /usr/bin/zsh -
src=/var/log dst=/home/spsy/logs_bkp
dirs=(ad1nrld ad2nrld icp1rmnrl icp2rmnrl)

ret=0
for dir ($dirs) () {
  if (( $# > 5 )) mv -- $@[6,-1] $dst/$dir/ || ret=$?
} $src/$dir/*(N.om)
exit $ret

That uses the om glob qualifier to order the glob expansion (only regular files with the . qualifier) by modification time (from youngest to oldest like ls -t does). Add the D qualifier if you also want to consider hidden files.
That glob expansion is passed to an anonymous function which moves the 6th to last files as long as there are more than 5 in the directory, doing it for each $dir in $dirs.
With ksh or other shells, without glob qualifiers the difficult part is to order the list of files by modification time and restrict to regular files only.
ls -t will sort by modification time, but you can't easily reconstruct the list of files from its output unless you can guarantee  file names won't contain newline characters. If you're in such a special case, you can do:
#! /bin/sh -
src=/var/log dst=/home/spsy/logs_bkp
dirs='ad1nrld
ad2nrld
icp1rmnrl
icp2rmnrl'

IFS='
' # split on newline only
set -o noglob # disable globbing so we can use split+glob to split.

ret=0
for dir in $dirs; do # split+glob to split $dirs
  set --
  for file in $(ls -t -- "$src/$dir/"); do # split+glob to split ls output
    [ -f "$file" ] && [ ! -L "$file" ] && set -- "$@" "$src/$dir/$file"
  done
  if [ "$#" -gt 5 ]; then
    shift 5
    mv -- "$@" "$dst/$dir/" || ret="$?"
  fi
done
exit "$ret"

A: Version, that does not rely on parsing ls, but uses find and \0 as line terminator:
(As you're using Solaris, and this uses GNU extensions, this might not be possible for you, but might be useful for others).
dirs=(ad1nrld ad2nrld icp1rmnrl icp2rmnrl)
for dir in "${dirs[@]}"; do
    find "$dir" -maxdepth 1 -type f -printf '%T@\t%p\0' \
      | sort -rnz \
      | tail -z -n+6 \
      | cut -z -f2- \
      | xargs -r0 mv --backup=numbered -t logs_bkp/
done

A: Script is working. I have 4 folders named ad1nrld,ad2nrld,icp1rmnrl,icp2rmnrl in /var/log path. Script will keep latest 5files in the respective folders and rest will be moved to the respective folders of the /home/spsy/logs_bkp path.
This is the code.
cd /var/log
for i in `ls -1rt | egrep 'nrld|mnrl'`
do
cd $i
count_files=`ls -lrt | wc -l`
if [ $count_files -gt 6 ];
then
tomove=$(($count_files-6))
for part in `ls -1rt`
do
if [ $tomove -gt 0 ]
then
mv $part /home/spsy/logs_bkp/$i
tomove=$(($tomove-1))
fi
done
cd ..
fi
done


text:
Q: How to use java object in JavaScript engine in java8 I want to use java object in javascript engine but not able to do and getting exception: javax.script.ScriptException: :1:11 Expected ; but found <
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
Object map = engine.eval("var HashMap<String,String> = Java.type('java.util.HashMap<String,String>()');" +
                      "var map = new HashMap();" +
                      "map.put('key1', 'value1');" +
                      "map.put('key2', 'value2');" +
                      "map.put('key3', 'value3');" +
                      "map");
            System.out.println(map);

A: Try with this code, normally it works.
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
Object map = engine.eval("var HashMap = Java.type('java.util.HashMap');" +
            "var map = new HashMap();" +
            "map.put('key1', 'value1');" +
            "map.put('key2', 'value2');" +
            "map.put('key3', 'value3');" +
            "map");
System.out.println(map);

The problem was in the first line of the script:
var HashMap<String,String> = Java.type('java.util.HashMap<String,String>()');

instead of
var HashMap = Java.type('java.util.HashMap');

But you also can inject a map to your script and manipulate it on the script like this:
Map<String, String> map = new HashMap<>();
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
engine.getContext().getBindings(ScriptContext.GLOBAL_SCOPE).put ("map", map);
engine.eval("map.put('key1', 'value1');" +
            "map.put('key2', 'value2');" +
            "map.put('key3', 'value3');");
System.out.println(map);


text:
Q: Find eigenvalues of Complex valued matrix in python I need to find the eigenvvalues of of this matrix, and similar such matrices (spaces denote separators):
[[1.0000 -0.7071*I 0 -0.7071*I 0 0 0 0 0]
 [0.7071*I 0.5000 -0.7071*I 0 -0.70710*I 0 0 0 0]
 [0 0.7071*I 1.0000 0 0 -0.7071*I 0 0 0]
 [0.7071*I 0 0 0.5000 -0.7071*I 0 -0.7071*I 0 0]
 [0 0.7071*I 0 0.7071*I 0 -0.7071*I 0 -0.7071*I 0]
 [0 0 0.7071*I 0 0.7071*I 0.5000 0 0 -0.7071*I]
 [0 0 0 0.7071*I 0 0 1.0000 -0.7071*I 0]
 [0 0 0 0 0.7071*I 0 0.7071*I 0.5000 -0.7071*I]
 [0 0 0 0 0 0.7071*I 0 0.7071*I 1.000]]

Error:
numpy.linalg.eigvalsh() gives error "can't convert complex to float".
What could be the reason, and how do I find eigenvalues?

A: As more than one commenter has explained, your matrix works fine with eigvalsh.
import numpy as np
from numpy.linalg import eigvalsh

I = 1j
arr = np.array([[1.0000, -0.7071*I, 0, -0.7071*I, 0, 0, 0, 0, 0],
    [0.7071*I, 0.5000, -0.7071*I, 0, -0.70710*I, 0, 0, 0, 0],
    [0, 0.7071*I, 1.0000, 0, 0, -0.7071*I, 0, 0, 0],
    [0.7071*I, 0, 0, 0.5000, -0.7071*I, 0, -0.7071*I, 0, 0],
    [0, 0.7071*I, 0, 0.7071*I, 0, -0.7071*I, 0, -0.7071*I, 0],
    [0, 0, 0.7071*I, 0, 0.7071*I, 0.5000, 0, 0, -0.7071*I],
    [0, 0, 0, 0.7071*I, 0, 0, 1.0000, -0.7071*I, 0],
    [0, 0, 0, 0, 0.7071*I, 0, 0.7071*I, 0.5000, -0.7071*I],
    [0, 0, 0, 0, 0, 0.7071*I, 0, 0.7071*I, 1.000]])

# Ensure hermitian
assert(np.all(0 == (arr - np.conj(arr.T))))

print(eigvalsh(arr))
# outputs:
# [-1.56153421 -0.2807671  -0.2807671   0.5         0.5         1.          1.7807671  1.7807671   2.56153421]

A: In numpy you get this for free
import numpy as np

matrix = np.array([[1+1j,0+1j],[0+1j,1+1j]])
eingenvalues,eigenvectors=np.linalg.eig(matrix)

will give you both, eigenvalues and corresponding eigenvectosr
If you are really only interested in the eigen values you can use
eingenvalues=np.linalg.eigvals(matrix)


text:
Q: Why is the Wordpress update_option not working in this code? I am writing a Wordpress plugin that uses an array as an option but the new value is never set when I run update_option function.  The first time this runs last_updated is a new element in the array but when I output the before update and after update values to the error_log I can see that the element last_updated has not been added to the option.  Any help into what I am doing wrong here would be greatly appreciated!  Thanks!
$coupon_grab_options = get_option( 'coupon_grab_option' );

// Output the current version of coupon_grab_option
error_log( print_r( $coupon_grab_options, true ), 0);

$last_updated = $coupon_grab_options['last_updated'];

$request = wp_remote_get('http://codes.clipncrazy.com/lastupdated.php');
$response = wp_remote_retrieve_body( $request );

// Update the coupon_grab_option with the latest last_updated value
if( $last_updated != $response ) {
    $coupon_grab_options['last_updated'] = $response;
    update_option( 'coupon_grab_option', $coupon_grab_options );
}

$coupon_grab_options = get_option( 'coupon_grab_option' );

// Output the updated version of coupon_grab_option
error_log( print_r( $coupon_grab_options, true ), 0);


text:
Q: jQuery remove() is not working Here is source:
function updateMsg() {
    $.post("AjaxChatServer.jsp",{ time: timestamp }, function(xml) {
        alert("1");
        $("#loading").remove();
        addMessages(xml);
    });
    setTimeout('updateMsg()', 4000);
}

that alert function is not working, but outside of function(xml), alert is working.
Does jQuery source has a problem?

A: Change:
setTimeout('updateMsg()', 4000);

to:
setTimeout(updateMsg, 4000);

Also note that in the posted code, timestamp is undefined and you should put setTimeout outside of the function's scope.

A: If your success callback is not triggering, it is most likely because the request was unsuccessful. See the .post() documentation. I would suggest using the more full-featured .ajax() to have more control over the situation.
function updateMsg() {
    // You must define timestamp
    var timestamp = $.now();
    $.ajax({
        url: "AjaxChatServer.jsp",
        type: "POST",
        data: {
            time: timestamp
        },
        success: function (xml, textStatus, jqXHR) {
            $("#loading").remove();
            addMessages(xml);
        },
        error: function (jqXHR, textStatus, errorThrown) {
            // Handle error
            alert(textStatus);
        }
    });
}

setTimeout(updateMsg, 4000);

A: I think you maybe have problem with the ajax - error somewhere.
try to add .error and .success in the end of the post function to see the error.

function updateMsg() {

$.post("AjaxChatServer.jsp",{ time: timestamp }, function(xml) {
  alert("1");
  $("#loading").remove();

 addMessages(xml);
})  .error(function(){
        alert("error");
     })  .success (function(){
        alert("error");
     );

A: Your variable "timestamp" is declared?
Try :
function updateMsg() {
    var date = new Date(), timestamp = date.getTime();

    $.post("AjaxChatServer.jsp",{ time: timestamp }, function(xml) {
       alert("1");
       $("#loading").remove();

       addMessages(xml);
    });
}


text:
Q: transmission of call logs in the background using a service I am trying to implement a background service to transmit logs from a calllog database to a server and I have tried out a lot of things ... timer, a thread Looping infinitely... but it seems nothing works... the following program could be loop of timer... but both of them fail on some of the phones... Both of the implementations follow the same methodology but a different implementation(Obviously)... so my question is am i NOT checking out some condition that is causing this fault of not being able to send data .... i understand that the data stops sending when in sleep but almost all the phones resume data transmission but some dont ....
The programming structure .
    public class BootableService extends Service{
           @Override
           public IBinder onBind(final Intent intent) {

                  return null;
           }
           @Override
           public void onCreate() {

                  super.onCreate();
                  // use this to start my infinite thread here which is initialised inside this service class
           }
           @Override
           public void onStart(final Intent intent, final int startId) {

                 //Use this to start a telophony listener that respond to call state and add the call from the call log to a blocking queue ....

                 telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

                 // Create a new PhoneStateListener
                 listener = new PhoneStateListener() {

                        @Override
                        public void onCallStateChanged(int state, String incomingNumber) {

                            switch (state) {

                                case TelephonyManager.CALL_STATE_IDLE:
                                     System.out.println("phone IDLE");
                                     // calls a function to add the events to a queue. that have not been sent already.
                                     addtoQueue();
                                     break;
                                case TelephonyManager.CALL_STATE_OFFHOOK:
                                   System.out.println("Phone in use");
                                   break;
                                case TelephonyManager.CALL_STATE_RINGING:
                                   System.out.println("Phone Ringing");
                                       break;
                            }

                        }
                 };
                 // Register the listener wit the telephony manager
                 telephonyManager.listen(listener, PhoneStateListener.LISTEN_CALL_STATE);
          }
          addToQueue()
          {
             //add to the queue add the call log not already transmitted to the server.
          }

          class handler HandleStuff{

               this handles the data coming from the thread .,,,, the ID of the record sent. straight from the Android call log database.  and store it.
          }

          Class ThreadRunning extends thread{

                run(){
                     while(true){
                         // This implements take the elements from the queue if present
                         transmit 1 record///
                         sleep(20 seconds.)
                     }
                }
         }
}

the logic is triggered only once. when the phone gets started or when the app is installed/opened. if the service is not already opened.

A: Why not just use an IntentService. That way you don't have to deal with all of the threading. All of your code you put in your onHandleIntent() method will be done on a seperate thread and you can take as long as you want.


text:
Q: bootstrap top nav sub menu links do nothing but right click does I inherited this project. It has a navbar fixed to the top of each page and a  bootstrap navbar-brand link on the left top. This works fine.
It also has a side-nav that works and all its dropdown links work.
However, the right top menu items, all dropdowns, do nothing except drop down. Clicking on sub-items do nothing. But if you right click and open in a new tab they work fine.
Also if you enter the link that shows when you hover into the browser, it works.
Here is an example:

     {{ Auth::user()->username }}

         Log Out

bootstrap files come after jQuery files both css and js. All are in the header and even putting js at the end of the body changes nothing.
Here is the head:

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="">

  <title>RPM</title>

  <link rel="stylesheet" href="http://localhost/rpm/public/js/jquery-ui/jquery-ui.min.css">

  <link href="http://localhost/rpm/public/css/bootstrap.min.css" rel="stylesheet">

  <link href="http://localhost/rpm/public/css/bootstrap-switch.min.css" rel="stylesheet">

  <link rel="stylesheet" href="http://localhost/rpm/public/css/datepicker.css">

  <link rel="stylesheet" href="http://localhost/rpm/public/css/bootstrap-dropdown-checkbox.css">

  <link href="http://localhost/rpm/public/css/sb-admin.css" rel="stylesheet">
  <link href="http://localhost/rpm/public/css/site.css" rel="stylesheet">

  <link href="http://localhost/rpm/public/css/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

Edit: Yep, it works ok by itself.
here is the entire code with top and side menus:

    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
      Toggle navigation

    </button>
    RPM

{{ Auth::user()->username }}

 Yesterday at 4:32 PM

Lorem ipsum dolor sit amet, consectetur...

          Read All New Messages

          Alert Name Alert Badge

          Alert Name Alert Badge

          Alert Name Alert Badge

          Alert Name Alert Badge

          Alert Name Alert Badge

          Alert Name Alert Badge

          View All

         {{ Auth::user()->username }}

           Profile

           Inbox

           Settings

             Log Out

           Dashboard

           Reservations

            Search

            New reservation

            Charges

           Calendar

           Properties

           Reports

            Arrivals

            Departures

            Cancellations

            Daily

            Deposit

            Management

            Owner

            Rental

            Summary

            Tax

            Transactions

           Management

               Owners

               Rates

               Amenities

               Extras

               Discounts

               Cleaners

               Taxes

               Sources

               Guests


text:
Q: Github Markdown for different font colors Except using CSS and git diff is there a way to change the font color of the text in Github Readme or Comments.

A: GitHub does not allow you to control the font color of anything that's rendered on a page, whether that's a README, an issue comment, a pull request comment, or elsewhere.  There are a couple reasons for this.
First of all, spammers and other people trying to engage in abuse will try to hide text by using a font color that's identical or very similar to the page background.  GitHub does not want to encourage spam and abuse.
Second, allowing users to set the font color creates accessibility problems, since users can set fonts that are difficult for some people to see due to low contrast.  GitHub is legally and ethically required to consider accessibility in its interface.
Third, it prevents GitHub from creating new styles or features like a potential dark mode.  Colors that might look fine on a light background would be impossible to see clearly on a dark background.
Even CSS doesn't work here; GitHub filters all content rendered on the interface to strip out anything that might be harmful or problematic.


text:
Q: Change format spacing in division equation Is there any way to change the formatted spacing of an equation with a division? Something similar to LineSpacing for text formatting, but which makes equations more compact. I'm hoping to not lose the traditional formatting of other parts of the equation.
Hopefully, these two snippets should explain what sort of thing I'm hoping for.
TraditionalForm[A/B]
Style["A\n\[LongDash]\nB", LineSpacing -> {0,7}]


text:
Q: Simple XML - Handle empty string to type conversion I am trying to use the Simple framework to deserialize some data provided by a third-party provider into Java objects. The incoming data is POST-ed to an HTTP server, and from there my code needs to take over.
The XML looks like this:
<SomeElement attrib1="foo" attrib2="1337" attrib3="" />

There are many more attributes - nearly 50 of them.
My Java class is:
public class SomeElement {
    @Attribute private String attrib1;
    @Attribute private int attrib2;
    @Attribute(required=false, empty="0") private int attrib3;
}

This does not parse, though. I get:
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.valueOf(Unknown Source)
    at org.simpleframework.xml.transform.IntegerTransform.read(IntegerTransform.java:55)

It is not clear to my how I can get Simple XML to parse "" correctly to something usable. I am probably missing some magic incantation of the annotations, but I can't find anything in the documentation.

A: If all fails, implement a Converter for the element.
Here are two examples how to do this (related to null / empty elements):

*

*Simpleframework. Can nulls be retained in collections?

*Empty entry in ElementList SimpleXML


text:
Q: When targeting a Picture element in CSS, should we use img or picture selector? So the new Picture element looks like this:
<picture>
  <source ... />

</picture>

In our CSS, we want to set say a background color.
picture {background-color: red};
img {background-color: yellow};

Will a Picture enabled browser just show a red background, while non enabled browsers show a yellow background? Or a combination of the two.  Likewise, will an Picture enabled browser see the height/width attributes on the img element, or is the img element ignored completly?

A: The idea of the picture element is that that it simply provides source information for its enclosed img element, and that it is always the img element that is rendered, not the picture element.
However, I can't see anything normative in the spec that suggests that the picture element will be treated by default as anything other than an inline element, so I expect that you will be able to style it with a different display setting, give it padding etc., in the same way as you can do with span elements, in which case, the background-color will behave in the same way as a span element around an img element does today.
So targeting both might be appropriate. The backgrounds will simply layer as normal. But the img will be rendered, so in your scenario, the background behind the image will be yellow, assuming of course that the img has at least some degree of transparency.

A: Since no browser supports it, guess we'll need to wait to see the implementation, but by the looks of it so far, and according to current docs, it seems img tag will be completely ignored and only used as fallback.
The new implementation is as follows:
<picture>
   <source media="(min-width: 64em)" src="high-res.jpg">
   <source media="(min-width: 37.5em)" src="med-res.jpg">
   <source src="low-res.jpg">

Accessible text.

</picture>

since you'll need to define the images inside <picture> element as sources and you won't have an img tag, implementation in browsers with Picture implementation shouldn't recognize anything inside an img tag unless the media src isn't defined.
However, it's easy to see this approach will cause a double download of images since browsers download all  tags first. Because of this, there's a proposal by David Newton: to use <object> or <embed> as fallback image containers to avoid duplication of images being downloaded.
All the above being said, we just need to wait, but in short, my answer is  that your first option picture {background-color: red}; is the correct one


text:
Q: How to troubleshoot "Error:scalac: bad symbolic reference to scala.ScalaObject encountered in class file 'package.class'"? I face this error message when I try to run the project:
Error:scalac: bad symbolic reference to scala.ScalaObject encountered in class file 'package.class'.
Cannot access type ScalaObject in package scala. The current classpath may be
missing a definition for scala.ScalaObject, or package.class may have been compiled against a version that's incompatible with the one found on the current classpath.

There are similar questions here and here, but none seems to be applicable to my case - mine isn't spitting out such messages. The only thing I have to go one is scalaObject.
This is a sudden breakage -- the project was made inside IntelliJ IDEA with sbt and ran find until today. Suddenly, it can't find what it needs.
This is the whole build.sbt file:
name := "MyApp"

libraryDependencies ++= Seq(
  "joda-time" % "joda-time"    % "2.3",
  "org.joda"  % "joda-convert" % "1.6",
  "org.scala-lang" % "scala-swing" % "2.9.2",

How do I troubleshoot this?

A: I believe you may have changed sbt.version in project/build.properties or scalaVersion in build.sbt. Or just sbt the launcher. Or the Scala plugin for IntelliJ IDEA. Could that be the case?
I'm basing it on "or package.class may have been compiled against a version that's
incompatible with the one found on the current classpath.".
You may want to see update reports in target\resolution-cache\reports.

A: You mentioned that you are using IntelliJ IDEA. I am using the Scala IDE for Eclipse and I ran across this error. It only occurred when I turned off this option in the IDE config:
withVersionClasspathValidator - Check Scala compatibility of jars in classpath
When this option was turned on, I instead got:
mongo-casbah-commons_2.8.1-2.1.2.jar is cross-compiled with an incompatible version of Scala (2.8.1).
I'm new to Scala, but this seems to be because I'm using Scala 2.11.2 to compile, but I'm including a jar that was built using Scala 2.8.1.


text:
Q: ASP.NET - why is the default resx file being used in the code-behind when the localized one is being used by the markup? I am creating an ASP.NET web application in C#, and have to localize the application into English and French. I have created two resources files: App_GlobalResources\Resources.resx and App_GlobalResources\Resources.fr.resx containing the english and french content.
When I run the application with my browser set to French (fr_FR), the french content is correctly displayed in the markup.
Within the code-behind, when I access values from the resources, it returns the default english values only. e.g.

this.CompanyName.Text = string.Format(App_GlobalResources.Resources.CompanyLocationsFormat, companyName);

Debugging the app shows that the CurrentCulture and CurrentUICulture are both correctly set to fr_FR.
Can anyone explain how I can get the code-behind to use the culturally-appropriate resource file?
Many thanks
(C#, ASP.NET 3.5 SP1, Visual Studio 2008, IE 8.0.7600)

A: Are you certain that this specific resource (CompanyLocationsFormat) exists in the french resources file? If a resource is missing, it will fall back to the default one.

A: Do you have this in your <system.web> section in web.config?
<globalization culture="auto" uiCulture="auto" />


text:
Q: Typescript dual sync / async return type The following typescript code has the right "external" signature but the two return statements return an error (playground).
export function using<F, R = void | Promise<void>>(
  value: F,
  init: (value: F) => R
): R extends Promise<void> ? Promise<F> : F {
  const r = init(value)
  if (r === undefined) return value
  return r.then(() => value)
}

A simple fix, as suggested by known-as-bmf, is to use function overloading as such:
export function using<F>(value: F, init: (value: F) => Promise<void>): Promise<F>
export function using<F>(value: F, init: (value: F) => void): F
export function using<F>(value: F, init: (value: F) => void | Promise<void>): F | Promise<F> {
  const r = init(value)
  if (r === undefined) return value
  return r.then(() => value)
}

But then you kinda loose the strong typing check in the function implementation, for example, the following is invalid but does not return any compilation error:
export function using<F>(value: F, init: (value: F) => Promise<void>): Promise<F>
export function using<F>(value: F, init: (value: F) => void): F
export function using<F>(value: F, init: (value: F) => void | Promise<void>): F | Promise<F> {
  const r = init(value)
  if (r === undefined) return Promise.resolve(value)
  return r.then(() => value)
}

Is there a way to make the first piece of code working all while keeping a strong type validation?

A: You could use function overload to expose multiple signatures for the same function.
Example code here
Depending on how you call using, it will return F or Promise<F>.
Example with usage here


text:
Q: how to get the variable list from each data frame in a list I have a list of df, and I would like to rename the df as df1, df2, df3. and then create a summary like below to capture the variables in each df. What should I do?

I tried to use map to setNames for the data frames in lst, but I must do it in the wrong way. my current codes set variable names to df1, df2, def3.
lst<- map( lst ~
  setNames(.x, str_c("df", seq_along(lst))))

sample data:
lst<-list(structure(list(ID = c("Tom", "Jerry", "Mary"), Score = c(85,
85, 96), Test = c("Y", "N", "Y")), row.names = c(NA, -3L), class = c("tbl_df",
"tbl", "data.frame")), structure(list(ID = c("Tom", "Jerry",
"Mary", "Jerry"), Score = c(75, 65, 88, 98), try = c("Y", NA,
"N", NA)), row.names = c(NA, -4L), class = c("tbl_df", "tbl",
"data.frame")), structure(list(ID = c("Tom", "Jerry", "Tom"),
    Score = c(97, 65, 96), weight = c("A", NA, "C")), row.names = c(NA,
-3L), class = c("tbl_df", "tbl", "data.frame")))

A: We get the column names with names/colnames by looping, paste to a single string with toString, convert to a data.frame column and bind the elements (_dfr).
library(purrr)
library(dplyr)
library(stringr)
setNames(lst, str_c("df", seq_along(lst))) %>%
    map_dfr(~ tibble(Var = toString(names(.x))), .id = 'Data')

-output
# A tibble: 3 × 2
  Data  Var
  <chr> <chr>
1 df1   ID, Score, Test
2 df2   ID, Score, try
3 df3   ID, Score, weight


text:
Q: Updating a field in a record dyanamically in extjs Scenario
I want to update the column data of particular record in grid having store with static data.
  Here is my store:
extend : 'Ext.data.Store',
model  : 'MyModel',
autoLoad:true,
proxy: {
    type: 'ajax',
    url: 'app/data/data.json',
    reader: {
        type: 'json',
        root: 'users'
    }
},

My data.json
 {
     'users': [{
         QMgrStatus: "active",
         QMgrName: 'R01QN00_LQYV',
         ChannelStatus: 'active',
         ChannelName: 'LQYV.L.CLNT',
         MxConn: 50
     }]
 }

What I am doing to update the record :
var grid = Ext.getCmp('MyGrid');
var store = Ext.getStore('Mystore');
store.each(function(record, idx) {
    val = record.get('ChannelName');
    if (val == "LQYV.L.CLNT") {
        record.set('ChannelStatus', 'inactive');

        record.commit();
    }
});
console.log(store);
grid.getView().refresh();

MY PROBLEM
I am getting the record updated over here.It is not getting reflected in my grid panel.The grid is using the same old store(static).Is the problem of static data? Or am I missing something or going somewhere wrong? Please help me out with this issue.Thanks a lot.
MY EDIT
I am tryng to color code the column based on the status.But here I am always getting the status="active" even though I am updating the store.
What I am trying to do in my grid
{
    xtype: 'grid',
    itemId: 'InterfaceQueueGrid',
    id: 'MyGrid',
    store: 'Mytore',
    height: 216,
    width: 600,
    columns: [{
        text: 'QueueMgr Status',
        dataIndex: 'QMgrStatus',
        width: 80
    }, {
        text: 'Queue Manager \n Name',
        dataIndex: 'QMgrName',
        width: 138
    }, {
        text: 'Channel Status',
        dataIndex: 'ChannelStatus',
        width: 78,
        align: 'center',
        renderer: function(value, meta, record) {
            var val = record.get('ChannelStatus');
            console.log(val); // Here I am always getting status="active".
            if (val == 'inactive') {
                return '';
            } else if (val == 'active') {
                return '';
            }
        }
    }, {
        text: 'Channel Name',
        align: 'center',
        dataIndex: 'ChannelName',
        width: 80
    } {
        text: 'Max Connections',
        align: 'center',
        dataIndex: 'MxConn',
        width: 80
    }]
}

A: Maybe it is just a typo, you assign val in your condition. Try this (= to ==):
var grid = Ext.getCmp('MyGrid');
var store = Ext.getStore('Mystore');
store.each(function(record,idx){
      val = record.get('ChannelName');
      if(val == "LQYV.L.CLNT"){
         record.set('ChannelStatus','active');
      }
      else {
         record.set('ChannelStatus','inactive');
      }
      record.commit();
});
console.log(store);
grid.getView().refresh();

A: Have you tried commiting your store and reloading it ?
Try this way.
yourstorename.commitChanges();
yourstorename.reload();

A: A drastic way is to reconfigure your grid. This may not end up to be your final solution, but maybe you get to know what is going wrong.
Call
grid.reconfigure(store)

instead of
grid.getView().refresh();

after changing the records. You can also use a single store.commitChanges() instead of using a record.commit() on each single record.

A: I resolved it using
grid.bindStore(myupdatedstore);

As stated by @Christoph
grid.reconfigure(store)

works fine as well .


text:
Q: cannot pass PHP variable to javascript function I cannot invoke a Javascript function if I try to pass a PHP array element as an arg.
I've tried everything (except the right thing, I suppose).
Here is the PHP code -- the 2nd line is the one that is failing:
var_dump($theRow[11]);
$htmlBuffer = '
does not work!
';
$htmlBuffer = $htmlBuffer . '
 THIS WORKS FINE!
';

Here is the HTML code to output the above:

      <?php echo '
' . $htmlBuffer . '
';
      ?>

Here is the javascript function 'showIt()':
function showIt(theVal)
{
   alert("HERE IS WHAT WAS PASSED IN: " + theVal);
}

Here is the output on the page:
1)  First I see this on the page:
string(8) "52e43c33"

Now, that is 100% fine. That is what I expect to see at array position #11.
Note that 'theRow[11]' is a PHP array, where each array element is an 8-digit (hex) number.  And that var_dump() call shows that the array element at position 11 is a valid 8-digit (hex) number, and that's what I expect to find there.  So that is okay.
2) then I see this on the page:
does not work!
THIS WORKS FINE!

When I click on "THIS WORKS FINE!"  on my web page, I see an alert box appear that says this:
HERE IS WHAT WAS PASSED IN: undefined

Now that is okay by me.  I did not pass a parameter to showIt() for the line of code I clicked on.  The fact that the alert() box appears shows 100% certainty that the onclick() is working.
AND HERE IS THE FAILURE:  when I click on the line of text in the browser window:
**does not work!**

-- which is trying to pass theRow[11]  as the argument to showIt() -- the alert box does that's called in showIt() not appear.
I figured "okay this is a quoting issue."
SO I TRIED THESE to no avail:
$htmlBuffer = '
does not work!
';
$htmlBuffer = '
does not work!
';
$htmlBuffer = '
does not work!
';
$htmlBuffer = '
does not work!
';

NONE OF MY quoting attempts here succeeded.
How do I properly quote the line of code:
$htmlBuffer = '
does not work!
';

to get theRow[11] successfully passed to showIt()?
EDIT:  here is the 'View source' of the page:
string(8) "7ab79992"
<!DOCTYPE html>

     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

does not work!

 THIS WORKS FINE!

A: First a tip: is easy to read if you append the string with: $htmlBuffer .= "Something else"; that is equivalent to $htmlBuffer = $htmlBuffer . "Something else";
If you are 100% sure that the content of $theRow[11] is the string "52e43c33" this version would be working:
$htmlBuffer = '';
$htmlBuffer .= '
does not work!
';

The important part is that you are quoting the javascript string using ' so you must be sure that the php content of $theRow[11] must not have any '. Is easy to use ' to quote the javascript argument string because you are opening the HTML attribute with ". Remove the other lines that you are trying because thats can cause unbalanced quotes.
Check the output of your browser (use view-source:URL) you must see something like:

does not work!

A: How about a little Heredoc to avoid all that nasty quoting/escaping?
$htmlBuffer = <<<EOD

does not work!

EOD;

A: Try this:

     <div onclick="showIt(<? echo $theRow[11] ; ?>)">does not work!

well I have not checked this but it has always worked for me this way.
Good Luck !!


text:
Q: Not able to Start Elastic Search in Windows On running elasticsearch.bat in cmd :

warning: ignoring JAVA_HOME=C:\Program Files\JAVA_HOME\openjdk-17.0.1;
using bundled JDK [2022-07-11T10:50:46,384][INFO ][o.e.n.Node
] [MUTHU] version[8.3.0], pid[6080],
build[zip/5b8b981647acdf1ba1d88751646b49d1b461b4cc/2022-06-23T22:48:49.607492124Z],
OS[Windows 11/10.0/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit
Server VM/18.0.1.1/18.0.1.1+2-6] [2022-07-11T10:50:46,391][INFO
][o.e.n.Node               ] [MUTHU] JVM home
[C:\Users\muthu\Downloads\elasticsearch-8.3.0-windows-x86_64\elasticsearch-8.3.0\jdk],
using bundled JDK [true] [2022-07-11T10:50:46,392][INFO ][o.e.n.Node
] [MUTHU] JVM arguments [-Des.networkaddress.cache.ttl=60,
-Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX:+UseG1GC, -Djava.io.tmpdir=C:\Users\muthu\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m,
-Xms8138m, -Xmx8138m, -XX:MaxDirectMemorySize=4267704320, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.distribution.type=zip, --module-path=C:\Users\muthu\Downloads\elasticsearch-8.3.0-windows-x86_64\elasticsearch-8.3.0\lib,
-Djdk.module.main=org.elasticsearch.server] [2022-07-11T10:50:49,211][INFO ][c.a.c.i.j.JacksonVersion ] [MUTHU]
Package versions: jackson-annotations=2.13.2, jackson-core=2.13.2,
jackson-databind=2.13.2.2, jackson-dataformat-xml=2.13.2,
jackson-datatype-jsr310=2.13.2, azure-core=1.27.0, Troubleshooting
version conflicts: https://aka.ms/azsdk/java/dependency/troubleshoot
[2022-07-11T10:50:51,545][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [aggs-matrix-stats] [2022-07-11T10:50:51,545][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [analysis-common]
[2022-07-11T10:50:51,546][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [constant-keyword] [2022-07-11T10:50:51,546][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [data-streams]
[2022-07-11T10:50:51,546][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [frozen-indices] [2022-07-11T10:50:51,547][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [ingest-common]
[2022-07-11T10:50:51,547][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [ingest-geoip] [2022-07-11T10:50:51,547][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [ingest-user-agent]
[2022-07-11T10:50:51,548][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [kibana] [2022-07-11T10:50:51,548][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [lang-expression]
[2022-07-11T10:50:51,549][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [lang-mustache] [2022-07-11T10:50:51,549][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [lang-painless]
[2022-07-11T10:50:51,550][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [legacy-geo] [2022-07-11T10:50:51,550][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [mapper-extras]
[2022-07-11T10:50:51,550][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [mapper-version] [2022-07-11T10:50:51,551][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[old-lucene-versions] [2022-07-11T10:50:51,551][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [parent-join]
[2022-07-11T10:50:51,552][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [percolator] [2022-07-11T10:50:51,552][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [rank-eval]
[2022-07-11T10:50:51,553][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [reindex] [2022-07-11T10:50:51,553][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[repositories-metering-api] [2022-07-11T10:50:51,553][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [repository-azure]
[2022-07-11T10:50:51,554][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [repository-encrypted] [2022-07-11T10:50:51,554][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [repository-gcs]
[2022-07-11T10:50:51,555][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [repository-s3] [2022-07-11T10:50:51,555][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [repository-url]
[2022-07-11T10:50:51,556][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [runtime-fields-common] [2022-07-11T10:50:51,556][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[search-business-rules] [2022-07-11T10:50:51,557][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[searchable-snapshots] [2022-07-11T10:50:51,557][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[snapshot-based-recoveries] [2022-07-11T10:50:51,558][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[snapshot-repo-test-kit] [2022-07-11T10:50:51,558][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [spatial]
[2022-07-11T10:50:51,559][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [transform] [2022-07-11T10:50:51,559][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [transport-netty4]
[2022-07-11T10:50:51,560][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [unsigned-long] [2022-07-11T10:50:51,560][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [vector-tile]
[2022-07-11T10:50:51,561][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [vectors] [2022-07-11T10:50:51,561][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [wildcard]
[2022-07-11T10:50:51,562][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [x-pack-aggregate-metric] [2022-07-11T10:50:51,562][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [x-pack-analytics]
[2022-07-11T10:50:51,563][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [x-pack-async] [2022-07-11T10:50:51,563][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[x-pack-async-search] [2022-07-11T10:50:51,563][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[x-pack-autoscaling] [2022-07-11T10:50:51,564][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [x-pack-ccr]
[2022-07-11T10:50:51,564][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [x-pack-core] [2022-07-11T10:50:51,565][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[x-pack-deprecation] [2022-07-11T10:50:51,565][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [x-pack-enrich]
[2022-07-11T10:50:51,566][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [x-pack-eql] [2022-07-11T10:50:51,566][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [x-pack-fleet]
[2022-07-11T10:50:51,566][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [x-pack-graph] [2022-07-11T10:50:51,567][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[x-pack-identity-provider] [2022-07-11T10:50:51,567][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [x-pack-ilm]
[2022-07-11T10:50:51,567][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [x-pack-logstash] [2022-07-11T10:50:51,568][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [x-pack-ml]
[2022-07-11T10:50:51,568][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [x-pack-monitoring] [2022-07-11T10:50:51,569][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [x-pack-ql]
[2022-07-11T10:50:51,569][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [x-pack-rollup] [2022-07-11T10:50:51,570][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [x-pack-security]
[2022-07-11T10:50:51,570][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [x-pack-shutdown] [2022-07-11T10:50:51,570][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [x-pack-sql]
[2022-07-11T10:50:51,571][INFO ][o.e.p.PluginsService     ] [MUTHU]
loaded module [x-pack-stack] [2022-07-11T10:50:51,571][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[x-pack-text-structure] [2022-07-11T10:50:51,572][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module
[x-pack-voting-only-node] [2022-07-11T10:50:51,572][INFO
][o.e.p.PluginsService     ] [MUTHU] loaded module [x-pack-watcher]
[2022-07-11T10:50:51,573][INFO ][o.e.p.PluginsService     ] [MUTHU] no
plugins loaded [2022-07-11T10:50:55,410][INFO ][o.e.e.NodeEnvironment
] [MUTHU] using [1] data paths, mounts [[Windows (C:)]], net
usable_space [6.6gb], net total_space [117.9gb], types [NTFS]
[2022-07-11T10:50:55,411][INFO ][o.e.e.NodeEnvironment    ] [MUTHU]
heap size [7.9gb], compressed ordinary object pointers [true]
[2022-07-11T10:50:55,525][INFO ][o.e.n.Node               ] [MUTHU]
node name [MUTHU], node ID [blR5jASzR-GtHp8cCsqjNA], cluster name
[elasticsearch], roles [ml, data_hot, transform, data_content,
data_warm, master, remote_cluster_client, data, data_cold, ingest,
data_frozen] [2022-07-11T10:50:59,905][INFO ][o.e.x.s.Security
] [MUTHU] Security is enabled [2022-07-11T10:51:00,479][INFO
][o.e.x.s.a.s.FileRolesStore] [MUTHU] parsed [0] roles from file
[C:\Users\muthu\Downloads\elasticsearch-8.3.0-windows-x86_64\elasticsearch-8.3.0\config\roles.yml]
[2022-07-11T10:51:01,649][INFO ][o.e.x.m.p.l.CppLogMessageHandler]
[MUTHU] [controller/5312] [Main.cc@123] controller (64 bit): Version
8.3.0 (Build 2ddb5323b2ad5a) Copyright (c) 2022 Elasticsearch BV [2022-07-11T10:51:02,533][INFO ][o.e.t.n.NettyAllocator   ] [MUTHU]
creating NettyAllocator with the following configs:
[name=elasticsearch_configured, chunk_size=1mb,
suggested_max_allocation_size=1mb,
factors={es.unsafe.use_netty_default_chunk_and_page_size=false,
g1gc_enabled=true, g1gc_region_size=4mb}]
[2022-07-11T10:51:02,578][INFO ][o.e.i.r.RecoverySettings ] [MUTHU]
using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
[2022-07-11T10:51:02,635][INFO ][o.e.d.DiscoveryModule    ] [MUTHU]
using discovery type [multi-node] and seed hosts providers [settings]
[2022-07-11T10:51:04,703][INFO ][o.e.n.Node               ] [MUTHU]
initialized [2022-07-11T10:51:04,704][INFO ][o.e.n.Node
] [MUTHU] starting ... [2022-07-11T10:51:04,722][INFO
][o.e.x.s.c.f.PersistentCache] [MUTHU] persistent cache index loaded
[2022-07-11T10:51:04,723][INFO
][o.e.x.d.l.DeprecationIndexingComponent] [MUTHU] deprecation
component started [2022-07-11T10:51:05,004][INFO
][o.e.t.TransportService   ] [MUTHU] publish_address {127.0.0.1:9300},
bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2022-07-11T10:51:05,617][WARN ][o.e.c.c.ClusterBootstrapService]
[MUTHU] this node is locked into cluster UUID [vICcQF0LRnGmaEJTavBbaQ]
but [cluster.initial_master_nodes] is set to [MUTHU]; remove this
setting to avoid possible data loss caused by subsequent cluster
bootstrap attempts [2022-07-11T10:51:05,802][INFO
][o.e.c.s.MasterService    ] [MUTHU] elected-as-master ([1] nodes
joined)[FINISH_ELECTION,
{MUTHU}{blR5jASzR-GtHp8cCsqjNA}{lHHp8n91TFCQtiZV56u4ZA}{MUTHU}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}
completing election], term: 5, version: 40, delta: master node changed
{previous [], current
[{MUTHU}{blR5jASzR-GtHp8cCsqjNA}{lHHp8n91TFCQtiZV56u4ZA}{MUTHU}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}]}
[2022-07-11T10:51:05,922][INFO ][o.e.c.s.ClusterApplierService]
[MUTHU] master node changed {previous [], current
[{MUTHU}{blR5jASzR-GtHp8cCsqjNA}{lHHp8n91TFCQtiZV56u4ZA}{MUTHU}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}]},
term: 5, version: 40, reason: Publication{term=5, version=40}
[2022-07-11T10:51:05,983][WARN ][o.e.c.r.a.DiskThresholdMonitor]
[MUTHU] high disk watermark [90%] exceeded on
[blR5jASzR-GtHp8cCsqjNA][MUTHU][C:\Users\muthu\Downloads\elasticsearch-8.3.0-windows-x86_64\elasticsearch-8.3.0\data]
free: 6.6gb[5.6%], shards will be relocated away from this node;
currently relocating away shards totalling [0] bytes; the node is
expected to continue to exceed the high disk watermark when these
relocations are complete [2022-07-11T10:51:06,038][INFO
][o.e.h.AbstractHttpServerTransport] [MUTHU] publish_address
{192.168.1.6:9200}, bound_addresses {[::]:9200}
[2022-07-11T10:51:06,041][INFO ][o.e.n.Node               ] [MUTHU]
started
{MUTHU}{blR5jASzR-GtHp8cCsqjNA}{lHHp8n91TFCQtiZV56u4ZA}{MUTHU}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}{ml.max_jvm_size=8535408640,
ml.machine_memory=17066790912, xpack.installed=true}
[2022-07-11T10:51:06,089][INFO ][o.e.l.LicenseService     ] [MUTHU]
license [4b383951-c19c-4efc-8fb2-201b91e32e8c] mode [basic] - valid
[2022-07-11T10:51:06,092][INFO ][o.e.x.s.a.Realms         ] [MUTHU]
license mode is [basic], currently licensed security realms are
[reserved/reserved,file/default_file,native/default_native]
[2022-07-11T10:51:06,098][INFO ][o.e.g.GatewayService     ] [MUTHU]
recovered [2] indices into cluster_state
[2022-07-11T10:51:06,257][ERROR][o.e.i.g.GeoIpDownloader  ] [MUTHU]
exception during geoip databases update
org.elasticsearch.ElasticsearchException: not all primary shards of
[.geoip_databases] index are active
at org.elasticsearch.ingest.geoip.GeoIpDownloader.updateDatabases(GeoIpDownloader.java:134)
~[ingest-geoip-8.3.0.jar:8.3.0]
at org.elasticsearch.ingest.geoip.GeoIpDownloader.runDownloader(GeoIpDownloader.java:274)
[ingest-geoip-8.3.0.jar:8.3.0]
at org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor.nodeOperation(GeoIpDownloaderTaskExecutor.java:102)
[ingest-geoip-8.3.0.jar:8.3.0]
at org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor.nodeOperation(GeoIpDownloaderTaskExecutor.java:48)
[ingest-geoip-8.3.0.jar:8.3.0]
at org.elasticsearch.persistent.NodePersistentTasksExecutor$1.doRun(NodePersistentTasksExecutor.java:42)
[elasticsearch-8.3.0.jar:?]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:768)
[elasticsearch-8.3.0.jar:?]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
[elasticsearch-8.3.0.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[?:?]
at java.lang.Thread.run(Thread.java:833) [?:?] [2022-07-11T10:51:06,266][INFO ][o.e.c.r.a.AllocationService] [MUTHU]
current.health="RED" message="Cluster health status changed from
[YELLOW] to [RED] (reason: [state recovered])."
previous.health="YELLOW" reason="state recovered"

A: As mentioned in the error messages,

high disk watermark [90%] exceeded on [blR5jASzR-GtHp8cCsqjNA][MUTHU][

and

[MUTHU] exception during geoip databases update
org.elasticsearch.ElasticsearchException: not all primary shards of
[.geoip_databases] index are active at

It seems you don't have enough space allocated to your data folder of Elasticsearch, where Elasticsearch will store the index data. Try freeing up space in your Elasticsearch data folder, which you can find in the elasticsearch.yml. It's defined under path.data setting.


text:
Q: How is this jQuery code creating an event? Suppose I have this code:
$('#button').on('click', function () {
    $('#status').text('doing some work....');
    somethingThatTakes20Seconds('#status');
});

Here, somethingThatTakes20Seconds will be executed before the "doing some work" statement. While I understand the statement itself creates a DOM event which gets placed into the event queue and waits until the stack is clear to execute, what I don't get is how it's doing it (on a high level). Is the .text method asynchronous, in the same way like setTimeout() is (just with .text you don't take any callback, or is the callback auto-generated, basically some code that updates the DOM)?

A: The text() method is not asynchronous.  $('#status').text('doing some work....'); will execute before somethingThatTakes20Seconds('#status');.
You can define your somethingThatTakes20Seconds() method to register a callback - which internally adds a listener to the JavaScript engine.  When the listener "hears" something - ie. an AJAX request is completely or an user performs an action, it adds an item to the message queue.
This is where the event loop comes in.  The event loop takes this message queue item and then calls the callback function associated with it.

A: The browser will not render the DOM to show the "doing some work..." message until after the function returns. Assuming your somethingThatTakes20Seconds function does not return for 20 seconds, you will not see that message for 20 seconds. You probably want to do something like this:
$('#button').on('click', function () {
    $('#status').text('doing some work....');
    setTimeout(function () { somethingThatTakes20Seconds('#status'); }, 10);
});

This will allow the DOM to be rendered before starting the long-running process.
For example: https://jsfiddle.net/9eq85udz/2/

A: No, .text() method is not asynchronous.
JavaScript only executes your code each line in sequence. It does not wait until each line execution is completed to execute the next line.
In your code, basically what you're doing is:

*

*Change the #status text to doing some work.....

*Run somethingThatTakes20Seconds() function.
It's just impossible for your function to do the 2nd function for 20 seconds, and then run the 1st one considering how fast it is to run the 1st function.
Consider the following sample,

function addTextOne() {
  $('#result').append('This is text 1.\n');
}

function addTextTwo() {
  $('#result').append('This is text 2.\n');
}
$(function() {
  $("#testBtn").on('click', function() {
    setTimeout(addTextOne, 1001);
    setTimeout(addTextTwo, 1000);
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="testBtn">
  Test
</button>
<br/>
<textarea id="result" cols='70' rows='30'></textarea>

Note: The code sample basically executes addTextOne before addTextTwo on button click. But, addTextTwo finishes earlier than addTextOne.


text:
Q: When will sending email through Apex automatically cause the test to fail, or when will it pass? Normally, I expect tests to fail if the org does not allow email deliverability.
In my current sandbox, I have several tests that fail because email is not deliverable.
I think most of them fail at Messaging.reserveSingleEmailCapacity(emailCount); but I could be mistaken.
But I also have some tests which pass, despite actually trying to send an email like Messaging.sendEmail(emailMessageList);
... But this isn't necessarily "safe" as I have two different tests, one of which passes that point and the other fails.
For example, I have the following wrapper class for sending Emails so I can mock out the results when testing other classes:
// EmailMailer wrapper class:
public with sharing virtual class XAP_EML_EmailMailer {
    private XAP_DAO_ApexEmailNotificationSelector apexEmailNotificationSelector;

    @TestVisible
    private XAP_EML_EmailMailer(XAP_DAO_ApexEmailNotificationSelector apexEmailNotificationSelector) {
        this.apexEmailNotificationSelector = apexEmailNotificationSelector;
    }

    protected XAP_EML_EmailMailer() {
        this(XAP_DAO_ApexEmailNotificationSelector.getInstance());
    }

    private static XAP_EML_EmailMailer instance;
    public static XAP_EML_EmailMailer getInstance() {
        if (instance == null) {
            instance = new XAP_EML_EmailMailer();
        }
        return instance;
    }

    // This enables workaround to prove emails would be sent even in orgs where email is disabled.
    @TestVisible
    private static Integer MESSAGES_SENT_COUNT = 0;

    public virtual XAP_EML_SendEmailResultListWrapper sendExceptionAlerts(XAP_EML_EmailAlertable alertable) {
        List<User> userList = new List<User>();
        List<String> emailAddressList = new List<String>();
        for (ApexEmailNotification apexEmailNotification : this.apexEmailNotificationSelector.selectAll()) {
            if (apexEmailNotification.User != null) {
                userList.add(apexEmailNotification.User);
            }
            else {
                emailAddressList.add(apexEmailNotification.Email);
            }
        }

        List<Messaging.SingleEmailMessage> emailMessageList
                = this.buildEmailMessageList(userList, emailAddressList, alertable);
        return this.send(emailMessageList);
    }

    @TestVisible
    private List<Messaging.SingleEmailMessage> buildEmailMessageList(
            List<User> userList,
            List<String> emailAddressList,
            XAP_EML_EmailAlertable alertable
    ) {
        List<Messaging.SingleEmailMessage> emailMessageList = new List<Messaging.SingleEmailMessage>();
        emailMessageList.addAll(this.buildEmailMessageList(userList, alertable));
        emailMessageList.addAll(this.buildEmailMessageList(emailAddressList, alertable));
        return emailMessageList;
    }

    @TestVisible
    private List<Messaging.SingleEmailMessage> buildEmailMessageList(
            List<User> userList,
            XAP_EML_EmailAlertable alertable
    ) {
        List<Messaging.SingleEmailMessage> emailMessageList = new List<Messaging.SingleEmailMessage>();
        for (User user : userList) {
            Messaging.SingleEmailMessage email = this.createEmail(alertable);
            email.setTargetObjectId(user.Id);
            emailMessageList.add(email);
        }
        return emailMessageList;
    }

    @TestVisible
    private List<Messaging.SingleEmailMessage> buildEmailMessageList(
            List<String> emailAddressList,
            XAP_EML_EmailAlertable alertable
    ) {
        List<Messaging.SingleEmailMessage> emailMessageList = new List<Messaging.SingleEmailMessage>();
        if (!emailAddressList.isEmpty()) {
            Messaging.SingleEmailMessage email = this.createEmail(alertable);
            email.setToAddresses(emailAddressList);
            emailMessageList.add(email);
        }
        return emailMessageList;
    }

    @TestVisible
    private Messaging.SingleEmailMessage createEmail(XAP_EML_EmailAlertable alertable) {
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        email.setSaveAsActivity(false);
        email.setSubject(alertable.getEmailSubject());
        email.setPlainTextBody(alertable.getEmailBody());
        return email;
    }

    public virtual XAP_EML_SendEmailResultListWrapper send(List<Messaging.SingleEmailMessage> emailMessageList) {
        MESSAGES_SENT_COUNT++;
        return new XAP_EML_SendEmailResultListWrapper(
                Messaging.sendEmail(emailMessageList)
        );
    }
}

But, of course, I need and want to create tests for this class too.
The following test directly executes send() which executes Messaging.sendEmail(emailMessageList) and this passes.
@IsTest
public static void testSendShouldSignifySentMessagesByAugmentingCounter() {
    // Arrange
    Messaging.SingleEmailMessage testMessage = new Messaging.SingleEmailMessage();
    testMessage.setSaveAsActivity(false);
    testMessage.setTargetObjectId(TEST_RUNNER.Id);
    testMessage.setPlainTextBody(TEST_BODY);
    List<Messaging.SingleEmailMessage> testMessageList = new List<Messaging.SingleEmailMessage>{
            testMessage
    };

    // Act
    XAP_EML_SendEmailResultListWrapper result;
    Test.startTest();
    System.runAs(TEST_RUNNER) {
        result = MAILER_UNDER_TEST.send(testMessageList);
    }
    Test.stopTest();

    // Assert
    System.assertEquals(1, XAP_EML_EmailMailer.MESSAGES_SENT_COUNT);
    System.assert(result.sendEmailResults[0].isSuccess());
}

However, this test only indirectly executes send() which executes Messaging.sendEmail(emailMessageList) but this fails.
public static void testSendExceptionAlertsShouldSendAlertsToBothUsersAndArbitraryEmails() {
    // Arrange
    MOCK_APEX_EMAIL_NOTIFICATION_SELECTOR.returnedApexEmailNotificationList = TEST_APEX_EMAIL_NOTIFICATION_LIST;

    TEST_ALERTABLE.returnedEmailSubject = TEST_SUBJECT;
    TEST_ALERTABLE.returnedEmailBody = TEST_BODY;

    // Act
    XAP_EML_SendEmailResultListWrapper result;
    Test.startTest();
    System.runAs(TEST_RUNNER) {
        result = MAILER_UNDER_TEST.sendExceptionAlerts(TEST_ALERTABLE);
    }
    Test.stopTest();

    // Assert
    System.assertEquals(1, XAP_EML_EmailMailer.MESSAGES_SENT_COUNT);
    System.assert(result.sendEmailResults[0].isSuccess());
    System.assert(result.sendEmailResults[1].isSuccess());
}

Why does the second test get a different result?
Which messaging operations are safe for testing in orgs where email deliverability has been turned off (and therefore don't need to be avoided while trying to make tests which pass in all orgs)?


text:
Q: Problems using REST API to generate Tile Packages from World Topo (For Export) Using the python script below it seems that I can request the generation of tile packages from an ESRI ArcMap REST service, and then download the resulting tpk file generated by ESRI.  But when I try and open the package NOTHING shows up in ArcMap.  Can't tell what is happening - can't tell what is going wrong.  Any ideas?
import arcpy
import requests
import pandas as pd
import time
import json

def gen_token():
    arcpy.SignInToPortal_server("USERNAME", "PASSWORD", "")
    token = arcpy.GetSigninToken()
    return str(token['token'])

def check_status(jobID, token):
    req_status_url = 'http://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Topo_Map/MapServer/jobs/' \
                     + jobID \
                     + '?f=json' \
                       '&token=' + token

    status_resp = requests.get(req_status_url)
    status_resp_cont = json.loads(status_resp.content)
    return str(status_resp_cont['jobStatus'])

def scrape_tiles(input_file, levels):

    token = gen_token()

    tpk_grid_df = pd.read_csv(input_file, header=0)

    for index,row in tpk_grid_df.iterrows():

        extent = '{"xmin":' + str(row['XMIN']) + \
                 ',"ymin":'+str(row['YMIN']) + \
                 ',"xmax":'+str(row['XMAX']) + \
                 ',"ymax":'+str(row['YMAX']) + \
                 ',"spatialReference" : {"wkid" : 4326}}'

        req_url = 'http://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Topo_Map/MapServer/exportTiles?' \
                  'tilePackage=true' \
                  '&exportExtent=' + extent + \
                  '&optimizeTilesForSize=true' \
                  '&compressionQuality=90' \
                  '&exportBy=levelId' \
                  '&levels=' + str(levels) + \
                  '&f=json' \
                  '&token=' + token

        resp = requests.get(req_url)
        resp_cont_dic = json.loads(resp.content)
        jobID = str(resp_cont_dic['jobId'])
        jobStatus = str(resp_cont_dic['jobStatus'])
        print(jobStatus)

        while jobStatus == 'esriJobSubmitted' or jobStatus == 'esriJobExecuting':
            time.sleep(15)
            jobStatus = check_status(jobID, token)

        if jobStatus == 'esriJobFailed':
            print('esriJobFailed')
            break

        # GRABBING THE RESULTS
        res_url = 'http://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Topo_Map/MapServer/jobs/' \
                  + str(jobID) \
                  + '/results/out_service_url?f=json' \
                    '&token=' + token

        result_resp = requests.get(res_url)
        result_resp_cont_dic = json.loads(result_resp.content)
        result_url = result_resp_cont_dic['value'] + '/Layers.tpk'

        file_name = 'NH_TP_' + str(levels) + '_' +  str(row['ID']) + '.tpk'

        r = requests.get(result_url)
        with open(file_name, 'wb') as f:
            for chunk in r.iter_content(chunk_size=1024):
                if chunk:  # filter out keep-alive new chunks
                    f.write(chunk)
                    f.flush() #commented by recommendation from J.F.Sebastian
        f.close()

if __name__ == "__main__":

    input_file = "TPK_Grid_100.csv"
    num_levels = 17
    scrape_tiles(input_file, num_levels)

First couple of lines from the input file:
ID  XMIN    YMIN    XMAX    YMAX
1   -72.573919  42.633528   -72.37901   42.909766
2   -72.37901   42.633528   -72.1841    42.909766


text:
Q: Symlink to Volume On macOS Catalina, I would like to create a symbolic link to my data partition using:
sudo ln -s /Volumes/data /data

However, I get the following error:
ln: /data: Read-only file system

(Whereas /Volumes/data is not read-only, and I can use it without any problems.)


text:
Q: if finally is always executed, why try returns unchaged value I have the following code:
function f() {
    var a = 5;
    try {
        return a;
    } finally {
        a = 3;
    }
}

console.log(f()); // returns 5 instead of 3, why?

A: The value of a is read when return a; is executed, then the finally block is executed. Changing the value of a after it's read won't change the return value.
If you write return 3 in the finally block instead of a = 3, then you will see that the return value is changed.

A: Even though finally block executes after try, it's can't change already returned value. Since a has primitive type, already returned value has no connection to the one left behind inside f function, because they are copies but not the same instances anymore.
To prove above, see how it would behave with objects that are passed by reference:

function f() {
    var a = {value: 5};
    try {
        return a;
    } finally {
        a.value = 3;
    }
}

alert(JSON.stringify(f()));


text:
Q: How to add PHP or Javascript code to a custom content type I am working with Drupal 7.17.
I have a custom content type I created called Sidebar Ad (machine name sidebar_ad) that I want to add Javascript and PHP to. From what I understand, in the templates directory of the theme I am working with, I need to create a file called 'page--sidebar_ad.tpl.php' and I can put PHP and Javascript code in there, and it will only run in blocks and pages that contain the custom content type Sidebar Ad.
I am trying this out with one of the stock themes, Bartik, and it is not working for me. I tried it by copying the page.tpl.php file, renaming it page--sidebar_ad.tpl.php, and adding a bit of text in a few places - at the top of the php file, and in the content div. But I don't see anything change on the pages on my site that contain that custom content type.
Is there something I am missing?

A: Most likely the thing you're missing is flushing Drupal's cache...any time you add a hook or template file, you need to flush the cache so the various registries can pick it up.
In the case of an overridden page template file you also need a copy of the standard page.tpl.php file in your theme. Same goes for the node template and most likely others, you need the original in there for the overrides to work.


text:
Q: Novel involving soul of a physically challenged person possessing his brother's body The characters involves a psychiatrist/doctor, a girl and her sister. I guess the story goes like this - The sister commits suicide by jumping off a building. The girl tries to find out what caused her sister to do something like that. She ends up meeting a psychiatrist who used to treat her sister.
The girl gets hypnotized by the doctor and he informs her that she has got a twin personality (and I guess he tells her what the other personality's name is). She did not believe that first. But next morning she finds the name written near her bed.
Towards the end, girl finds out that the doctor manipulates girls' minds during hypnotism. His soul then enters the girls' bodies and uses them for his pleasure. I remember something like - causing pain to the body will break the connection.
Finally it is revealed that it is not the doctor but his physically challenged brother who is doing all this. The doctor's body is occupied by the brother's soul most of the time. During his transition into a girl's body, the doctor is locked up somewhere. I think the girl found this out through a letter from the doctor.

A: I believe that the book is "Sibs" by F. Paul Wilson.  (Summary from Amazon)
After vowing never to return, Kara Wade is back in New York City. She's come to claim the body of her twin sister Kelly, and to find out how she died. No secret as to the cause of death―a nearly nude, twelve-story plunge from a room in the Plaza Hotel―but Kara is determined to learn what led to that plunge.
Enlisting the help of an old lover, now an NYPD detective, Kara delves into her sister's life. Startling and bizarre facts begin to surface. Instead of answers, Kara finds more questions. Who was the stranger Kelly became during the months prior to her death? What was behind the perverse, decadent lifestyle she came to embrace so passionately?
Kelly's psychiatrist hints at a terrible secret in her past. But Kara shares that past with her twin. Is the sinister influence that drove Kelly into her bizarre double life about to overtake Kara as well?
Sibs is F. Paul Wilson's most daring, most erotic, most deeply terrifying novel.


text:
Q: Unable to decrypt ssl CA cert elasticsearch Docker i have CA cert password protected in my docker. How can i supply the password. I can't even go into my docker to set the password of ssl based on reference from
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-basic-setup.html#generate-certificates

where i need do below
/bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password

./bin/elasticsearch-keystore add
xpack.security.transport.ssl.truststore.secure_password

Exception
"Caused by: org.elasticsearch.ElasticsearchSecurityException: failed to load SSL configuration [xpack.security.transport.ssl]",

"Caused by: org.elasticsearch.ElasticsearchException: failed to initialize SSL TrustManager",

"Caused by: java.io.IOException: keystore password was incorrect",
"Caused by: java.security.UnrecoverableKeyException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.",

ElasticsearchSecurityException[failed to load SSL configuration [xpack.security.transport.ssl]]; nested: ElasticsearchException[failed to initialize SSL TrustManager]; nested: IOException[keystore password was incorrect]; nested: UnrecoverableKeyException[failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.];
Likely root cause: java.security.UnrecoverableKeyException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.


text:
Q: Node.js - Looping through array of URLS one at a time I am a beginner at node js and I'm trying to write a web scraping script. I got permission from the site admin to scrape their products if I make less then 15 requests a minute. When I started out it used to request all the URLs at once but after some tooling around, I was able to go through each item in the array, but the script doesn't stop when there is no more items in the array? I'm not really happy with my result and feel like there is a better way to do this.
    var express = require('express');
    var fs = require('fs');
    var request = require('request');
    var cheerio = require('cheerio');
    var app     = express();
    var async = require('async');

app.get('/scrape', function(req, res){
productListing = ['ohio-precious-metals-1-ounce-silver-bar','morgan-1-ounce-silver-bar']
var i = 0;
async.eachLimit(productListing, 1, function (product, callback) {
    var getProducts = function () {
        var url = 'http://cbmint.com/' + productListing[i];
        request(url, function(error, response, html) {
            if(!error){
                var $ = cheerio.load(html);

                var title;
                var json = { title : ""};

                $('.product-name').filter(function(){
                    var data = $(this);
                    title = data.children().children().first().text();

                    json.title = title;
                })
            }
            var theTime = new Date().getTime();
            console.log(i);
            console.log(json.title);
            console.log(theTime);
            i++;
        });
    }
    setInterval(getProducts,10000);
})
res.send('Check your console!')
})

app.listen('8081')
console.log('Magic happens on port 8081');
exports = module.exports = app;

A: You aren't calling callback inside the iterator function. Take a look at the docs for eachLimit.


text:
Q: Выставить очередь для потока У меня есть код в котором будет около 15-20 функций которые я хочу выполнять параллельно(многопоточно), но проблема в том что если я понимаю что если я запущу одновременно на компьютере 20 функций, у меня не вывезет ни оперативка ни процессор, поэтому я хочу прописать очередь для потоков по принципу FIFO, выполняя одновременно не 15-20 потоков, а по 4, но я не совсем понимаю как это реализовать, попробовал вот так, но у меня второй процесс даже не запустился
if __name__ ==  "__main__":
    thread1 = Thread(target = func1)
    thread1.start()
    while True:
        if thread1.is_alive() == True:
            time.sleep(5)
         else:
             thread5 = Thread(target = func5)
             thread5.join()

Можете помочь разобраться как это сделать хотя бы примерно? Исходный код выглядит вот так:
if __name__ ==  "__main__":
    thread1 = Thread(target = func1)
    thread2 = Thread(target = func2)
    thread3 = Thread(target = func3)
    thread4 = Thread(target = func4)

    thread1.start()
    thread2.start()
    thread3.start()
    thread4.start()

A: Используйте пул потоков. Он сам создает потоки и контролирует их количество, вам нужно только передать ему функции на выполенение. А он сам поставит функцию в очередь пока не осовободится поток:
from concurrent.futures import ThreadPoolExecutor

with ThreadPoolExecutor(max_workers=4) as executor:
    futures = []
    for f in [func1, func2, func3, func4, func5]:
        futures.append(executor.submit(f))

    # ждем, когда закончат выполняться задачи
    for future in futures:
        future.result()


text:
Q: Why str.length()-1 returning some large integer The program was throwing error.I figured out that while loop was not terminating because A.size()-1 resulted in some large no even when A.size()
has become 0.
I instead used a variable n to store A.size() and used it in while loop
it worked.But I want to know why A.size()-1 prints such large no.
    //Input:  A:"nnnn"
    int i=0;
    while(i<A.size()-1){
        if(A[i]==A[i+1]){
            A.erase(A.begin()+i);
            A.erase(A.begin()+i);
            if(i!=0)i--;
        }
        else i++;
    cout<<i<<" "<<A.size()-1<<endl;
    }
    if(A=="")return "empty";
    return A;
    }

    /* //below code works fine
    int i=0;
    int n=A.size();
    while(i<n-1){
        if(A[i]==A[i+1]){
            A.erase(A.begin()+i);
            A.erase(A.begin()+i);
            if(i!=0)i--;
        }
    else i++;
    n=A.size();
    }
    if(A=="")return "empty";
    return A;
    */

    //output
    0 1
    0 18446744073709551615

A: Since std::string.length returns a size_t which is an unsigned integer you get unsigned underflow for the empty string (which has the length of 0).
One solution is to change the condition in your while to:
while(A.size() && i<A.size()-1)


text:
Q: Using php (cURL) to access a protected form, submit and retrieve results from CSV This feels beyond janky but our vendor has given me no other options. I need to access their form and extract the data from the resulting csv generated via cURL (or an alternative). The only example they are willing to provide is cold fusion (i know...)
<cfsetlocal.username = 'username' />
<cfsetlocal.password = 'Password' />
<cfhttp url="http://stupidvendor.com/users"
method="POST"
username="#local.username#"
password="#local.password#"
result="result">
<cfhttpparam type="URL" name="header_required" value="0" /> </cfhttp>
Downloading <cfoutput>#result.ResponseHeader.Location#</cfoutput>

<cfhttpurl="#result.ResponseHeader.Location#" method="get"
username="#local.username#" password="#local.password#"
file="Result.csv"
path="#expandPath('.')#"/>
Saved as Result.csv

I tried many many attempts but as I'm not expert in cURL any suggestions or links are much appreciated thank you all very much.
UPDATE: I'm able to get the contents of the url but it's an html form which needs to be submitted to generate a CSV which I then need the contents of. It's these last steps that I'm unsure how to approach or if this is even feasible with cURL

A: I'm also not familiar with ColdFusion so I hope this might help some. If the form is protected by Apache/Nginx authentication requirements, you need to pass the user name and password using CURLOPT_USERPWD. Here's a use example.
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_USERPWD,  "user@stupidvendor.com:my_password");

curl_setopt($ch, CURLOPT_URL, 'http://stupidvendor.com/users');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);

curl_close($ch);

The result you get back will be the contents of the page. Since you didn't specify where the CSV is coming from, I'm not sure how to help there.
Several applications I've built require a login to get information but they use a normal login form, then store the cookie (session ID) then it can access the protected data.
To submit form data you just need to simulate what the form is doing. So if the form does a POST request to a page, then you do a cURL to that page with the required POST data. As an example without knowing anything about the form.
// This is the data the from would submit
$postFields = array(
    'document' => 'report',
    'format' => 'csv'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_USERPWD,  "user@stupidvendor.com:my_password");

// This is the URL the form submits to
curl_setopt($ch, CURLOPT_URL, 'http://stupidvendor.com/users');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Assuming the from does a POST not a GET submission
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields));
curl_setopt($ch, CURLOPT_POST, true);

$result = curl_exec($ch);

curl_close($ch);

From there, you need to look at the data in $result to see what they are sending, is it the file itself or a link to the file in an HTML document.


text:
Q: FusedLocationProvider return null I used fusedlocation provider client for get device location.But if location setting off my phone and open location setting with locationServices. getSettingsClient fused location provider return null
 final Task<Location> locationTask = fusedLocationProviderClient.getLastLocation();
        locationTask.addOnSuccessListener((Activity) context, new OnSuccessListener<Location>() {
            @Override
            public void onSuccess(Location location) {
                if (location != null) {
                    lastKnownLocation = location;
                    map.moveCamera(CameraUpdateFactory.newLatLngZoom(
                            new LatLng(lastKnownLocation.getLatitude(),
                                    lastKnownLocation.getLongitude()), Constants.DEFAULT_ZOOM));
                    LatLng position = new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude());
                    HashMap<String, String> adressInfo = MapUtility.getAddressGeocoderObject(context, position);

                    MapUtility.moveCamera(context, map, position, Constants.DEFAULT_ZOOM,
                            adressInfo.get("addressFeatureName"), adressInfo.get("remainAdress"));

                } else {
                    Toast.makeText(context, "null", Toast.LENGTH_LONG).show();
                    //map.getUiSettings().setMyLocationButtonEnabled(false);

                }

A: solved my problem when update fusedLocation provider
private void createLocationRequest() {
    mLocationRequest = new LocationRequest();
    mLocationRequest.setInterval(10*1000);
    mLocationRequest.setFastestInterval(10*1000);
    mLocationRequest.setSmallestDisplacement(10);
    mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}

private void createLocationCallback(){
    locationCallback=new LocationCallback(){
        @Override
        public void onLocationResult(LocationResult locationResult) {
            super.onLocationResult(locationResult);
           //code here

        }
    };

}

and if location null update fused location provider
 public void getDeviceLocation() {
    try {
        final Task<Location> locationTask = fusedLocationProviderClient.getLastLocation();
        locationTask.addOnSuccessListener((Activity) context, new OnSuccessListener<Location>() {
            @Override
            public void onSuccess(Location location) {
                if (location != null) {
                    lastKnownLocation = location;
                    if(map==null){
                        Toast.makeText(context,"map null",Toast.LENGTH_LONG).show();
                        return;
                    }
                    map.moveCamera(CameraUpdateFactory.newLatLngZoom(
                            new LatLng(lastKnownLocation.getLatitude(),
                                    lastKnownLocation.getLongitude()), Constants.DEFAULT_ZOOM));
                    LatLng position = new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude());
                    HashMap<String, String> adressInfo = MapUtility.getAddressGeocoderObject(context, position);

                    assert adressInfo != null;
                    MapUtility.moveCamera(context, map, position, Constants.DEFAULT_ZOOM,
                            adressInfo.get("addressFeatureName"), adressInfo.get("remainAdress"));

                } else {
                    createLocationRequest();
                    createLocationCallback();
                    fusedLocationProviderClient.requestLocationUpdates(mLocationRequest,locationCallback,Looper.myLooper());

                }

            }

        });

        locationTask.addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
                Log.d(Constants.PlacesTag, "Current location is null. Using defaults.");
            }
        });

    } catch (SecurityException e) {
        Log.e("Exception: %s", e.getMessage());
    }

}


text:
Q: Changing the value in list of Objects How do I change value in the list of objects?
I have list with objects
obj_list = [Obj1, Obj2]

My object looks like this:
class Node:
    def __init__(self, move=None, path=None):
        self.move = move
        self.path = path

Each object can execute a move from list:
available_moves = ["UP", "DOWN", "RIGHT", "LEFT"]

So each object have stored an information about move.
string1 = obj1.move # up
string2 = obj2.move # down

I want to add these moves to their object path list. But it keeps adding both executed moves from obj1 and obj2.
I tried to add a move with for loop:
for i in range(0, len(obj_list)):
   temp = obj_list[i]
   temp.path.append(temp.move)

Obj1 looks like this:
Obj1.path = ["UP", "DOWN"]

It should look like this:
Obj1.path = ["UP"]
Obj2.path = ["DOWN"]

Any ideas how to add a move to path in list of object?

A: You wrote:
   temp = obj_list[i]
   temp.path.append(temp.move)

which essentially works out to this, during one execution:
   temp = obj1
   obj1.path.append(obj1.move)

You apparently were hoping for this behavior:
   obj2.path.append(obj1.move)

You will need to use a different index into obj_list
in order to locate obj2.

By default your ctor initializes a node's path to None.
Better to initialize to an empty list, so subsequent .append() will work.


text:
Q: Is it ok to wait in DllMain (PROCESS_DETATCH) as long as its not forever? I am writing an interface Dll which communicates with hardware via USB. In order to full fill timing requirement for the hardware (keeping it from timing out with no operation messages etc.) I create a worker thread per lazy initialization as soon a as my "Open()" method is called. When my "close()" method is called I set a named "terminate" event which is monitored by the worker thread and wait for the worker to terminate. Termination takes up to a few hundred milliseconds because a few messages need to be exchanged with the hardware.
So far so good, the only problem is when a Program unloads the Dll without calling my "Close()" method... I solved this by setting the "terminate" event in DllMain (PROCESS_DETATCH) which I'm pretty sure I'm allowed to do and still full fill best practices. The only problem is if the Dll is unloaded without calling close but reloaded again before the old worker thread terminates I cause a timeout in the process that loads my Dll because I am waiting for the old worker thread to finish.
So here is my Question: will waiting on the worker thread terminating in DllMain (PROCESS_DETATCH) with a timeout of say 500 ms cause any problems if I only do it when a worker thread exists and only if I am being unloaded (via freeLibrary) and not when my whole process is being terminated, which I test by looking at the lpvReserved parameter?
Also: is there a better way of solving my problem generally?

A: the only thing that will happen is make the thread which called FreeLibrary (FreeLibrary is not asychroneous, it waits for a return value) wait as long as your module is unloading.
I have made a few DLL's, sometimes even an loop like while(!IsDebuggerAttached()){} in DLLMain attach/detach and the programs which I tested behave just like they needed.
As for other problem solutions: Why would you need anything else besides DLLMain attach/detach  which has the same functionality?

A: I implemented a wait in my PROCESS_DETACH and it worked at first but in one corner case it ended up causing problems. The problem was that our debug output setup loaded a proprietary DLL to include version info in the debug output. If our DLL was loaded and unloaded quickly and there was enough going on in the background that this version info reading was slow to get going it could end up happening during the time that the process was waiting in PROCESS_DETACH which caused a deadlock.
For the future I have decided to never wait for anything in DllMin because anything I wait for could, in some corner case or after someone else adds functionality to some class which is touched, cause a deadlock on the loader lock.
I hope this advice helps someone in the future.


text:
Q: -[CALayer retain]: message sent to deallocated instance I'm developing an iphone app and when I turn on my NSZombieEnabled I have regularly a crash on error :
*** -[CALayer retain]: message sent to deallocated instance 0xe6012e0

It always come when I push or pop a view in my view controller. Sometimes there's this error before :
-[UIApplication endIgnoringInteractionEvents] called without matching -beginIgnoringInteractionEvents. Ignoring.

What does it mean? Anyone has a clue or has encountered this problem?
Thank you very much for help!
Romain

A: If the above answers did not help then check if your code is using KVO in the class where you receive this error. When KVO is sending a message to your observing class about a value on a key changing, if the class has been released by ARC then KVO will be trying to alert a non-existent address in memory about that changes, causing your app to throw this error.
Consider this, a class called MyViewController and you want to observe when the bounds property of it's view.layer changes indicating a layout change from landscape to portrait. So you add the line:
// self is MyViewController
self.view.layer.addObserver(self, forKeyPath: "bounds", options: .new, context: nil)

This will alert your class if the view size changed.
But if your viewController is dismissed, say a UINavigationController pops it off the stack, KVO is still going to try and alert MyViewController the view's bounds has changed (because now it's gone). Then when KVO does this your application is going to crash. In your debug console you would see the following message:
-[MyViewController retain]: message sent to deallocated instance

This is because you must remove the observer (MyViewController) for that keyPath. It is best to do this before MyViewController is dismissed, ike so:
override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    self.view.layer.removeObserver(self, forKeyPath: "bounds")
}

Now when you attempt to pop MyViewController from the navigation stack there will be no error.

A: This likely means you are trying to retain an object a UI object, such as a UIButton, that was released.  There are a number of ways to track down this issue but if you can narrow down where this is occurring in your app, I generally start commenting out releases until I see where the problematic release is.  My guess is you released something that was autoreleased.

A: I would like to something more than @Tony 's answer. As it is correct.
You might be using UI object's layer or its sublayer. So just check actually UI didnot got released before using it;
if(UI object) //has instance
{
   //now use UI object.
}


text:
Q: Scan wireless network for devices and their mac address on android 10+ I'm trying to implement a network scanner (like fing) to scan the wireless network and find all devices that are connected. The main issue here is reading their MAC address, since after android 10 you cannot access the ARP table on device. My question is that how apps like fing are working just fine? Can protocols like UPNP solve the problem somehow? Or is there another way that I couldn't find?
Note: the best working answer that I found was to use "ip neighbor" command, and that only works if your target sdk is 29 and below, go above and you get a permission exception.


text:
Q: Problems in transmission and reception in USRP N210 I am developing a code for transmission and reception of a txt file using fec correction and qam modulation. The main problem is in transmission it only send one character or nothing just for a second and then get freeze. It's the first time that i used GNU radio and i don't know what caused this problem can you check the code in the images below and tell me what it could be and how to solve this. If i am doing something wrong please tell me.
Sorry, I don't have the range to post images so instead that I posted links.
This is for TX
Txcode1
Txcode2
This is for RX
RXcode1
RXcode2

A: You're using an outdated version of GNU Radio, and within that, you're using the explicitly deprecated Packet Encoder, which randomly drops data. Don't do that, you had to pick that block from a category called "Deprecated" for a reason.
Also, it looks like you're using Throttle together with hardware. That doesn't work, and GRC also explicitly tells you it's a bad idea – you should pay attention to the console output in the lower left, it contains useful information!
So, don't start a new project on GNU Radio 3.7; GNU Radio 3.8 or 3.9 is trivial to install from Linux distro sources on any modern Linux Distro, and on Windows, you can use the excellent anaconda installer method.
Afterwards, orient on the examples that come with GNU Radio (installed, typically, under /usr/share/gnuradio/examples) in the digital subfolder. packet_loopback and other files will be good examples to learn from!
Other than that, make sure you've clicked on the "Get Started" button on gnuradio.org, and followed the tutorials up to the point of the PSK transmission tutorial. This should be a good entry to exactly what you're doing.