text:
Q: Ajax Loading different content through links what i am trying to do, when i click a tab, the address bar url should also change to that action plus it should also add the class to the anchor tag.
This is very nice example in jsfiddle, that i have seen someone shared on stackoverflow.
http://jsfiddle.net/VcQKr/2/
but problem here is that it works of adding and removing of class for li tag, but when i change this line
from
$parent.addClass("selected").siblings().removeClass("selected");

to
$t.addClass("selected").siblings().removeClass("selected");

then it only add classes to anchor tag but it dont remove classes from it??

A: That's because a elements are not siblings in your markup, you should select the siblings of the parent and remove the class from their a descendant elements.
$(this).addClass("selected")
       .parent()
       .siblings()
       .find('a')
       .removeClass("selected");

http://jsfiddle.net/FvxrL/


text:
Q: Who is the "Motherless bastard" that Petyr Baelish is talking about in S06E10? In the episode 6x10 of GOT, Littlefinger speaks with Sansa

 after they defeated the Boltons

He talks about his dream and they talk about who should lead the North. There Littlefinger has a line:

A trueborn daughter of Ned and Catelyn Stark born here at Winterfell or a motherless bastard born in the south?

Who does he speak of? In the context he could only mean Jon, because it's either him or Sansa who takes command.

But he talks about a motherless bastard from the south. Could Littlefinger know that Jon is the son of Rhaegar or did he only mean that he was born in the south, assuming that he is the child of Ned and that motherless means that no one knows who Jon's mother is?

Am I just over-interpreting things here, or does he speak of someone completely different?

A: He is talking about Jon.
Jon was born somewhere in South (We know it is Dorne but most people do not).
Eddard Stark went to war against King Aerys Targaryen with Robert Baratheon, Jon Arryn and Hoster Tully. The war was fought in South. When Eddard came back from war, he had Jon with him which made it clear for every one that Jon was born in South.
Jon is a bastard whose mother is unknown to most people. Therefore, Jon is the motherless bastard born in South while Sansa is the trueborn daughter born in Winterfell.
Also, Littlefinger could not possibly know about true parentage of Jon. Only two people knew of it; Lord Howland Reed and Lord Eddard Stark. And Eddard had openly declared Jon to be his son in front of the whole realm so that's what Littlefinger knows as well. This is proved by Baelish's conversation with Sansa in S06E05:

Baelish: The time may come when you need an army loyal to you.
Sansa: I have an army.
Baelish: Your brother's army. Half-brother.

So it is proven that Baelish thinks Jon is Sansa's half brother.
This "born in south" dialogue is an absurd innovation of show. Robb Stark was also born in Riverrun which is situated in South, not North.

A: He could be talking about Gendry, or one of Robert's other bastards.
The King in the North is not the ruler unless independence becomes real. If one of Robert's children take the throne in the South and manage to unify the land, then they would also rule the North.

redpajama_set_name: RedPajamaStackExchange


text:
Q: sending path image from java to python I'm trying to send image path from java to python,the path is sent but when i want to open it, it want open
java code
 public static void main(String[] args) {
      try {
                    // connect to python

                    ServerSocket server = new ServerSocket(8080);
                    Socket client = server.accept();
                    Process p = Runtime.getRuntime().exec("C:\\Python27\\Python C:\\Users\\acer\\Desktop\\py\\a.py");

                    BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
                    PrintWriter out = new PrintWriter(client.getOutputStream(),true);
                    out.println("C:\Users\acer\Desktop\py\6.bmp");
                    client.close();
                   // System.exit(0);
                } catch (IOException ex) {

                }

    }

python code
import socket
import random
import os, sys
import numpy
from PIL import Image
HOST = "localhost"
PORT = 8080
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOST, PORT))
data = sock.recv(1024)

d=str(data)
img = d
print "d",d
im = Image.open(data)
#print(im.size, im.format)
row, col = im.size
## some code.............

and it give this
d 6.bmp
Traceback (most recent call last):
  File "C:\Users\acer\Desktop\py\a.py", line 18, in <module>
    im = Image.open(data)
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 2634, in open
    fp = builtins.open(filename, "rb")
IOError: [Errno 22] invalid mode ('rb') or filename: '6.bmp\r\n'

i dont know what is \r\n i just want to send the image path to open the image in python

A: When you write data like this:
   out.println("C:\Users\acer\Desktop\py\6.bmp");

you are adding an end-of-line separator.
When you read the data like this:
   data = sock.recv(1024)
   d=str(data)

you will be including all of the data that you read in the string ... including the line separator.  And that is why the error message says:
   IOError: [Errno 22] invalid mode ('rb') or filename: '6.bmp\r\n'

See the \r\n?  That is the line separator.
You need to trim the line separator from the the filename ...
   im = Image.open(data.strip())


text:
Q: SCALA POI API. Cannot access Field Inherited I am writing a bit of code to read an excel file. At this point I am trying to determine the type of a cell.
    val wb:HSSFWorkbook= new HSSFWorkbook(fileInput)
    val sheet:HSSFSheet = wb.getSheetAt(0);
    val rows    = sheet.rowIterator()

    while(rows.hasNext()){
     var    row = rows.next()
    val cells = row.cellIterator()
    while(cells.hasNext()){
   val cell = cells.next()
   println(cell.getCellType()== org.apache.poi.hssf.usermodel.HSSFCell.CELL_TYPE_NUMERIC)}}

It says
   value CELL_TYPE_NUMERIC is not a member of object org.apache.poi.hssf.usermodel.HSSFCell

I dont understand why i cannot access this field. Could you please help on that.
regards

A: Scala treats static fields a bit different. In scala there are no static fields, so scala builds virtual objects for the static fields in java classes. As CELL_TYPE_NUMERIC is not defined on org.apache.poi.hssf.usermodel.HSSFCell but on org.apache.poi.ss.usermodel.Cell, you can't access it from there, because inheritance is not taken into account on static members. You can access the field directly:
scala> org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC
res1: Int = 0

If inheritance was taken into account, this would lead to inconsistencies with how scala objects work. In scala a companion object does not inherit anything from the companion of the classes superclass.


text:
Q: Set WordPress user email instead of billing email as default value for WooCommerce checkout field What I am trying to do is change the checkout fields so that if a user is logged in they can't edit their billing email field.
This code below works great however ideally I want to remove the situation where users are able to have 2 email address in the first place and set the value of $address_fields['billing']['billing_email'] to be the users email address from their account.
I've tried adding
'value' => $current_user->user_email

and
'default' => $current_user->user_email

to the array however this appears to do nothing.
So:

*

*Firstly, how can I set a value for this form and prevent it from being changed.

*Secondly, is $current_user->user_email the correct way to get the users account (contact) email and not the billing email from their account.

function custom_checkout_fields( $address_fields ) {

    $current_user = wp_get_current_user();

    if ( is_user_logged_in() ) {
        unset( $address_fields['billing']['billing_email'] );
        unset( $address_fields['billing']['billing_em_ver'] );

    $address_fields['billing']['billing_email'] = [
            'label' => 'Email address',
            'required'  => false,
            'description'   =>  'to change this please click here logout and login/register as another user or click here to modify the address on your account',
            'custom_attributes' => [
                'disabled' => 'disabled',
            ]
        ];

        return $address_fields;
    } else{
    return $address_fields;
    }
    }
    add_filter( 'woocommerce_checkout_fields', 'custom_checkout_fields' ,20, 1 );

A: Firstly, go to /plugins/woocommerce/templates/checkout, copy the form-billing.php template file found in that folder and paste it in yourTheme/woocommerce/checkout/.
Secondly, prevent WooCommerce from auto-filling the email address field by editing the copied form-billing.php template file and changing the following snippet:

      <?php
      $fields = $checkout->get_checkout_fields( 'billing' );

      foreach ( $fields as $key => $field ) {
        woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );
      }
      ?>

To this:

      <?php
      $fields = $checkout->get_checkout_fields( 'billing' );

      foreach ( $fields as $key => $field ) {
        if ( 'billing_email' != $key ) {
            woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );
        } else {
            woocommerce_form_field( $key, $field );
        }
      }
      ?>

Thirdly, inject the WordPress email to the field, make it immutable and add your custom description by adding the following to your theme's functions.php file:

function shillongtitude_billing_email_field($fields) {

  if ( is_user_logged_in() ) {

    $current_user = wp_get_current_user();

    //set the user email as the email field value
    $fields['billing']['billing_email']['default'] = $current_user->user_email;

    //set the description
    $fields['billing']['billing_email']['description'] = 'to change this please click here logout and login/register as another user or click here to modify the address on your account';

    // set attributes
    $fields['billing']['billing_email']['custom_attributes'] = array( 'readonly'=>'readonly', 'label' => 'Email address', 'required' => false );

    return $fields;
  } else {
    return $fields;
  }
}
add_filter('woocommerce_checkout_fields', 'shillongtitude_billing_email_field');

A: Use if you need changing user details while submitting new woo order

This function will compare checkout fields:

billing_first_name - billing_last_name - billing_email

with personal account fields:

first_name - last_name - display_name

and will update in case of discrepancy while submitting new order.
add_action('woocommerce_new_order', 'sync_woocommerce_email', 10, 2) ;
    function sync_woocommerce_email( $order_id ) {
        $current_user   = wp_get_current_user();
        $user_cname     = $current_user->display_name;
        $user_fname     = $current_user->first_name;
        $user_lname     = $current_user->last_name;
        $user_fullname  = $user_fname.' '.$user_lname;
        $bill_fname     = $current_user->billing_first_name;
        $bill_lname     = $current_user->billing_last_name;
        $bill_fullname  = $bill_fname.' '.$bill_lname;

        if ($current_user->user_email != $current_user->billing_email) {
            wp_update_user( array ( 'ID' => $current_user->ID, 'user_email' => $current_user->billing_email ) ) ;
        }
        if ($current_user->display_name != $bill_fullname) {
            wp_update_user( array ( 'ID' => $current_user->ID, 'display_name' => $bill_fullname ) ) ;
        }

    }


text:
Q: The signum function expressed using a single formula The signum function is defined as a piecewise function:  $\operatorname{sgn} (x)=\left\{ \begin{matrix}
   1,x>0  \\
   0,x=0  \\
   -1,x<0  \\
\end{matrix} \right.$.
Naturally, we could simplify this: $\operatorname{sgn}  (x)=\left\{ \begin{matrix}
   \frac{\left| x \right|}{x},x\ne 0  \\
   0,x=0  \\
\end{matrix} \right.$.
I'm just wondering is it possible to define this function using a single formula? I understand that the absolute value $\left| x \right|$ is a piecewise function itself but for the sake of this question let's assume we are allowed to use modulus to define the signum function.
Edit:
I completely agree with the answers given below; however, my original question was about the possibility to define the signum function using only elementary functions and the absolute value function (which itself is not an elementary function) in such a way that would require exactly one formula (i.e., avoiding a piecewise function).
For example, the following function $g\left( x \right)=\left\{ \begin{matrix}
   x,x>0  \\
   0,x\le 0  \\
\end{matrix} \right.$ can be defined in such a manner: $g\left( x \right)=\frac{x+\left| x \right|}{2}$.

A: Using only the arithmetic operations, the identity function and the absolute value, this does not seem possible, because the $\text{sgn}$ function is discontinuous. As far as I see, a discontinuity can only appear with a division by zero, which results in an undefined value in at least one point.


text:
Q: Generate mysqldump without comments I am generating a dump file form mysql using mysqldump -u root -p --databases dbname > dump.sql, and the file generated is as follows:
-- MySQL dump 10.13  Distrib 8.0.21, for osx10.15 (x86_64)
--
-- Host: localhost    Database: dbname
-- ------------------------------------------------------
-- Server version   8.0.21

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Current Database: `dbname`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `dbname` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;

USE `dbname`;

--
-- Table structure for table `tbname`
--

DROP TABLE IF EXISTS `tbname`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbname` (
  `volume_no` int NOT NULL,
  `issue_no` int NOT NULL,
  `page_no` int NOT NULL,
  `category` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `title` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`volume_no`,`issue_no`,`page_no`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

But this has many comments and info which I don't exactly need. Is there a way to directly get output without things like /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; etc. as despite being comments, these are generating errors when the file is executed from a python

A: /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; aren't really comments even though they look that way. They are conditional-execution tokens.
however you can skip comments by --skip-comments and you can try --compact as well


text:
Q: PHP Not able to capture MySQL binlog events on Percona Cluster I'm working with this package here: https://github.com/krowinski/php-mysql-replication
I've been able to test a very simple application on my local mysql database, with it working as expected.
However, once I moved my testing to our production systems, it appears to have stopped working.
Now, there are some natural differences between my local system and production, which I've outlined below.

*

*PHP Version: 7.4.9

*mysql version: 5.7.30-33-57-log Percona XtraDB Cluster (GPL), Release rel33, Revision 5dd6d59, WSREP version 31.43, wsrep_31.43

mysql> SHOW variables WHERE variable_name LIKE "%binlog%";
+--------------------------------------------+----------------------+
| Variable_name                              | Value                |
+--------------------------------------------+----------------------+
| binlog_cache_size                          | 32768                |
| binlog_checksum                            | CRC32                |
| binlog_direct_non_transactional_updates    | OFF                  |
| binlog_error_action                        | ABORT_SERVER         |
| binlog_format                              | ROW                  |
| binlog_group_commit_sync_delay             | 0                    |
| binlog_group_commit_sync_no_delay_count    | 0                    |
| binlog_gtid_simple_recovery                | ON                   |
| binlog_max_flush_queue_time                | 0                    |
| binlog_order_commits                       | ON                   |
| binlog_row_image                           | FULL                 |
| binlog_rows_query_log_events               | OFF                  |
| binlog_skip_flush_commands                 | OFF                  |
| binlog_space_limit                         | 0                    |
| binlog_stmt_cache_size                     | 32768                |
| binlog_transaction_dependency_history_size | 25000                |
| binlog_transaction_dependency_tracking     | COMMIT_ORDER         |
| encrypt_binlog                             | OFF                  |
| have_backup_safe_binlog_info               | YES                  |
| innodb_api_enable_binlog                   | OFF                  |
| innodb_locks_unsafe_for_binlog             | OFF                  |
| log_statements_unsafe_for_binlog           | ON                   |
| max_binlog_cache_size                      | 18446744073709547520 |
| max_binlog_files                           | 0                    |
| max_binlog_size                            | 1073741824           |
| max_binlog_stmt_cache_size                 | 18446744073709547520 |
| sync_binlog                                | 1                    |
| wsrep_forced_binlog_format                 | NONE                 |
+--------------------------------------------+----------------------+
28 rows in set (0.00 sec)

mysql> SHOW variables WHERE variable_name LIKE "server_%";
+----------------+--------------------------------------+
| Variable_name  | Value                                |
+----------------+--------------------------------------+
| server_id      | 3                                    |
| server_id_bits | 32                                   |
| server_uuid    | 4fe64515-be6b-11e9-8e7f-026f00293d26 |
+----------------+--------------------------------------+
3 rows in set (0.00 sec)

The application itself is very simple. It connects to the database, listens to any and all binlog events, and just dumps them to the console while running:
<?php
declare(strict_types=1);

error_reporting(E_ALL);
date_default_timezone_set('UTC');
include __DIR__ . '/vendor/autoload.php';

use MySQLReplication\Config\ConfigBuilder;
use MySQLReplication\Definitions\ConstEventsNames;
use MySQLReplication\Event\DTO\EventDTO;
use MySQLReplication\Event\EventSubscribers;
use MySQLReplication\MySQLReplicationFactory;

/**
 * Your db configuration
 * @see ConfigBuilder
 * @link https://github.com/krowinski/php-mysql-replication/blob/master/README.md
 */
$binLogStream = new MySQLReplicationFactory(
    (new ConfigBuilder())
        ->withUser('<DB_USER>')
        ->withHost('127.0.0.1')
        ->withPassword('<DB_PASS>')
        ->withPort(3306)
        ->withSlaveId(100)
        ->withHeartbeatPeriod(2)
        ->build()
);

/**
 * Register your events handler
 * @see EventSubscribers
 */
$binLogStream->registerSubscriber(
    new class() extends EventSubscribers
    {
        /**
         * @param EventDTO $event
         */
        public function allEvents(EventDTO $event): void
        {
            $data = json_encode($event);

            /**
             * log the event.
             */
            echo json_encode($event);
        }
    }
);

// start consuming events
$binLogStream->run();

When the application is actually run, the only events that fire are a heartbeat event that repeats indefinitely:
{
    "type": "heartbeat",
    "eventInfo": {
        "timestamp": 0,
        "type": 27,
        "id": 3,
        "size": 39,
        "pos": 11890,
        "flag": 0,
        "checkSum": true,
        "sizeNoHeader": null,
        "dateTime": null,
        "binLogCurrent": {
            "binLogPosition": 11890,
            "binFileName": "mysql-bin.000016",
            "gtid": null,
            "mariaDbGtid": null
        }
    },
    "subject": null,
    "arguments": null
}{
    "type": "heartbeat",
    "eventInfo": {
        "timestamp": 0,
        "type": 27,
        "id": 3,
        "size": 39,
        "pos": 11890,
        "flag": 0,
        "checkSum": true,
        "sizeNoHeader": null,
        "dateTime": null,
        "binLogCurrent": {
            "binLogPosition": 11890,
            "binFileName": "mysql-bin.000016",
            "gtid": null,
            "mariaDbGtid": null
        }
    },
    "subject": null,
    "arguments": null
}
...

Curiously, the binlog file information never changes, no matter how many heartbeat events are captured, including over several days.
The database cluster node is definitely updating in real time, but the events are not being captured.
Looking for any ideas on what the issue may be. I suspect it's a configuration issue, but I'm not sure what that could be.


text:
Q: "to not" vs "not to" Which is more appropriate in the following sentence?

"I asked him to not judge her according to (or: based on) her beauty"

vs

"I asked him not to judge her according to (or:based on) her beauty"

or maybe you wouldn't choose either of the above, but something else?

A: This is a matter of style. Both constructions are correct. But it's better to not split the infinitive(as what I've been taught in school). Ngram also shows that not to do is more common than to not do.

A: While I agree with user178049's response that this could just be an issue of style, I do believe that there is a subtle difference between the two.

I asked him to not judge her according to her beauty, but rather, to judge her according to her intelligence."

vs.

"I asked him not to judge her at all, especially not according to her beauty."

The words in italics are implied depending on where you had placed the "to" in the sentence.
What do you think? Do you feel that there is a difference between the two?


text:
Q: Play a sound while using try and catch Unable to compile. I am  trying to play a sound while using try and catch. The wav file is located on my desktop.
I am  getting errors such as:
    AudioStream cannot be resolved to a type
    AudioStream cannot be resolved to a type
    AudioPlayer cannot be resolved.
I am unsure how to fix this i know its something simple,
import java.io.FileInputStream;
import java.io.InputStream;

public class PlayMySoundApplication
{
public static void main(String[] args)
 throws Exception
{
// open the sound file as a Java input stream
String applause2x = "/Users/pc/Desktop/applause2x.wav";
InputStream in = new FileInputStream(applause2x);

// create an audiostream from the inputstream
AudioStream audioStream = new AudioStream(in);

// play the audio clip with the audioplayer class
AudioPlayer.player.start(audioStream);

A: I don't know what sound library you are trying to use.
If you are using a decent version of the JDK, that should do the trick :
import java.io.File;
import java.io.IOException;

import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.UnsupportedAudioFileException;

public class MakeSound {

    public static void main(String[] args) throws LineUnavailableException, UnsupportedAudioFileException, IOException {
        playSound("test.wav");
    }

    public static void playSound(String strFilename)
            throws LineUnavailableException, UnsupportedAudioFileException, IOException {

        File soundFile = new File(strFilename);

        AudioInputStream audioStream = AudioSystem.getAudioInputStream(soundFile);

        AudioFormat audioFormat = audioStream.getFormat();

        DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
        try (SourceDataLine sourceLine = (SourceDataLine) AudioSystem.getLine(info);) {
            sourceLine.open(audioFormat);
            sourceLine.start();

            int nBytesRead = 0;
            byte[] abData = new byte[128000];
            while (nBytesRead != -1) {
                nBytesRead = audioStream.read(abData, 0, abData.length);
                if (nBytesRead > 0) {
                    sourceLine.write(abData, 0, nBytesRead);
                }
            }

            sourceLine.drain();
        }
    }
}

HTH!

A: Add imports for audio,
import java.io.*;
import sun.audio.*;

public class PlayMySoundApplication
{
  public static void main(String[] args)
  throws Exception
  {
    // open the sound file as a Java input stream
    String applause2x = "/Users/pc/Desktop/applause2x.wav";
InputStream in = new FileInputStream(applause2x);

    // create an audiostream from the inputstream
    AudioStream audioStream = new AudioStream(in);

    // play the audio clip with the audioplayer class
    AudioPlayer.player.start(audioStream);
  }
}


text:
Q: Angular5 - Change parent's property from child component's input's [(ngModel)] binding I have already looked at this similar question without success. The plunker mentioned in the question seems to be broken.
I am trying to update parent component's property from child component's [(ngModel)] binding.
This is the child components HTML:

    <ion-input rows="1"  [value]="inputValue" [(ngModel)]="inputValue" (ngModelChange)="change($event)" ></ion-input>

This is the child components TS:
import { Component, EventEmitter, Input, Output, OnInit } from '@angular/core';

@Component({
  selector: 'app-childinput',
  templateUrl: './childinput.component.html',
  styleUrls: ['./childinput.component.css']
})
export class ChildinputComponent  {
@Input() inputValue: string;
  @Output() emitInputValue = new EventEmitter();
  constructor() { }

change(newValue) {
    console.log('newvalue', newValue)
    this.inputValue = newValue;
    this.emitInputValue.emit(newValue);
  }
}

This is how I'm using the child component in the parent component:
<app-childinput [(inputValue)]="thevalue" ></app-childinput>

The changed value should be reflected here: {{thevalue}}

Here is a STACKBLITZ demonstrating the issue. The parent component is the page callled "home", and the child component is the component called "childinput."
Am I doing something wrong or is this simply not possible anymore in Angular?

A: Just change emitInputValue to inputValueChange.
Fixed Stackblitz

A: childinput.component.html

    <ion-input rows="1"  [value]="inputValue" [ngModel]="inputValue" (ngModelChange)="change($event)" ></ion-input>

home.html and home.ts
change
<app-childinput [(inputValue)]="thevalue" ></app-childinput>

to
<app-childinput [inputValue]="thevalue" (emitInputValue)="update($event)" ></app-childinput>

update(event) {
    this.thevalue = event;
  }

You declared Output EventEmitter emitInputValue,  you didn't emit it properly. [(ngModel)] is two way binding which you mixed it with your Input decorator inputValue


text:
Q: Reduce extent of raster processing in ArcPy or ArcGIS Desktop? I need to reduce the processing extent of my raster by some sort of automatic procedure in python. Currently the borders of the dataset I've been using has anomalies (due to the classification of the landsat scanning lines).

I would like to reduce the extent of the raster processing so that when I retrieve the information above by a SetNull function the borders are not processed. Something like

Now this can easily be done with an extract by mask function (i.e. figure2) although that would require manual selection of the masking region. Is there a menthod I can utilize to calculate the extent region (ignoring nodata values) minus the border width in the x and y direction of each row/column and then utilize the arcpy.env.extent in Python?

A: This workflow deals first with the junk floating around the edges and then solves the problem.

*

*Create a binary indicator of the "border" area, which I take to include all surrounding NoData cells.  It is convenient to use any value to indicate the border and NoData for the rest, as in SetNull(Not(IsNull('X')), 1):

*Regiongroup the result and select the border component.  (This can usually be automated by selecting the component with the largest value of [Count].)  The image will look almost the same; only a few stray pixels in the center are excluded here--but they must be excluded for the next step to work.
(An alternative approach is to use morphological operations first to shrink the border and then re-expand it: this erases the isolated bits in the middle.)

*Compute the Euclidean distance grid to the border component.

*Mask out all small distances in the original image, as in SetNull(([Distance to Border component] < 30), X):

(The final image shows the original border in green overlaid, for reference, on the result.)


text:
Q: Использование AES-256-GCM в C Мне нужно шифровать сообщение AES-256-GCM в C без использования крупных библиотек.
Единственное что нашел - Tiny AES, но там нет поддержки GCM.

A: 1) Раз
2) Два
3) Три
Исходники из 3-го:
/*
 * Galois/Counter Mode (GCM) and GMAC with AES
 *
 * Copyright (c) 2012, Jouni Malinen <j@w1.fi>
 *
 * This software may be distributed under the terms of the BSD license.
 * See README for more details.
 */

#include "aes.h"

static void inc32(aes_uchar *block)
{
    aes_uint val;
    val = AES_GET_BE32(block + AES_BLOCK_SIZE - 4);
    val++;
    AES_PUT_BE32(block + AES_BLOCK_SIZE - 4, val);
}

static void xor_block(aes_uchar *dst, const aes_uchar *src)
{
    aes_uint *d = (aes_uint *) dst;
    aes_uint *s = (aes_uint *) src;
    *d++ ^= *s++;
    *d++ ^= *s++;
    *d++ ^= *s++;
    *d++ ^= *s++;
}

static void shift_right_block(aes_uchar *v)
{
    aes_uint val;

    val = AES_GET_BE32(v + 12);
    val >>= 1;
    if (v[11] & 0x01)
        val |= 0x80000000;
    AES_PUT_BE32(v + 12, val);

    val = AES_GET_BE32(v + 8);
    val >>= 1;
    if (v[7] & 0x01)
        val |= 0x80000000;
    AES_PUT_BE32(v + 8, val);

    val = AES_GET_BE32(v + 4);
    val >>= 1;
    if (v[3] & 0x01)
        val |= 0x80000000;
    AES_PUT_BE32(v + 4, val);

    val = AES_GET_BE32(v);
    val >>= 1;
    AES_PUT_BE32(v, val);
}

/* Multiplication in GF(2^128) */
static void gf_mult(const aes_uchar *x, const aes_uchar *y, aes_uchar *z)
{
    aes_uchar v[16];
    int i, j;

    memset(z, 0, 16); /* Z_0 = 0^128 */
    memcpy(v, y, 16); /* V_0 = Y */

    for (i = 0; i < 16; i++) {
        for (j = 0; j < 8; j++) {
            if (x[i] & 1 << (7 - j)) {
                /* Z_(i + 1) = Z_i XOR V_i */
                xor_block(z, v);
            } else {
                /* Z_(i + 1) = Z_i */
            }

            if (v[15] & 0x01) {
                /* V_(i + 1) = (V_i >> 1) XOR R */
                shift_right_block(v);
                /* R = 11100001 || 0^120 */
                v[0] ^= 0xe1;
            } else {
                /* V_(i + 1) = V_i >> 1 */
                shift_right_block(v);
            }
        }
    }
}

static void ghash_start(aes_uchar *y)
{
    /* Y_0 = 0^128 */
    memset(y, 0, 16);
}

static void ghash(const aes_uchar *h, const aes_uchar *x, size_t xlen, aes_uchar *y)
{
    size_t m, i;
    const aes_uchar *xpos = x;
    aes_uchar tmp[16];

    m = xlen / 16;

    for (i = 0; i < m; i++) {
        /* Y_i = (Y^(i-1) XOR X_i) dot H */
        xor_block(y, xpos);
        xpos += 16;

        /* dot operation:
         * multiplication operation for binary Galois (finite) field of
         * 2^128 elements */
        gf_mult(y, h, tmp);
        memcpy(y, tmp, 16);
    }

    if (x + xlen > xpos) {
        /* Add zero padded last block */
        size_t last = x + xlen - xpos;
        memcpy(tmp, xpos, last);
        memset(tmp + last, 0, sizeof(tmp) - last);

        /* Y_i = (Y^(i-1) XOR X_i) dot H */
        xor_block(y, tmp);

        /* dot operation:
         * multiplication operation for binary Galois (finite) field of
         * 2^128 elements */
        gf_mult(y, h, tmp);
        memcpy(y, tmp, 16);
    }

    /* Return Y_m */
}

static void aes_gctr(void *aes, const aes_uchar *icb, const aes_uchar *x, size_t xlen, aes_uchar *y)
{
    size_t i, n, last;
    aes_uchar cb[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE];
    const aes_uchar *xpos = x;
    aes_uchar *ypos = y;

    if (xlen == 0)
        return;

    n = xlen / 16;

    memcpy(cb, icb, AES_BLOCK_SIZE);
    /* Full blocks */
    for (i = 0; i < n; i++) {
        aes_encrypt(aes, cb, ypos);
        xor_block(ypos, xpos);
        xpos += AES_BLOCK_SIZE;
        ypos += AES_BLOCK_SIZE;
        inc32(cb);
    }

    last = x + xlen - xpos;
    if (last) {
        /* Last, partial block */
        aes_encrypt(aes, cb, tmp);
        for (i = 0; i < last; i++)
            *ypos++ = *xpos++ ^ tmp[i];
    }
}

static void * aes_gcm_init_hash_subkey(const aes_uchar *key, size_t key_len, aes_uchar *H)
{
    void *aes;

    aes = aes_encrypt_init(key, key_len);
    if (aes == NULL)
        return NULL;

    /* Generate hash subkey H = AES_K(0^128) */
    memset(H, 0, AES_BLOCK_SIZE);
    aes_encrypt(aes, H, H);
    aes_hexdump_key(MSG_EXCESSIVE, "Hash subkey H for GHASH", H, AES_BLOCK_SIZE);
    return aes;
}

static void aes_gcm_prepare_j0(const aes_uchar *iv, size_t iv_len, const aes_uchar *H, aes_uchar *J0)
{
    aes_uchar len_buf[16];

    if (iv_len == 12) {
        /* Prepare block J_0 = IV || 0^31 || 1 [len(IV) = 96] */
        memcpy(J0, iv, iv_len);
        memset(J0 + iv_len, 0, AES_BLOCK_SIZE - iv_len);
        J0[AES_BLOCK_SIZE - 1] = 0x01;
    } else {
        /*
         * s = 128 * ceil(len(IV)/128) - len(IV)
         * J_0 = GHASH_H(IV || 0^(s+64) || [len(IV)]_64)
         */
        ghash_start(J0);
        ghash(H, iv, iv_len, J0);
        AES_PUT_BE64(len_buf, 0);
        AES_PUT_BE64(len_buf + 8, iv_len * 8);
        ghash(H, len_buf, sizeof(len_buf), J0);
    }
}

static void aes_gcm_gctr(void *aes, const aes_uchar *J0, const aes_uchar *in, size_t len,
             aes_uchar *out)
{
    aes_uchar J0inc[AES_BLOCK_SIZE];

    if (len == 0)
        return;

    memcpy(J0inc, J0, AES_BLOCK_SIZE);
    inc32(J0inc);
    aes_gctr(aes, J0inc, in, len, out);
}

static void aes_gcm_ghash(const aes_uchar *H, const aes_uchar *aad, size_t aad_len,
              const aes_uchar *crypt, size_t crypt_len, aes_uchar *S)
{
    aes_uchar len_buf[16];

    /*
     * u = 128 * ceil[len(C)/128] - len(C)
     * v = 128 * ceil[len(A)/128] - len(A)
     * S = GHASH_H(A || 0^v || C || 0^u || [len(A)]64 || [len(C)]64)
     * (i.e., zero padded to block size A || C and lengths of each in bits)
     */
    ghash_start(S);
    ghash(H, aad, aad_len, S);
    ghash(H, crypt, crypt_len, S);
    AES_PUT_BE64(len_buf, aad_len * 8);
    AES_PUT_BE64(len_buf + 8, crypt_len * 8);
    ghash(H, len_buf, sizeof(len_buf), S);

    aes_hexdump_key(MSG_EXCESSIVE, "S = GHASH_H(...)", S, 16);
}

/**
 * aes_gcm_ae - GCM-AE_K(IV, P, A)
 */
int aes_gcm_ae(const aes_uchar *key, size_t key_len, const aes_uchar *iv, size_t iv_len,
           const aes_uchar *plain, size_t plain_len,
           const aes_uchar *aad, size_t aad_len, aes_uchar *crypt, aes_uchar *tag)
{
    aes_uchar H[AES_BLOCK_SIZE];
    aes_uchar J0[AES_BLOCK_SIZE];
    aes_uchar S[16];
    void *aes;

    aes = aes_gcm_init_hash_subkey(key, key_len, H);
    if (aes == NULL)
        return -1;

    aes_gcm_prepare_j0(iv, iv_len, H, J0);

    /* C = GCTR_K(inc_32(J_0), P) */
    aes_gcm_gctr(aes, J0, plain, plain_len, crypt);

    aes_gcm_ghash(H, aad, aad_len, crypt, plain_len, S);

    /* T = MSB_t(GCTR_K(J_0, S)) */
    aes_gctr(aes, J0, S, sizeof(S), tag);

    /* Return (C, T) */

    aes_encrypt_deinit(aes);

    return 0;
}

/**
 * aes_gcm_ad - GCM-AD_K(IV, C, A, T)
 */
int aes_gcm_ad(const aes_uchar *key, size_t key_len, const aes_uchar *iv, size_t iv_len,
           const aes_uchar *crypt, size_t crypt_len,
           const aes_uchar *aad, size_t aad_len, const aes_uchar *tag, aes_uchar *plain)
{
    aes_uchar H[AES_BLOCK_SIZE];
    aes_uchar J0[AES_BLOCK_SIZE];
    aes_uchar S[16], T[16];
    void *aes;

    aes = aes_gcm_init_hash_subkey(key, key_len, H);
    if (aes == NULL)
        return -1;

    aes_gcm_prepare_j0(iv, iv_len, H, J0);

    /* P = GCTR_K(inc_32(J_0), C) */
    aes_gcm_gctr(aes, J0, crypt, crypt_len, plain);

    aes_gcm_ghash(H, aad, aad_len, crypt, crypt_len, S);

    /* T' = MSB_t(GCTR_K(J_0, S)) */
    aes_gctr(aes, J0, S, sizeof(S), T);

    aes_encrypt_deinit(aes);

    if (memcmp(tag, T, 16) != 0) {
        aes_printf(MSG_EXCESSIVE, "GCM: Tag mismatch");
        return -1;
    }

    return 0;
}

int aes_gmac(const aes_uchar *key, size_t key_len, const aes_uchar *iv, size_t iv_len,
         const aes_uchar *aad, size_t aad_len, aes_uchar *tag)
{
    return aes_gcm_ae(key, key_len, iv, iv_len, NULL, 0, aad, aad_len, NULL, tag);
}

Ну и т.д.


text:
Q: Calculating the distance between two masses with respect to gravitational force Call them $m_1,m_2$. They are compressed to their center of masses, if you wish. If the initial distance at $t=0$ is $d$, is there a formula or an efficient way to calculate the distance between them at time $t$, provided, of course, that they haven't collided?
The problem is the circularity of the speed. It's not mere acceleration that pushes the masses together. If the masses approach each other with acceleration, the force will increase faster than it does, and then the masses are pushed into each other with more than just acceleration. This also means that it is not mere change in acceleration, because you could argue similarly. It must be something more "exponential" not polynomial.
But my knowledge of calculus doesn't help me here.

A: The force of attraction between $m_1$ and $m_2$ is given by
$$F = G\frac{m_1m_2}{r^2},$$ and so the acceleration of $m_1$ with respect to $m_2$ is given by
$$a = a_1 + a_2 = G\frac{m_1 + m_2}{r^2}.$$
Thus our problem becomes to solve the initial value problem
$$\frac{d^2r}{dt^2} = G\frac{m_1 + m_2}{r^2}, \frac{dr}{dt}(t = 0) = v_1(t = 0) + v_2(t = 0), r(t = 0) = d.$$
So if you can solve this IVP, you're done.


text:
Q: Why does mod_fastcgi in Apache complain that it does not have permission to create server? This is a very old FastCGI issue but I have never found a satisfactory answer.
Searching the phrase "(13) permission denied fastcgi can't create server" on Google will show that there's a lot of people experiencing this issue for a long while.
Some people blame it on selinux and suggest turning it off (not acceptable solution).
Other people think that it's a strange symlink permissions problem and suggest turning the Apache logs directory from symlink to a plain directory. (not acceptable, since it involves moving the logs files) See Installing FastCGI.
Below is the dreaded error as typically logged by Apache.
[Wed Jun 14 22:09:34 2009] [notice] Apache/2.0.40> (Red Hat Linux) configured
-- resuming normal operations
[Wed Jun 14 22:09:35 2009] [crit] (13)Permission
denied: FastCGI: can't create server "/var/rt3/bin/mason_handler.fcgi": bind()
failed [/etc/httpd/logs/fastcgi/70d9a528c5892f2bf0c25e5a334bed81]

Hoping serverfault can finally provide a definitive answer to this perplexing and annoying problem which has plague FastCGI users for years.
I feel uneasy implementing the suggested "cures" when no one really knows the underlying cause of this illness. Hope to get to the bottom of this mystery.

A: I've fixed this problem by
chown apache:apache /etc/httpd/logs/

A: From /usr/lib/errno.h
#define EACCES          13      /* Permission denied */

mod_fcgi communicates with fastCGI children via a named pipe. Apache creates the pipe before  spawning the children. I would guess that apache does not have permission to create
/var/rt3/bin/mason_handler.fcgi

To check this try
su - apache "touch /var/rt3/bin/mason_handler.fcgi"

If that failes, adjust the filesystem permissions appropriately to give apache permission to create a file in that directory.

A: For working under SELinux, try using mod_fcgid instead of mod_fastcgi.  I tried mod_fastcgi with SELinux on CentOS 5.6 for three hours and googled around and got nowhere.  It's an issue with mod_fastcgi trying to create the pipe/socket to communicate with the fastcgi apps.  I tried every permission/SELinux context I could think of on the /var/log/httpd/fastcgi folder (where mod_fastcgi creates the named pipe), but nothing worked.  Then I switched to mod_fcgid (downloaded EL5 rpm from rpm.pbone.net), which apparently doesn't use the same communication method to talk to the fastcgi apps, and everything worked perfectly, just as if the fastcgi app was a regular cgi app!  You still have to set the correct SELinux contexts on your files (see man page for httpd_selinux).  E.g. you want to do chcon -t httpd_sys_script_exec_t fcgiapp and also chcon -t httpd_sys_script_r[w|o|a]_t on any file your script accesses/modifies, and you may have to set some of the allow_httpd... booleans with the setsebool command.  And of course you have to set the regular file permissions correctly as well.  There are web tutorials that go through typical mod_fcgi configuration.

A: The user that the fastcgi process is running as doesn't have permissions to bind to whatever socket you're asking it to bind to.  There could be any number of reasons for it, there isn't enough information to make a useful diagnosis.


text:
Q: Using predict() with MCMCglmm I'm worried that this has been addressed somewhere before, but extensive searching hasn't revealed the answer I'm looking for. I'm running a random slopes model in MCMCglmm where I have an individual-by-covariate interaction in the random effects compartment. When using predict() to get estimates from this model, I run into an error, which I can't seem to deal with. The simpler example below (a random intercepts model) runs into the same error so I wonder what I'm doing wrong?
The example data consist of 20 individuals measured 20 times each for some covariate, with 10 individuals in each of two groups, plus a covariate and a response variable (y):
set.seed(123)

dat <- data.frame(id = rep(1:5, 20),
                  group = rep(1:2, each = 50),
                  covariate = rnorm(100),
                  y = rnorm(100))

dat

I then fit a simple random intercepts model with a categorical fixed effect, a continuous fixed effect and a random effect:
library(MCMCglmm)

fit <- MCMCglmm(y ~ group + covariate, random = ~id, rcov = ~ units, data = dat,
    family = "gaussian", pr = TRUE, pl = TRUE, saveX = TRUE,  saveZ = TRUE,
    nitt = 13000, thin = 10, burnin = 3000)

summary(fit)

I then make up a dummy data set to get predictions for the first individual in group 1 across a range of covariate values:
dummy <- data.frame(covariate = seq(-3, 3, 1),
                        group = rep(1, 7),
                        id = rep(1,7))
dummy$y <- 0

predict(fit, newdata = dummy)

The error I get is:
Error in predict.MCMCglmm(fit, newdata = preds, marginal = NULL) :
  model for newdata has fixed effects absent from the original model

And I don't really understand it, given all the fixed effects are included in both the model and the dummy data set and there are no missing values anywhere. If anyone could help I'd be very grateful!
Best wishes,
Adam

A: I think you have a constant group, if you try:
dummy <- data.frame(covariate = seq(-3, 3, 1),
                    group = c(rep(1, 3),rep(0,4)),
                    id = rep(1,7),y=0)
predict(fit, dummy)

this will work.

A: Only 18 months late but... I just tried running predict.MCMCglmm on model results with an intercept plus random effects, without creating a dummy dataset, and the resulting predictions ignored the random effects (they were identical for every data point). I think your problem is that 'id' is a random effect not a fixed effect. The error explicitly mentions absent fixed effects.


text:
Q: Text alignment in HTML table column through VBA I am trying to draft one Outlook mail body with html table using Excel VBA.
I am able to draft the mail with table and data. I am not able to align the text in the amount column as right alignment.
How do I align the text in the amount column to right?
Dim strTableHeader As String
Dim strTableBody As String
itb="abc"
balance=1000
strTableHeader = "" & _
                    "
" & _
                        TD("ITB") & _
                        TD("Balance Amount") & _
                    "
"

strTableBody= strTableBody & strTableHeader
strTableBody = strTableBody & _
                      "
" & _
                          TD(itb) & _
                          TD(balance) & _
                      "
"

I am using this in my mail sending procedure:
Sub sendmailmdl()
    DoEvents
    Set olApp = Outlook.Application
    Set objMail = olApp.CreateItem(olMailItem)
    With objMail

        .HTMLBody = ""  & strTableBody & " "

        .Display
        DoEvents

    End With
End Sub

where
TD(strIn As String) As String TD = "" & strIn & "	" End Function

A: Add
tbody tr td:nth-child(2) { text-align: right; }

to your stylesheet
or pass a second parameter to TD() to add
style="text-align: right; white-space:nowrap"

to the cell


text:
Q: When accessing the map function getting memory location as output I am trying to use a very simple function like converting list of strings to int value. As per the description we should get the list as output.
I am very new to Python so not sure whether I am doing any mistake.
l1 = ['1', '2', '9', '7', '5', '3']
l1 = map(int, l1)
print(l1)

Output:
<map object at 0x00000209FD5DC248>

A: Map function returns an iterable object and NOT a list. What that means is that you can iterate through the output of map and access each individual element. This example code might make it more clear.
l1 = ['1', '2', '9', '7', '5', '3']
l1 = map(int, l1)
for i in l1:
    print (i)

The output for this is:
1
2
9
7
5
3
Now assuming that your want to get back a list, all you need to do is type cast the iterable object returned by map to a list by explicitly calling 'list'.
l1 = ['1', '2', '9', '7', '5', '3']
l1 = list(map(int, l1))
print(l1)

which would give you something like this
[1, 2, 9, 7, 5, 3]

A: Major code:
numbers = (1, 2, 3, 4)
result = map(addition, numbers)
print(list(result))

Complete Result:
# Return double of n
def addition(n):
return n + n

# We double all numbers using map()
numbers = (1, 2, 3, 4)
result = map(addition, numbers)
print(list(result))

Output:

A: In python 3.x in-built functions like map() return an iterable which can be 'iterated' upon using a simple for loop. For printing your answer as a list you need to wrap your function in a list() call or use a list comprehension.
>>>list(map(int, l1))
>>>[element for element in map(int, l1)]


text:
Q: Iframe not fully loaded at first but works after refresh I have an embedded music player from Bandcamp on my website and it will often not load fully the first time the page is loaded, but it will work properly after a refresh. It does load partially, though. The image at the top and the songs in the playlist won't show up but the area in the middle with the current song will.
I normally test this by opening the site in a Chrome incognito window and about 2/3rds of the time it will not load the iframe properly but sometimes it does.
I'm on Wordpress and I've tried disabling both W3 Total Cache and Cloudflare but that doesn't seem to affect it. Any ideas or any way to check if the iframe has loaded fully and if not to automatically refresh it?
The website is https://civilaudio.com
Thank you!
The iframe code is:
Selected Audio Samples by Civil Audio by Michael Briggs

Screenshot of problem

A: I think I found a solution. If I add a random fake query string to the end of the URL in the iframe it will force it to reload properly.


text:
Q: Transaction check error when installing python3-devel I am trying to pip3 install uwsgi with virtualenv on centos7, but it shows
In file included from plugins/python/pyutils.c:1:0:
    plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
     #include <Python.h>

I trying to yum install python3-devel and it shows
Transaction check error:
  file /etc/rpm/macros.ghc-srpm from install of redhat-rpm-config-9.1.0-88.el7.centos.noarch conflicts with file from package epel-release-6-8.noarch

I trying to `yum update' and it shows

Error: Package: remi-release-6.10-1.el6.remi.noarch (installed)
          Need: epel-release = 6
          Deleting: epel-release-6-8.noarch (installed)
              Epel-release = 6-8
          Updated by: epel-release-7-11.noarch (epel)
              Epel-release = 7-11
 You could try using --skip-broken to work around the problem

and --skip-broken didn't solve anything
any idea how to move forward?

A: It is strange that you use epel-release-6.8 on centos7. Normally you should install epel-release-7.* .
On my centos7 machine I have epel-release-7.11 installed which does not contain the /etc/rpm/macros.ghc-srpm file. So I would recommend upgrading epel-release...

A: I got the same problem.
This happens when I add epel repo to 32bit CentOS7.
Because there is no 32bit epel since CentOS7, I had to add 32bit epel for CentOS6 to my CentOS7.
I got python3.6 now, but can not get python3-devel through yum.
Maybe you can get it after disabling other repos?


text:
Q: Macro within a loop and include In Stata, I'm trying to use the command include to run several regressions in one do file. The overall goal is to help in forecasting Natural Gas production.
I have a do file for each product and basin that I'm interested in. Within each do file I am running several versions of the regression based on data available at specific times (e.g. the first set of regressions is for product type 4, in basin 2, with information available in June 2020).
The regression command within the do file looks something like this:
include "gas\temp\NG var.doh"

foreach time in  dec14 dec15 dec16 dec17  previous current {
    arima price_`perm4type' `perm4pvars' if tin(,`yq_`time'') , ar(1) ma()
}

I have the perm4pvars defined in the file NG var.doh like this:
local perm4pvars  txfreeze PNGHH_`time' d.CPIE_`time' d.IFNRESPUOR_`time' POILWTI_`time'

When I run  my do file the time from my doh file doesn't show up. So I get an error message: "PNGHH_ is an ambiguous abbreviation"
How can I get the time to show up in my regress command?
I did try doing this in my .doh file
foreach time in  dec14 dec15 dec16 dec17  previous current {
    local perm4pvars  txfreeze PNGHH_`time' d.CPIE_`time' d.IFNRESPUOR_`time' POILWTI_`time'
}

I got it to run, only for time=current

A: The relationship between the included .do file and the main .do file is not symmetric.
The point of include is that the included do file is read into the main do file. But the included do file knows nothing about any files it is included in. So definitions in the included do file may not usefully refer to definitions in the main .do file, or to any others, unless they in turn are included, or so I presume.
That explains why your reference to local macro time in the included file doesn't do what you want. It's not illegal in any do file or Stata program to refer to a local macro that doesn't exist (meaning, is not visible from the file) but as here the consequences may not be what you want.

A: Imo your issue is more basic than what the above answer suggests, in that you want to use locals from a loop outside of it. Or, in the case where you got it to run for time=current, misunderstanding what the loop does. Might be good to get a good understanding of the functioning of loops first, also since you seem to be using multiple other loops that are not detailed in your question and where I can only assume those are specified correctly.
Assuming the gas\temp\NG var.doh file only holds the line defining the local, i.e. local perm4pvars txfreeze PNGHH_`time' d.CPIE_`time' d.IFNRESPUOR_`time' POILWTI_`time', a way to get it working the way you want (or at least how I think you want it, since you do not detail the specifications you want to achieve with your loop) is to move the include inside the loop, changing your code to:
foreach time in dec14 dec15 dec16 dec17 previous current {
    include "gas\temp\NG var.doh"
    arima price_`perm4type' `perm4pvars' if tin(,`yq_`time'') , ar(1) ma()
}

This way, the line in the included .do file can use the local time from the loop. In the case there is more in the .doh file you would have to change your code a bit more to get it to work, however I can't help you with that unless you give me more information about the structure of the code and what you want to achieve with it.


text:
Q: styled-jsx works inline but not as module I've added styled-jsx to my Preact (set up with this TS template) project, and can style things inline via the

But if I extract that style into a separate css variable (either in the same file or externally) while following their instructions I get the following error:
if you are getting this error it means that your `css` tagged template literals were not transpiled.

There's a few answers/solutions to it on SO and Github but they all involve changing the webpack config -- and I don't have a webpack config. Looks like there isn't one out of the box with preact-cli. I've added the babel rule to my babelrc as recommended:
{
  "presets": ["preact-cli/babel"],
  "plugins": [["styled-jsx/babel", { "optimizeForSpeed": true }]]
}

I didn't install any extra macros or plugins from babel, however, as that was not in the original instructions in the styled-jsx readme.

A: Using .babelrc isn't supported at the moment in Preact-CLI, though this is due to an odd bug that I haven't yet been able to track down. Sorry about that.
You do however still have a way to edit the Webpack config, and that's with your preact.config.js, the docs for which can be found here. In your case, what you'll want is the following:
preact.config.js
export default (config, env, helpers) => {
    const { rule } = helpers.getLoadersByName(config, 'babel')[0];
    const babelConfig = rule.options;

    babelConfig.plugins.push(['styled-jsx/babel', { 'optimizeForSpeed': true }]);
}

Let me know if this fixes your issue.


text:
Q: How to simultaneously play/stream a video and save it to app cache? I am developing a video playing app where an user can watch live streaming video as well as to save it app cache. I can stream a video using this code portion
videoView = (VideoView) rootView.findViewById(R.id.video_view);
videoView.setMediaController(new MediaController(this));
videoView.setVideoURI(Uri.parse(videoURL));
videoView.start();

I don't know how to cache the video in app storage by which user cannot modify or move the video content. So my question is How to cache a video in app storage? Is not possible or has performance issue? What are the alternative solution for this problem?

A: AndroidVideoCache solves this problem. It allows stream and cache video simultaneously.


text:
Q: RolloutWorker problem when try to execute PPOConfig: Exception raised in creation task: The actor died because of an error raised in its creation task I am trying to follow the steps mentioned on "Getting Started with RLlib" (https://docs.ray.io/en/latest/rllib/rllib-training.html) along with my custom environment.
However my run doesn't work in the first code block show in the guide.
This is actually the script I m trying to run:
import ray
from ray.rllib.algorithms.ppo import PPOConfig
from ray.tune.logger import pretty_print
from gym_sw_env.envs.Examplev2 import Example_v2 #this is my custom env

ray.init(ignore_reinit_error=True)

algo = (
    PPOConfig()
    .rollouts(num_rollout_workers=1)
    .resources(num_gpus=0)
    .environment(env=Example_v2)
    .build()
)

While this is the error I have:
(RolloutWorker pid=24420) 2022-12-17 11:36:34,235   ERROR worker.py:763 -- Exception raised in creation task: The actor died because of an error raised in its creation task, ray::RolloutWorker.__init__() (pid=24420, ip=127.0.0.1, repr=<ray.rllib.evaluation.rollout_worker.RolloutWorker object at 0x000001693BEB1C10>)
(RolloutWorker pid=24420)   File "python\ray\_raylet.pyx", line 859, in ray._raylet.execute_task
(RolloutWorker pid=24420)   File "python\ray\_raylet.pyx", line 863, in ray._raylet.execute_task
(RolloutWorker pid=24420)   File "python\ray\_raylet.pyx", line 810, in ray._raylet.execute_task.function_executor
(RolloutWorker pid=24420)   File "C:\Users\**MYUSER**\Anaconda3\lib\site-packages\ray\_private\function_manager.py", line 674, in actor_method_executor
(RolloutWorker pid=24420)     return method(__ray_actor, *args, **kwargs)
(RolloutWorker pid=24420)   File "C:\Users\**MYUSER**\Anaconda3\lib\site-packages\ray\util\tracing\tracing_helper.py", line 466, in _resume_span
(RolloutWorker pid=24420)     return method(self, *_args, **_kwargs)
(RolloutWorker pid=24420)   File "C:\Users\**MYUSER**\Anaconda3\lib\site-packages\ray\rllib\evaluation\rollout_worker.py", line 492, in __init__
(RolloutWorker pid=24420)     self.env = env_creator(copy.deepcopy(self.env_context))
(RolloutWorker pid=24420)   File "C:\Users\**MYUSER**\Anaconda3\lib\site-packages\ray\rllib\algorithms\algorithm.py", line 2139, in <lambda>
(RolloutWorker pid=24420)     return env_id, lambda cfg: env_specifier(cfg)
(RolloutWorker pid=24420) TypeError: __init__() takes 1 positional argument but 2 were given
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In [3], line 7
      2 from ray.tune.logger import pretty_print
      3 from gym_sw_env.envs.Examplev2 import Example_v2
      6 algo = (
----> 7     PPOConfig()
      8     .rollouts(num_rollout_workers=1)
      9     .resources(num_gpus=0)
     10     .environment(env=Example_v2)
     11     .build()
     12 )

File ~\Anaconda3\lib\site-packages\ray\rllib\algorithms\algorithm_config.py:311, in AlgorithmConfig.build(self, env, logger_creator)
    308 if logger_creator is not None:
    309     self.logger_creator = logger_creator
--> 311 return self.algo_class(
    312     config=self.to_dict(),
    313     env=self.env,
    314     logger_creator=self.logger_creator,
    315 )

File ~\Anaconda3\lib\site-packages\ray\rllib\algorithms\algorithm.py:414, in Algorithm.__init__(self, config, env, logger_creator, **kwargs)
    402 # Initialize common evaluation_metrics to nan, before they become
    403 # available. We want to make sure the metrics are always present
    404 # (although their values may be nan), so that Tune does not complain
    405 # when we use these as stopping criteria.
    406 self.evaluation_metrics = {
    407     "evaluation": {
    408         "episode_reward_max": np.nan,
   (...)
    411     }
    412 }
--> 414 super().__init__(config=config, logger_creator=logger_creator, **kwargs)
    416 # Check, whether `training_iteration` is still a tune.Trainable property
    417 # and has not been overridden by the user in the attempt to implement the
    418 # algos logic (this should be done now inside `training_step`).
    419 try:

File ~\Anaconda3\lib\site-packages\ray\tune\trainable\trainable.py:161, in Trainable.__init__(self, config, logger_creator, remote_checkpoint_dir, custom_syncer, sync_timeout)
    159 start_time = time.time()
    160 self._local_ip = ray.util.get_node_ip_address()
--> 161 self.setup(copy.deepcopy(self.config))
    162 setup_time = time.time() - start_time
    163 if setup_time > SETUP_TIME_THRESHOLD:

File ~\Anaconda3\lib\site-packages\ray\rllib\algorithms\algorithm.py:549, in Algorithm.setup(self, config)
    536 except RayActorError as e:
    537     # In case of an actor (remote worker) init failure, the remote worker
    538     # may still exist and will be accessible, however, e.g. calling
    539     # its `sample.remote()` would result in strange "property not found"
    540     # errors.
    541     if e.actor_init_failed:
    542         # Raise the original error here that the RolloutWorker raised
    543         # during its construction process. This is to enforce transparency
   (...)
    547         # - e.args[0].args[2]: The original Exception (e.g. a ValueError due
    548         # to a config mismatch) thrown inside the actor.
--> 549         raise e.args[0].args[2]
    550     # In any other case, raise the RayActorError as-is.
    551     else:
    552         raise e

File python\ray\_raylet.pyx:852, in ray._raylet.execute_task()

File python\ray\_raylet.pyx:906, in ray._raylet.execute_task()

File python\ray\_raylet.pyx:859, in ray._raylet.execute_task()

File python\ray\_raylet.pyx:863, in ray._raylet.execute_task()

File python\ray\_raylet.pyx:810, in ray._raylet.execute_task.function_executor()

File ~\Anaconda3\lib\site-packages\ray\_private\function_manager.py:674, in actor_method_executor()
    672     return method(*args, **kwargs)
    673 else:
--> 674     return method(__ray_actor, *args, **kwargs)

File ~\Anaconda3\lib\site-packages\ray\util\tracing\tracing_helper.py:466, in _resume_span()
    464 # If tracing feature flag is not on, perform a no-op
    465 if not _is_tracing_enabled() or _ray_trace_ctx is None:
--> 466     return method(self, *_args, **_kwargs)
    468 tracer: _opentelemetry.trace.Tracer = _opentelemetry.trace.get_tracer(
    469     __name__
    470 )
    472 # Retrieves the context from the _ray_trace_ctx dictionary we
    473 # injected.

File ~\Anaconda3\lib\site-packages\ray\rllib\evaluation\rollout_worker.py:492, in __init__()
    485 # Create a (single) env for this worker.
    486 if not (
    487     worker_index == 0
    488     and num_workers > 0
    489     and not policy_config.get("create_env_on_driver")
    490 ):
    491     # Run the `env_creator` function passing the EnvContext.
--> 492     self.env = env_creator(copy.deepcopy(self.env_context))
    494 if self.env is not None:
    495     # Validate environment (general validation function).
    496     if not self._disable_env_checking:

File ~\Anaconda3\lib\site-packages\ray\rllib\algorithms\algorithm.py:2139, in Algorithm._get_env_id_and_creator.<locals>.<lambda>()
   2137         return env_id, lambda cfg: _wrapper.remote(cfg)
   2138     else:
-> 2139         return env_id, lambda cfg: env_specifier(cfg)
   2141 # No env -> Env creator always returns None.
   2142 elif env_specifier is None:

TypeError: __init__() takes 1 positional argument but 2 were given

Does anybody know how to resolve it? I am just following the first step of the guide.
I am just try to remove the build() method for PPOConfigure, so I have:
algo = (
    PPOConfig()
    .rollouts(num_rollout_workers=1)
    .resources(num_gpus=0)
    .environment(env=Example_v2)
)

And this doesn't produce any error. So the question may be also: is build() method necessary?
I am trying to search other errors like this, but nothing was found.


text:
Q: does the volume of a ball remain constant under deformation? I'm a psychology student and was reading Piaget, he says that the volume of a sphere (ball of clay) remains constant if we deform the sphere into a roll for example, If you take the limit case of the roll its volume goes to zero as one of its dimensions goes to zero, I mean, its length increases but the diameter decrases. Using the intermediate value theorem could I say that when the sphere is deformed its volume is not conserved?. I am not a mathematics student, I guess I should say it is continue uosly deformed and add some more information, I did the best I could.

A: Say, the volume is $V$ and the roll is a cylinder of height $h$ and radius $r$. Then
$\pi r^2h=V $
hence $h = V/(\pi r^2)$. As the radius $r$ approaches $0$, the height $h$ grows indefinitely. One expresses this as
$$
\lim_{r\to 0} V/(\pi r^2) = \infty
$$
The volume does remain constant in the process.
The apparent contradiction arises when you imagine that $r$ actually becomes $0$ in the process, and then conclude that the volume suddenly drops from $V$ to $0$. But $r$ never becomes $0$ in reality. It can be arbitrarily small, but not zero.
To speculate about the volume of a "cylinder" with zero radius and infinite height is about as productive as to debate what would happen if an unstoppable object collided with an immovable one.

A: I shall answer this question to myself five years ago:
It depends on what transformations you are considering, if you are defining volume preserving transformations then the volume will be preserved (I tell you now that I know it is symplectic geometry what studies those transformations that you thought were a huge theorem for one of Piaget's children to naturally realize). Although you were intuitively thinking about something called a homotopy from the ball, to the cylinder to the line segment and there volume is not preserved. The interplay of topological transformations and geometrical transformations of a space is probably the most beautiful thing I have seen. This is proof for the power of curiosity.


text:
Q: Ant sshexec task called from gradle doesn't show output I want to use Apache ant sshexec task in my gradle custom task. The problem is that this task doesn't work (output is not shown in console and sshexec action is not executed). This is how I use it:
configurations {
    sshexecAntTask
}

repositories {
    mavenCentral()
}

dependencies {
    sshexecAntTask 'org.apache.ant:ant-jsch:1.7.0'
}

// ----------------------------------------------------

import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files

class MyCustomTask extends DefaultTask {

    @TaskAction
    def build() {
        String command = ""
        command = 'cmd.exe /C mdir C:\\aadd'
        runSshCommand(command)
    }

    private void runSshCommand(String command) {
        String host = "host"
        String username = "username"
        String password = "password"

        ant.taskdef(name: 'sshexec', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.SSHExec', classpath: project.configurations.sshexecAntTask.asPath)
        // this command is not executed; why?
        ant.sshexec(host: host, username: username, password: password, command: command, trust: 'true', failonerror: 'true')
    }

}

[EDIT]
I've tested sshexec and those are my results:

*

*The command cmd.exe /C echo test > C:\testresult.txt started from ant works correctly and output is returned to file.

*The command cmd.exe /C echo test > C:\testresult.txt started from gradle works correctly and output is returned to file. Great!

*The command cmd.exe /C echo test started from ant works correctly and output is returned to stdout. !

*The command cmd.exe /C echo test started from gradle works correctly but output is not returned to stdout. !

*The command cmd.exe /C mkdir C:\\\\Inetpub\\\\ftproot\\\\temp\\\\jakisnowykatalog started from ant works correctly and directory is created (I need to use \\\\ as path separator because \\, \, / doesn't work)

*The command cmd.exe /C mkdir C:\\\\Inetpub\\\\ftproot\\\\temp\\\\jakisnowykatalog started from gradle doesn't work and directory is not created.

I should add that I want to connect with windows ssh server (not unix/mac) but I've also tested those commands with mac shh without success. Please help!
[Another edit]
I've created groovy test code which uses jsch library to execute command and it works. I still don't know why ant task doesn't work.
import com.jcraft.jsch.*
import java.util.Properties;

private void jschTest() {
    Session session = null
    Channel channel = null
    try {
        JSch jsch = new JSch()
        session = jsch.getSession("host", "login", 22)
        session.setPassword("password")
        Properties config = new Properties()
        config.put("StrictHostKeyChecking", "no")
        session.setConfig(config)
        session.connect()

        String command = "cmd.exe /C mkdir C:\\gradledir"
        channel = session.openChannel("exec");
        ((ChannelExec)channel).setCommand(command);
        channel.connect()
    }
    catch (Exception e) {
        println e.getMessage()
    }
    finally {
        if (session!=null) {
            session.disconnect()
        }
        if (channel!=null) {
            channel.disconnect()
        }
    }
}

A: Assuming you declare a task of type MyCustomTask and execute it correctly, I see no reason why the Ant task wouldn't get executed. The problem is more likely elsewhere (e.g. wrong configuration of the Ant task).


text:
Q: What was New World Computing's "Hall of Heroes"? After finishing Anvil of Dawn, a message appears that congratulates the player and shows the achieved game score.
They invite you to send your game score to this address:

Hall of Heroes
  New World Computing
  PO Box 4302
  Hollywood CA 90078

As there is no New World Computing anymore (well, and as the game is 20 years old), I guess this won't work anymore.
But does anyone know what would have happened back then? What was the point in sending your score to them? What was this Hall of Heroes?

A: The SynTax issue 42 (from 1996) contains a review of Anvil of Dawn, in which the author, MerC, writes:

At the very end you are given a score (mine was 101,603 - whatever
  that means) and invited to send it to the Hall of Heroes,
  somewhere in the USA.

Sue, the publisher, adds:

@~That's probably worth doing; I sent off my scores after playing
  @~Might and Magic III and IV (same authors, New World) and got
  @~very nice parchment certificates in return

So, assuming that New World Computing did the same thing for Anvil of Dawn scores like they (probably) did for Might and Magic scores, you would have got a parchment certificate.
(I welcome any first-hand experience to verify/debunk this. And I would love to see a photo of such a certificate, or whatever it may have been.)


text:
Q: Unable to write into text file using ios:ate in c++ I am using Visual Studio 2017 to practice C++, I have had some experience of C++ on TurboC++.
Trying to create a program that reads and writes from file, I am having trouble when I use the "ios::Ate" while opening the file.

file.open("text.txt", ios::ate);

My code is as follows.
#include "pch.h"
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    fstream file;
    file.open("text.txt", ios::ate);

    char a;

    while(1){
        cin.get(a);
        if (a != '0')
            file << a;
        else break;
    }

    file.close();
}

When I run this program, is runs without errors but when I open the file it is empty.
I have tried using ios::out and it works fine but I do not want to truncate the file every time I want to write into it.

A: You code assumes the file exists. you're not specifying an i/o direction, and you should always check whether an operation, e.g. file.open, succeeds.
int main()
{
    fstream file;

// open or create file if it doesn't exist, append.
    file.open("text.txt", fstream::out | fstream::app);

// did the file open?
    if (file.is_open()) {
        char a;

        while (1) {
            cin.get(a);
            if (a != '0')
                file << a;
            else break;
        }

        file.close();
    }
}


text:
Q: Matrices of combinatorial sequences that are inverse in two ways I'm interested in pairs $A=(a_{i,j})_{i,j=0,1,\ldots}$ and $B=(b_{i,j})_{i,j=0,1,\ldots}$ of infinite matrices for which:

*

*They are uni-lower-triangular, i.e., $a_{i,i}=1$ for all $i$ and $a_{i,j}=0$ for all $j>i$.

*They are inverses, i.e. their product $AB$ is the identity.

*The generating function of the $k$th column of $A$ is the reciprocal of the generating function of the $(k+1)$st row of $B$, that is,
$$ \sum_{j=k}^{\infty}a_{j,k} \; x^{j-k}= \big(\sum_{i=0}^{k+1}b_{k+1,k+1-i} \; x^{i}\big)^{-1}.$$
Notice how for the generating function of columns we start at the $1$ on the diagonal and go down, while for the generating function of rows we start at the $1$ on the diagonal and go left (and all g.f.'s are normalized to start with the constant term).

I have a handful of examples of this occurring with matrices of combinatorial significance:
Example 1. We let $a_{i,j}=\binom{i}{j}$ and $b_{i,j}=(-1)^{i-j}\binom{i}{j}$. Note the generating function of the $k$th row of $B$ is $(1-x)^{k}$, and the generating function of the $(k-1)$th column of $A$ is $1/(1-x)^{k}$.
Example 2. We let $a_{i,j}=S(i+1,j+1)$ and $b_{i,j} = s(i+1,j+1)$, where $S(n,k)$ and $s(n,k)$ are the Stirling numbers of the 2nd and 1st kind, respectively (the shift by one is just to match my convention that indexing of rows/columns starts at $0$). This looks like
$$ A = \begin{pmatrix} 1 & 0 & 0 & 0 & \cdots \\ 1 & 1 & 0 & 0 \\ 1 & 3 & 1 & 0 \\ 1 & 7 & 6 & 1 \\ \vdots & & & & \ddots \end{pmatrix} \qquad B = \begin{pmatrix} 1 & 0 & 0 & 0 & \cdots \\ -1 & 1 & 0 & 0 \\ 2 & -3 & 1 & 0 \\ -6 & 11 & -6 & 1 \\ \vdots & & & & \ddots \end{pmatrix}$$
Note that the generating function of the $k$th row of $B$ (and the reciprocal of the generating function of the $(k-1)$th column of $A$) is $(1-x)(1-2x)\cdots(1-kx)$.
Example 3. The previous examples were over $\mathbb{Z}$, this example is over $\mathbb{Z}[q]$; actually it is a $q$-analog of Example 1. We let $a_{i,j} = \binom{i}{j}_q$ be the usual $q$-binomial $\binom{i}{j}_q = \frac{(1-q^i)(1-q^{i-1})\ldots(1-q^{i-j+1})}{(1-q^j)(1-q^{j-1})\ldots(1-q)}$, and we let $b_{i,j} = (-1)^{i-j} \; q^{\binom{i-j}{2}} \; \binom{i}{j}_q$. This looks like:
$$ A = \begin{pmatrix} 1 & 0 & 0 & 0 & \cdots \\ 1 & 1 & 0 & 0 \\ 1 & q+1 & 1 & 0 \\ 1 & q^{2}+q+1 & q^{2}+q+1 & 1 \\ \vdots & & & & \ddots \end{pmatrix} \qquad B = \begin{pmatrix} 1 & 0 & 0 & 0 & \cdots \\ -1 & 1 & 0 & 0 \\ q & -(q+1) & 1 & 0 \\ -q^3 & q^3+q^2+q & -(q^2+q+1) & 1 \\ \vdots & & & & \ddots \end{pmatrix}$$
Note that the generating function of the $k$th row of $B$ (and the reciprocal of the generating function of the $(k-1)$th column of $A$) is $(1-x)(1-qx)\cdots(1-q^{k-1}x)$.
Question 1. What is going on here? Why are these pairs of matrices of combinatorial sequences inverse "in two ways"? How is being inverse in one way related to being inverse in the other way?
Note that all of these examples come from sequences of uniform posets: they are the Whitney numbers of the 2nd and 1st kind of these posets. Hence, this question is related to my previous question. (But it's easy to come up with sequences of uniform posets whose matrices are not "inverse in the 2nd way.")
Also note that in all the examples, the generating function of the $(k+1)$st column of $A$ is obtained from the generating function of the $k$th column by multiplying by a simple factor; but (except for Example 1), it is not exactly the same factor every time, so these matrices are not quite Riordan arrays.
Question 2. Can you find some more examples of matrices of combinatorially significant sequences with these properties?
EDIT: One further observation is that you can take any such pair $A=(a_{i,j})$, $B=(b_{i,j})$ of matrices and get another one $A'$, $B'$ by choosing some constant $\kappa$ and setting $a'_{i,j}=\kappa^{i-j} \; a_{i,j}$, $b'_{i,j}=\kappa^{i-j} \; b_{i,j}$. So for example from the Pascal's triangle example you can (basically) get the $f$-vectors of the cross polytope this way.

A: Gjergji Zaimi's answer appears to completely address question 1, but that leaves question 2. On the assumption that OEIS is a good place to look for known matrices of combinatorial significance, I wrote a program to scan an offline copy of the OEIS sequence data for candidate $A$ or $B$ matrices. Unsurprisingly, most of them fall into a small number of families related to binomial coefficients or Stirling numbers. There are relatively few for which both the $A$ and $B$ matrices are present.
First, for completeness, OEIS sequence numbers for those directly related to the ones mentioned in the question, and moderately direct generalisations thereof.

*

*Coefficient sequence $(s, s, s, \ldots)$: when $s = 1$ we get $A = \textrm{A007318}$, Pascal's triangle, and $B = \textrm{A130595}$, signed Pascal's triangle. When $s = 0$ we get $A=B=\textrm{A023531}$, which can be interpreted as the identity matrix. For $s = 2, 3, \ldots, 15$ the $A$ matrix is in OEIS, and it's also the $B$ matrix for the negated value of $s$. These sequences are A038207, A027465, A038231, A038243, A038255, A027466, A038279, A038291, A038303, A038315, A038327, A133371, A147716, A027467.
We can generalise further to $(s, t, t, t, \ldots)$ and find a lot of triangles in OEIS:
 s   t   A matrix   B matrix   Comments
 -2 -4              A193735
 -2 -3              A193723    Matrix product A200139 (B matrix for s=-1, t=-2) * A007318 (A matrix for s=t=1)
 -1 -3              A136158
 -3 -2              A209149
 -1 -2              A200139
  1 -2   A251634    A251636
-10 -1              A093645    (10,1) Pascal triangle
 -9 -1              A093644    (9,1) Pascal triangle
 -8 -1              A093565    etc.
 -7 -1              A093564
 -6 -1              A093563
 -5 -1              A093562
 -4 -1              A093561
 -3 -1              A093560
 -2 -1   A103316    A029653
 -1 -1   A130595    A007318
  0 -1              A097805
  1 -1   A112468    A112467
 10 -1   A164881
 -2  0              A156319    t=0 gives subdiagonal -s and all diagonals below it are zero
 -1  0   A097807    A097806
  1  0   A000012    A167374
  2  0   A130321    A251635
  3  0   A140303
  4  0   A262616
 -1  1   A112465    A112466
  0  1   A097805
  2  1   A055248
  3  1   A106516
100  1   A164847
  1  2   A112857
  3  2   A112626

There are a handful of other sequences which are $A$ or $B$ matrices for coefficient sequences which become constant after a small number of exceptional terms:
Coefficients         A-matrix   B-matrix   Comments
-1,-1,-5,-5,-5,...              A107310    Not many values given and I haven't tracked down the reference, so may be a false positive
-2,-1,0,0,...                   A167684
0,-1,0,0,...                    A167371
0,1,0,0,...          A123110
1,-1,0,0,...         A135839    A071022    B-matrix relates to cellular automata
1,0,-1,0,0,...       A071023               Relates to cellular automata
1,1,0,0,...          A193592
1,0,1,1,...          A135225               Pascal's triangle augmented with left column of 1s
1,2,3,3,3,...        A250118               Set partitions avoiding 12343
1,2,3,4,4,...        A250119               Set partitions avoiding 123454

*Coefficient sequence $(1, q, q^2, q^3, \ldots)$: these are the $q$-binomial coefficients. The $A$ matrices for $q=2, 3, \ldots, 24$ are A022166 to A022188, and for $q=25$ it's A173583. The $A$ matrix for $q=-1$ is A051159, although this property is hidden in the comments. The $A$ matrices for $q=-2, -3, \ldots, -24$ are in the range A015109 to A015151, with a few other sequences interleaved. The $B$ matrix for $q=2$ is A135950.
There are also $B$ matrices for coefficients which are scaled by $\kappa = -q$ for $q=2,3,4$, respectively A108084, A173007, A173008.
And there are some sequences which skip the $q$ term: i.e. the coefficient sequence is $(1, q^2, q^3, \ldots)$. For $q=2,3,4$ the $A$ matrix is A176242, A176243, A176244.

*Coefficient sequence $(s, s+k, s+2k, s+3k, \ldots)$. With $s=k=1$ this is the Stirling pair $A = \textrm{A008277}$, $B = \textrm{A008275}$. A lot of members of this family are present: those which don't have other names are usually called something like "A generalised Stirling triangle".
   k   s   A matrix   B matrix   Comments
   1  -1    A105794    A105793
   1   0    A048993    A048994   Stirling numbers with different offset
   1   1    A008277    A008275   Stirling numbers
   1   2    A143494    A049444   2-Stirling numbers
   1   3    A143495    A049458   3-Stirling numbers
   1   4    A143496    A049459   etc.
   1   5    A193685    A049460
   1   6               A051338
   1   7               A051339
   1   8               A051379
   1   9               A051380
   1  10               A051523
  -1  -4               A143493   Unsigned 4-Stirling numbers of the first kind
  -1  -3               A143492   Unsigned 3-Stirling numbers of the first kind
  -1  -2               A136124 = A143491
  -1  -1               A130534   Unsigned Stirling numbers of the first kind
  -1   0               A132393   Unsigned Stirling numbers of the first kind
  -1   1               A094645
  -1   2               A094646
   2   1    A039755    A039757   B-analogs of Stirling numbers; A matrix is Stirling-Frobenius subset numbers of order 2
   2   2    A075497    A039683
  -2  -1               A028338   Stirling-Frobenius cycle numbers of order 2
   3   1    A111577              Galton triangle
   3   2    A225468              Stirling-Frobenius subset numbers of order 3
   3   3    A075498    A051141
  -3  -1               A286718
  -3  -2               A225470   Stirling-Frobenius cycle numbers of order 3
   4   1    A111578
   4   3    A225469              Stirling-Frobenius subset numbers of order 4
   4   4    A075499    A051142
  -4  -3               A225471   Stirling-Frobenius cycle numbers of order 4
   5   1    A166973
   5   5    A075500    A051150
   6   6    A075501    A051151
   7   7    A075502    A051186
   8   8    A075503    A051187
   9   1    A166979
   9   9    A075504    A051231
  10  10    A075505    A048176

Making some minor changes to the first term yields $A$-matrix Stirling differences A269952 for $(0,2,3,4,\ldots)$, and $A$-matrix A137596 (matrix product of all-ones lower-triangular matrix and triangle of Stirling numbers of the second kind) for $(1,1,2,3,4,\ldots)$.
Other families which are less directly related (although by no means unrelated in all cases) to the ones explicitly mentioned in the question are:

*

*Coefficient sequences based on squares, cubes, etc.

*

*Squares $(1, 4, 9, \ldots)$ has $A$-matrix A036969, "central factorial numbers $T(2n,2k)$"; and $B$-matrix A204579.

*Squares $(0, 1, 4, 9, \ldots)$ has $A$-matrix A269945, central factorial numbers $T(2n,2k)$ with a different offset.

*Negated squares $(0, -1, -4, -9, \ldots)$ has $B$-matrix A269944, unsigned central factorial numbers $t(2k,2k)$.

*Odd squares $(1, 9, 25, \ldots)$ has $A$-matrix A160562, "scaled central factorial numbers".

*Negated odd squares $(-1, -9, -25, \ldots)$ has $B$-matrix A160563, "number of (n,k)-Riordan complexes".

*Cubes $(1, 8, 27, \ldots)$ has $A$-matrix A098436, 3rd central factorial numbers or Stirling set numbers of order 3.

*With zero, $(0, 1, 8, 27, \ldots)$ has $A$-matrix A269948 of the same 3rd central factorial numbers offset by one.

*Negative cubes $(0, -1, -8, -27, \ldots)$ has $B$-matrix A269947, Stirling cycle numbers of order 3.

*Alternating sequences.
Coefficients    A-matrix   B-matrix   Comments
0,-1,0,-1,...              A103633    Repeated stepped binomial coefficients
0,1,0,1,...     A103631               abs(q-Stirling2) for q=-1
1,0,1,0,...     A065941               q-Stirling2 for q=-1; repeated stepped signed binomial coeffs
1,2,1,2,...     A140068
2,1,2,1,...     A140069               Binomial transform of A135225 (A-matrix of 1,0,1,1,...)
1,-2,1,-2,...   A140166
2,-1,2,-1,...   A140168
1,3,1,3,...     A140070
3,1,3,1,...     A140071

Also near-alternating sequences with early exceptions:
1,1,-1,1,-1,... A207974                Has interpretation in terms of binary strings
1,1,0,1,0,...   A194005                Likewise; also "companion to A103631" (A-matrix of 0,1,0,1,...).

*The sequence $(1,3,7,\ldots,2^k-1,\ldots)$ gives $A$-matrix A139382, $q$-Stirling2 with $q=2$.

*Sequences $\binom{k+\alpha}{\alpha}$ or $\alpha! \binom{k+\alpha}{\alpha}$ give a few hits:
Coefficients            A-matrix   B-matrix   Comments
1,3,6,10,...            A080248
2,6,12,20,...           A071951    A130559    Legendre-Stirling numbers
0,2,6,12,20,...                    A129467    ... with different offset
1,4,10,20,...           A080249
6,24,60,120,...         A089504
24,120,360,840,...      A090215
120,720,2520,6720,...   A090217

*Repeating coefficients gives other Stirling-related sequences:
0,1,1,2,2,3,3,...       A246118               Set partitions with certain constraints
1,1,2,2,3,3,...         A256161               Same with different offset
0,-1,-1,-2,-2,...                  A246117    Parity-preserving permutations by number of cycles

*Other sequences based on combinatorial coefficient sequences:
Coefficients                A-matrix   B-matrix
1,1,2,3,5,... (Fibonacci)   A111669
1,1,3,5,11,... (Jacobsthal) A114163
1,1,2,6,24,... (factorials)            A136457
-1,2,-3,4,-5,6,...                     A140956    Rows are coefficients of alternating factorial polynomial

*And there's a handful based on number-theoretic sequences:
Coefficients              A-matrix   B-matrix
2,3,5,7,... (primes)      A124960    A070918
-1,-2,-4,-6 (1-p)                    A096294    Fraction of positive integers with exactly k of the first n primes as divisors
1,-1,-1,0,-1,1,... (mu)   A124961
-1,0,0,0,-9,0,0,-15,...              A109409    Coeffs of product of (x+i) for odd non-prime i

A: Following up on David's nice answer, there is a different parametrization that makes the pattern much more obvious. Namely, let $s_1,s_2,\dots$ be arbitrary, then you can write
$$A=\Big(h_{i-j}(s_1,s_2,\dots, s_{j+1})\Big)_{i,j=0}^{\infty}$$
$$B=\Big((-1)^{i-j}e_{i-j}(s_1,s_2,\dots, s_{i})\Big)_{i,j=0}^{\infty}$$
And checking that the matrices and the corresponding generating functions are inverses becomes a little more clear. The $h_i, e_i$ denote the complete homogeneous and elementary symmetric functions respectively, with the convention $h_0, e_0 =1$.

A: I don't know, but I will point out that, if you specify the entries $A_{(i+1)i}$, then every other entry is uniquely determined by these. The property of being inverse as matrices means that the upper left $k \times k$ block of $A$ determins that upper left $k \times k$ block of $B$. On the other hand, being inverse as power series means that the upper left $k \times k$ block of $B$ determines the left $k-1$ columns of $A$, and hence determines every element in the upper left $(k+1) \times (k+1)$ block of $A$ except for $A_{(k+1)k}$.
I wrote some Mathematica code to carry out this recursion, but I didn't see any pattern in the results. In case it helps, here is the code:
a[n_] :=
 (polys = Drop[b[n - 1], 1].Table[x^(n - 2 - j), {j, 0, n - 2}];
  functions = x^(n - 3)/polys;
  earlyCols = Table[SeriesCoefficient[y, {x, 0, j}], {y, functions}, {j, 0,
     n - 1}];
  lastCols =
   {Table[If[i < n - 1, 0, If[i == n - 1, 1, u[n - 1]]], {i, 1, n}],
    Table[If[i < n, 0, 1], {i, 1, n}]};
  Transpose[Join[earlyCols, lastCols]]);
b[n_] := Inverse[a[n]];
a[1] = {{1}}; a[2] = {{1, 0}, {u[1], 1}};

and here are the $6 \times 6$ matrices (first $A$, then $B$):
{{1, 0, 0, 0, 0, 0},
{u[1], 1, 0, 0, 0, 0},
{u[1]^2, u[2], 1, 0, 0, 0},
{u[1]^3, u[1]^2 - u[1] u[2] + u[2]^2, u[3], 1, 0, 0},
{u[1]^4, 2 u[1]^2 u[2] - 2 u[1] u[2]^2 + u[2]^3, u[1]^2 - u[1] u[2] + u[2]^2 - u[2] u[3] + u[3]^2, u[4], 1, 0},
{u[1]^5, u[1]^4 - 2 u[1]^3 u[2] + 4 u[1]^2 u[2]^2 - 3 u[1] u[2]^3 + u[2]^4, u[1]^2 u[2] - u[1] u[2]^2 + u[1]^2 u[3] - u[1] u[2] u[3] + 2 u[2]^2 u[3] - 2 u[2] u[3]^2 + u[3]^3, u[1]^2 - u[1] u[2] + u[2]^2 - u[2] u[3] + u[3]^2 - u[3] u[4] + u[4]^2, u[5], 1}}

{{1, 0, 0, 0, 0, 0},
{-u[1], 1, 0, 0, 0, 0},
{-u[1]^2 + u[1] u[2], -u[2], 1, 0, 0, 0},
{-u[1]^2 u[2] + u[1] u[2]^2 + u[1]^2 u[3] - u[1] u[2] u[3], -u[1]^2 + u[1] u[2] - u[2]^2 + u[2] u[3], -u[3], 1, 0, 0},
{-u[1]^2 u[2] u[3] + u[1] u[2]^2 u[3] + u[1]^2 u[3]^2 - u[1] u[2] u[3]^2 + u[1]^2 u[2] u[4] - u[1] u[2]^2 u[4] - u[1]^2 u[3] u[4] + u[1] u[2] u[3] u[4], -u[1]^2 u[2] + u[1] u[2]^2 - u[2]^2 u[3] + u[2] u[3]^2 + u[1]^2 u[4] - u[1] u[2] u[4] + u[2]^2 u[4] - u[2] u[3] u[4], -u[1]^2 + u[1] u[2] - u[2]^2 + u[2] u[3] - u[3]^2 + u[3] u[4], -u[4], 1, 0},
{-u[1]^2 u[2] u[3] u[4] + u[1] u[2]^2 u[3] u[4] + u[1]^2 u[3]^2 u[4] - u[1] u[2] u[3]^2 u[4] + u[1]^2 u[2] u[4]^2 - u[1] u[2]^2 u[4]^2 - u[1]^2 u[3] u[4]^2 + u[1] u[2] u[3] u[4]^2 + u[1]^2 u[2] u[3] u[5] - u[1] u[2]^2 u[3] u[5] - u[1]^2 u[3]^2 u[5] + u[1] u[2] u[3]^2 u[5] - u[1]^2 u[2] u[4] u[5] + u[1] u[2]^2 u[4] u[5] + u[1]^2 u[3] u[4] u[5] - u[1] u[2] u[3] u[4] u[5], -u[1]^2 u[2] u[3] + u[1] u[2]^2 u[3] + u[1]^2 u[3]^2 - u[1] u[2] u[3]^2 - u[1]^2 u[3] u[4] + u[1] u[2] u[3] u[4] - u[2]^2 u[3] u[4] + u[2] u[3]^2 u[4] + u[1]^2 u[4]^2 - u[1] u[2] u[4]^2 + u[2]^2 u[4]^2 - u[2] u[3] u[4]^2 + u[1]^2 u[2] u[5] - u[1] u[2]^2 u[5] + u[2]^2 u[3] u[5] - u[2] u[3]^2 u[5] - u[1]^2 u[4] u[5] + u[1] u[2] u[4] u[5] - u[2]^2 u[4] u[5] + u[2] u[3] u[4] u[5], -u[1]^2 u[2] + u[1] u[2]^2 - u[2]^2 u[3] + u[2] u[3]^2 - u[3]^2 u[4] + u[3] u[4]^2 + u[1]^2 u[5] - u[1] u[2] u[5] + u[2]^2 u[5] - u[2] u[3] u[5] + u[3]^2 u[5] - u[3] u[4] u[5], -u[1]^2 + u[1] u[2] - u[2]^2 + u[2] u[3] - u[3]^2 + u[3] u[4] - u[4]^2 + u[4] u[5], -u[5], 1}}


text:
Q: How to replace string in an element in an array with a string from an element in another array? Hi so what I am aiming to do is replace all the words in array1 (2x2) that match the words in arrayChoose (3x1) with the words in arrayReplacewith (3x1) using Javascript. I've tried several methods including mapping and replacing, but i'm going around in circles and not sure how to proceed.
edit: just to add some context, I am loading all arrays from csv files.
Also choose and replace arrays may not necessarily be the same length...
edit2: issues faced: all examples I've seen work on vectors, not matrices. Secondly, any solutions which replace the string in all the elements only replace the first instance of the string and I have not been able to implement a global replace.
Any help would be much appreciated. Thanks.
var array1 = [["today is the day","or maybe it's tomorrow"],["who knows really","it's just where we are"]];

var arrayChoose = ["today", "tomorrow", "just"];

var arrayReplacewith = ["monday", "tuesday", "not"];

Solution
Thanks to everybody who contributed their answers. I've utilised the one provided by @mohamed-ibrahim . Please see the solution below ... (arrays loaded from csv files, see here for full example)
var arrayIncorrect = [ [ 'Trump has ordered', 'flight attendants to stop' ],
  [ 'shorter people to ', 'restrict tourism.' ],
  [ 'Now all they ', 'need is a wall.' ] ];

var dataChoose = [ [ 'Trump' ],
  [ 'stop' ],
  [ 'people' ],
  [ 'restrict' ],
  [ 'wall' ] ];

var dataReplace = [ [ 'Kim Jong-un' ],
  [ 'wear' ],
  [ 'skirts' ],
  [ 'boost' ],
  [ 'airplane' ] ];

arrayCorrect=
    arrayIncorrect.map(function(array1){
      return array1.map(function(ele){
               dataChoose.forEach(function(choose){
                 ele = ele.replace(new RegExp(choose, 'g'),  dataReplace[dataChoose.indexOf(choose)]) ;
               })
               return ele;
             })
    });

    console.log(arrayCorrect)

Please let me know if there are any questions.

A: Try the following:
var array1 = [["today is the day","or maybe it's tomorrow"],["who knows really","it's just where we are"]];
var arrayChoose = ["today", "tomorrow", "just"];
var arrayReplacewith = ["monday", "tuesday", "not"];

array1 =
   array1.map(function(array2){
     return array2.map(function(ele){
              arrayChoose.forEach(function(choose){
                ele = ele.replace(new RegExp(choose, 'g'),  arrayReplacewith[arrayChoose.indexOf(choose)]) ;
              })
              return ele;
            })
   });

A: Two simple map's will do the trick, this will potentially throw an error if the choose array has more entries than the replace array, so you need to make sure that's not the case.

var array1 = ["today is the day", "or maybe it's tomorrow", "who knows really", "it's just where we are"];
var arrayChoose = ["today", "tomorrow", "just"];
var arrayReplacewith = ["monday", "tuesday", "not"];

array1 = array1.map(v => {
  let s = v.split(" ").map(st => {
    let index = arrayChoose.indexOf(st);
    return index > -1 ? arrayReplacewith[index] : st;
  });
  return s.join(" ");
});

console.log(array1);

A: One approach using .map and .indexOf with ES6 arrow functions:
replaceArr = (arrOriginal, arrWordsToMatch, arrWordsToReplace) => {
    if (arrWordsToMatch.length != arrWordsToReplace.length) throw "arrWordsToMatch and arrWordsToReplace must have exact length"
    return arrOriginal.map( (phrase) => {
        return phrase.split(" ").map( (word) => {
            let foundIndex = arrWordsToMatch.indexOf(word)
            return (foundIndex > -1) ? arrWordsToReplace[foundIndex] : word
        }).join(" ")
    })
}

let newArray = replaceArr(array1, arrayChoose, arrayReplacewith);

console.log(newArray);
/*
  [ 'monday is the day',
  'or maybe it\'s tuesday',
  'who knows really',
  'it\'s not where we are' ]
*/

Note: as arrWordsToMatch and arrWordsToReplace must have same length, it throws an error if the sizes are different.

A: You could use a regular expression and an object for the replacement strings.

var array = [["today is the day", "or maybe it's tomorrow"], ["who knows really", "it's just where we are"]],
    object = { today: 'monday', tomorrow: 'tuesday', just: 'not' },
    result = array.map(function (a) {
        return a.map(function(b) {
            return b.replace(RegExp(Object.keys(object).join('|'), 'g'), function (s) {
                return object[s];
            });
        });
    });

console.log(result);

ES6

var array = [["today is the day", "or maybe it's tomorrow"], ["who knows really", "it's just where we are"]],
    object = { today: 'monday', tomorrow: 'tuesday', just: 'not' },
    result = array.map(a => a.map(b => b.replace(RegExp(Object.keys(object).join('|'), 'g'), s => object[s])));

console.log(result);


text:
Q: How to configure Ubuntu 14.04 Jenkins to connect to GitHub UPDATE:
I found the answer.  You can't use a pass phrase when you generate the key.  (It's an easy mistake to make, since the GitHub instructions strongly suggest that you do use a pass phrase.  Presumably the case of deploy keys is an exception).

Have been trying to setup a Jenkins server on Ubuntu 14.04.  Have installed Jenkins no problems, but am unable to connect to the secure repository URL.  I'm getting permission denied (public key).  I have tried a lot of solutions that I researched on the web, but still no success.
Here are the details:

*

*Jenkins installed no problems and running as user jenkins

*GitHub plugin is installed

*Have followed the github instructions on keygen.  I tried this as my own user (kim) on the ubuntu machine, and have also done it as the jenkins user

*Am loading the public key as a deploy key against the github repo

*Am loading the private key directly in the credentials in jenkins

*Have tried numerous different usernames in the Jenkins credentials setup (including git, git@github.com, and my git hub user name)

*The authentication test (ssh -T git@github.com) works no bother

*I have tried this solution, Authenticate Jenkins CI for Github private repository.  Again, the ssh test works fine (against the alias), but Jenkins still fails

I'm running out of ideas?


text:
Q: How to draw a line line using "*" I am trying to draw a line using "*" in the console, but I get only 2 "*". I think something is wrong with the line algorithm. Maybe there is an easier way to do it.
Class MyGraphics:
 class MyGraphics {
int x, y;
private int width, height;
MyGraphics(int wid, int hit) {

    fb= new FrameBuffer(wid,hit);
    width = fb.getWidth();
    height = fb.getHeight();
}
MyGraphics() {
    fb = new FrameBuffer();
    width = fb.getWidth();
    height = fb.getHeight();
}

void drawLine(int x1,int y1,int x2,int y2)
{
 width= x2 - x ;
height = y2 - y ;
   int dx1 = 0, dy1 = 0, dx2 = 0, dy2 = 0 ;
    if (width<0) dx1 = -1 ; else if (width>0) dx1 = 1 ;
   if (height<0) dy1 = -1 ; else if (height>0) dy1 = 1 ;
   if (width<0) dx2 = -1 ; else if (width>0) dx2 = 1 ;
   int longest = Math.abs(width) ;
   int shortest = Math.abs(height) ;
  if (!(longest>shortest)) {
    longest = Math.abs(height) ;
    shortest = Math.abs(width) ;
    if (height<0) dy2 = -1 ; else if (height>0) dy2 = 1 ;
    dx2 = 0 ;
}
int numerator = longest >> 1 ;
for (int i=0;i<=longest;i++) {
    fb.setPixel(x1, y1);

    numerator += shortest ;
    if (!(numerator<longest)) {
        numerator -= longest ;
        x += dx1 ;
        y += dy1 ;
    } else {
        x += dx2 ;
        y += dy2 ;
    }
}
return;
}
void display() {
    fb.display();
    return;
    } // simply calls the frame buffer's display method

FrameBuffer fb;
}

/*void drawLine(int x1,int y1,int x2,int y2)
{
width= x2 - x ;
height = y2 - y ;
int dx1 = 0, dy1 = 0, dx2 = 0, dy2 = 0 ;
if (width<0) dx1 = -1 ; else if (width>0) dx1 = 1 ;
if (height<0) dy1 = -1 ; else if (height>0) dy1 = 1 ;
if (width<0) dx2 = -1 ; else if (width>0) dx2 = 1 ;
int longest = Math.abs(width) ;
int shortest = Math.abs(height) ;
if (!(longest>shortest)) {
    longest = Math.abs(height) ;
    shortest = Math.abs(width) ;
    if (height<0) dy2 = -1 ; else if (height>0) dy2 = 1 ;
    dx2 = 0 ;
}
int numerator = longest >> 1 ;
for (int i=0;i<=longest;i++) {
    fb.setPixel(y, x);

    numerator += shortest ;
    if (!(numerator<longest)) {
        numerator -= longest ;
        x += dx1 ;
        y += dy1 ;
    } else {
        x += dx2 ;
        y += dy2 ;
    }
}
return;
}*/

Class MyGraphicsApp:
class MyGraphicsApp {
MyGraphicsApp() {mg = new MyGraphics(80, 25);}

void paint(MyGraphics g) {
    g.drawLine(5, 12, 27, 2);
    g.drawLine(2, 2, 30, 30);
}

void repaint() {
    paint(mg);
    mg.display();
}

public static void main(String [] args) {
    MyGraphicsApp myGraphicsApp = new MyGraphicsApp();
    myGraphicsApp.repaint();
}

MyGraphics mg;
}

A: I suspect this assignments
width= x2 - x ;
height = y2 - y ;

should be
width= x2 - x1 ;
height = y2 - y1 ;

And this line is wrong also
fb.setPixel(x1, y1);

since you never change the values of x1 and y1.