text:
Q: Change Password In SQLite Database in Android I'm using SQLite Database for insert , create or update data in my application.I want to change the password in my SQLite database.I'm having problem for change the password in my app. When I run the demo and enter the whatever field is there and hit the Button for change the data in database it goes to else condition. Nothing to show any error or exceptions in log cat. Is there any way to do that? Here is my code.
This is my DBHelper class
public class DataBaseHelper extends SQLiteOpenHelper
{

public DataBaseHelper(Context context, String name,CursorFactory factory, int version)
    {
               super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase _db)
    {
            _db.execSQL(DataBase_Adapter.DATABASE_CREATE_LOGIN);
     }

    @Override
    public void onUpgrade(SQLiteDatabase _db, int _oldVersion, int _newVersion)
    {
            // Log the version upgrade.
      Log.w("TaskDBAdapter", "Upgrading from version " +_oldVersion + " to "+_newVersion + ", which will destroy all old data");

           _db.execSQL("DROP TABLE IF EXISTS " + "TEMPLATE");

            onCreate(_db);
    }

}

This DataBaseAdapter Class Code
 public static final String TABLE_NAME_LOGIN="LOGIN";

        //Colum,n Names
        public static final String KEY_LOGIN_ID="ID";
        public static final String KEY_USERNAME="USERNAME";
        public static final String KEY_EMAIL_ID="EMAILID";
        public static final String KEY_PASSWORD="PASSWORD";

        //Table Create Statement
        public static final String DATABASE_CREATE_LOGIN = "CREATE TABLE "+TABLE_NAME_LOGIN+" ("+KEY_LOGIN_ID+" INTEGER PRIMARY KEY AUTOINCREMENT, "+KEY_USERNAME+" TEXT, "+KEY_EMAIL_ID+" TEXT, "+KEY_PASSWORD+" TEXT)";

 //Insert Data in Database Login
        public void insertEntry(String userName,String userEmail,String password)
        {
           ContentValues newValues = new ContentValues();
            // Assign values for each row.
            newValues.put(KEY_USERNAME , userName);
            newValues.put(KEY_EMAIL_ID , userEmail);
            newValues.put(KEY_PASSWORD , password);

            // Insert the row into your table
            db.insert(TABLE_NAME_LOGIN, null, newValues);

        }

//Update Query

        public boolean change(String strEmailId , String strNewPin1 )
        {

            Cursor cur=db.rawQuery("UPDATE "+TABLE_NAME_LOGIN +" SET " + KEY_PASSWORD+ " = '"+strNewPin1+"' WHERE "+ KEY_EMAIL_ID +"=?", new String[]{strEmailId});

            if (cur != null)
            {
                if(cur.getCount() > 0)
                {
                    return true;
                }
            }
            return false;
        }

This is my Change Pin Activity
public class Change_Pin_Activity7 extends Activity
{
    EditText editText_EmailId , editText_changePin1 , editText_changePin2;
    Button buttonChangePin;
    TextView textView_PasswordMatch;

    String strEmailId , strNewPin1 , strNewPin2;
    boolean storedNewData;

    DataBase_Adapter dbAdapter;
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.change_pin_activity7);

        dbAdapter=new DataBase_Adapter(this);
        dbAdapter=dbAdapter.open();

        editText_EmailId=(EditText)findViewById(R.id.EditText_EmailId);
        editText_changePin1=(EditText)findViewById(R.id.EditText_Pin1);
        editText_changePin2=(EditText)findViewById(R.id.EditText_Pin2);

        textView_PasswordMatch=(TextView)findViewById(R.id.TextView_PinProblem);

        buttonChangePin=(Button)findViewById(R.id.button_ChangePin);
        buttonChangePin.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v)
            {
                // TODO Auto-generated method stub
                strEmailId = editText_EmailId.getText().toString().trim();
                strNewPin1 = editText_changePin1.getText().toString().trim();
                strNewPin2 = editText_changePin2.getText().toString().trim();

                storedNewData=dbAdapter.change(strEmailId , strNewPin1);

                if (strNewPin1.equals(storedNewData))
                {

                    textView_PasswordMatch.setText("Password Match !!!");

                    Toast.makeText(Change_Pin_Activity7.this,
                            "Pin Change Successfully", Toast.LENGTH_LONG).show();
                }

                // check if any of the fields are vaccant
                if(strEmailId.equals("")||strNewPin1.equals("")||strNewPin2.equals(""))
                {
                        Toast.makeText(getApplicationContext(), "Field Vaccant", Toast.LENGTH_LONG).show();
                        return;
                }

                // check if both password matches
                if(!strNewPin1.equals(strNewPin2))
                {
                    Toast.makeText(getApplicationContext(), "Pin does not match", Toast.LENGTH_LONG).show();
                    return;
                }

                else
                {
                    Toast.makeText(getApplicationContext(),"Not Working ", Toast.LENGTH_LONG).show();

                }

            }
        });

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        // Close The Database
        dbAdapter.close();
    }

}

A: When is if (strNewPin1.equals(storedNewData)) ever going to succeed, if strNewPin1 is a String, and storedNewData is a boolean.


text:
Q: Android Lollipop Decryption using AES is not working properly Till kitkat, encryption/decryption is working good but in lollipop it decrypts only partial data.
I don't have problem with encryption because I encrypted a file with lollipop and decrypts it with kitkat it works fine but not vice versa.
Here is the code.
Encryption code
Encrypt(BufferedInputStream is, File destfile, String passcode) {
        bis = is;
        try {
            fos = new FileOutputStream(destfile);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        dest = new BufferedOutputStream(fos, 1024);
        this.passcode = passcode;
    }

    static void encrypt() throws IOException, NoSuchAlgorithmException,
    NoSuchPaddingException, InvalidKeyException {

        // Length is 16 byte
        SecretKeySpec sks = new SecretKeySpec(passcode.getBytes(), "AES");

        // Create cipher
        Cipher cipher = Cipher.getInstance("AES");
        cipher.init(Cipher.ENCRYPT_MODE, sks);
        // Wrap the output stream
        CipherOutputStream cos = new CipherOutputStream(fos, cipher);
        // Write bytes
        int b;
        byte[] d = new byte[1024];
        while ((b = bis.read(d)) != -1) {
            cos.write(d, 0, b);
        }
        // Flush and close streams.
        cos.flush();
        cos.close();
        bis.close();
    }

Decryption code
public Decrypt(String path, String pathcode) {
        // TODO Auto-generated constructor stub
        filepath = path;
        try {
            fis = new FileInputStream(new File(path));
            this.passcode = pathcode;
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    static String decrypt() throws IOException, NoSuchAlgorithmException,
    NoSuchPaddingException, InvalidKeyException {

        SecretKeySpec sks = new SecretKeySpec(passcode.getBytes(), "AES");
        Cipher cipher = Cipher.getInstance("AES");
        cipher.init(Cipher.DECRYPT_MODE, sks);
        CipherInputStream cis = new CipherInputStream(fis, cipher);
        int size = fis.available();
        byte[] resdata = new byte[size];
        cis.read(resdata, 0, size);
        String newres = new String(resdata, "UTF-8").trim();
        //write("decrypted_file.xhtml",newres);
        if(fis!=null)
        {
        fis.close();
        }
        if(cis!=null)
            cis.close();
        return newres;
    }

What's the problem in this code? Do I need to do anything more?

A: available() doesn't necessarily return the length of the entire stream, just the estimated number of bytes that can be read without blocking. So, use a ByteArrayOutputStream to store the bytes and then covert to a byte array:
CipherInputStream cis = new CipherInputStream(fis, cipher);
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int bytesRead;
byte[] data = new byte[1024];
while ((bytesRead = cis.read(data, 0, data.length)) != -1) {
    buffer.write(data, 0, bytesRead);
}
buffer.flush();
byte[] resdata = buffer.toByteArray();
String newres = new String(resdata, "UTF-8").trim();

redpajama_set_name: RedPajamaStackExchange


text:
Q: Visualizing communication pattern of MPI processes Is there a tool that visualizes the communication pattern of processes in my my open-mpi code?
If not, i would like to write one.
Where do i start?

A: There are some, examples:

*

*Scalasca

*Paraver

*Vampir
Have a look at the VI-HPS stuff for more.


text:
Q: Error Flutter: [sliver_list] 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true I have the following error when I add a new item to my SliverList. This one nested in CustomScrollView which is it nested in a LiquidPullToRefresh (https://pub.dev/packages/liquid_pull_to_refresh) to update my list with the new items. The list is well updated but I still have this error.
Any ideas ?
Error
flutter: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following assertion was thrown during performLayout():
flutter: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14:
flutter: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter:   https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: The relevant error-causing widget was:
flutter:   SliverList file:///Users/flo/Mobile/R-CUT/Dev/rcut/lib/src/views/home-views/ProfilView.dart:84:18
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2      RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:270:14)
flutter: #3      RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
flutter: #4      RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:410:13)
flutter: #5      RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1367:12)
flutter: #6      RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1285:20)
flutter: #7      RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1584:7)
flutter: #8      PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:844:18)
flutter: #9      RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:344:19)
flutter: #10     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:774:13)
flutter: #11     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:283:5)
flutter: #12     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1102:15)
flutter: #13     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1041:9)
flutter: #14     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:957:5)
flutter: #18     _invoke (dart:ui/hooks.dart:259:10)
flutter: #19     _drawFrame (dart:ui/hooks.dart:217:3)
flutter: (elided 5 frames from class _AssertionError and package dart:async)
flutter:
flutter: The following RenderObject was being processed when the exception was fired: RenderSliverList#0ac99 relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
flutter:   needs compositing
flutter:   creator: SliverList ← FutureBuilder<dynamic> ← RCutFutureBuilder<void> ← Viewport ←
flutter:     IgnorePointer-[GlobalKey#c0cdd] ← Semantics ← _PointerListener ← Listener ← _GestureSemantics ←
flutter:     RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#5ef68] ← _PointerListener ← Listener
flutter:     ← ⋯
flutter:   parentData: paintOffset=Offset(0.0, 218.0) (can use size)
flutter:   constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle,
flutter:     scrollOffset: 0.0, remainingPaintExtent: 424.6, crossAxisExtent: 375.0, crossAxisDirection:
flutter:     AxisDirection.right, viewportMainAxisExtent: 637.0, remainingCacheExtent: 674.6 cacheOrigin: 0.0 )
flutter:   geometry: SliverGeometry(scrollExtent: 4381.0, paintExtent: 419.0, maxPaintExtent: 4381.0,
flutter:     hasVisualOverflow: true, cacheExtent: 669.0)
flutter:   currently live children: 0 to 2
flutter: This RenderObject had the following descendants (showing up to depth 5):
flutter:     child with index 0: RenderIndexedSemantics#955fe relayoutBoundary=up2
flutter:       child: RenderRepaintBoundary#8a7b5 relayoutBoundary=up3
flutter:         child: RenderSemanticsGestureHandler#81c7a relayoutBoundary=up4
flutter:           child: RenderPointerListener#7c025 relayoutBoundary=up5
flutter:             child: RenderTransform#bcf92 relayoutBoundary=up6
flutter:     child with index 1: RenderIndexedSemantics#675eb relayoutBoundary=up2
flutter:       child: RenderRepaintBoundary#e9121 relayoutBoundary=up3
flutter:         child: RenderSemanticsGestureHandler#5ac06 relayoutBoundary=up4
flutter:           child: RenderPointerListener#7550a relayoutBoundary=up5
flutter:             child: RenderTransform#64638 relayoutBoundary=up6
flutter:     child with index 2: RenderIndexedSemantics#cdfbd relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
flutter:       child: RenderRepaintBoundary#490ab relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
flutter:         child: RenderSemanticsGestureHandler#116b6 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
flutter:           child: RenderPointerListener#30856 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
flutter:             child: RenderTransform#8a669 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/sliver_list.dart': Failed assertion: line 270 pos 14: 'estimatedMaxScrollOffset >= endScrollOffset - childScrollOffset(firstChild)': is not true.
    [C20.1 72D7C5AF-3D0E-46BC-BC25-8ED1FCD9A4F6 192.168.0.2:50854<->216.58.197.170:443]
    Connected Path: satisfied (Path is satisfied), interface: en0
    Duration: 70.736s, DNS @0.000s took 0.002s, TCP @0.003s took 0.034s, TLS took 0.086s
    bytes in/out: 5597/3006, packets in/out: 10/12, rtt: 0.089s, retransmitted packets: 0, out-of-order packets: 0

Flutter doctor
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15 19A602, locale en-FR)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.41.1)
[✓] Connected device (2 available)

• No issues found!

A: You need to give "itemExtent" value to your listview widget


text:
Q: PHP file_get_contents and curl get a result but also no result I have the following code:
$url='http://finance.google.com/finance/info?client=ig&q=NASDAQ:GOOG';
$quote = file_get_contents($url);
echo $quote . "
";

which returns a result.
but
$url='http://finance.google.com/finance/info?client=ig&q=FTSE:BBY';
$quote = file_get_contents($url);
echo $quote . "
";

does NOT return a result. Instead it returns nothing.
Both URLs work in Firefox and provide a page source ok.
I have tried to get the contents using CURL and still cannot get the data from the FTSE:BBY or other FTSE:????? sources.
Any ideas how to fix this?


text:
Q: Assigning href link from custom post type from wordpress beside each song in jPlayer playlist I'm trying to add a buy button beside each song that links to itunes. Unfortunately, I'm new to jPlayer and have absolutely no idea where to start. The jPlayer already exists in the wordpress theme I bought, everything has been setup nicely and am really only needing this last additional feature.
Everything should look like this: http://i.stack.imgur.com/dwCGr.png
As of now, I've inspected the javascript file and have successfully added a link beside each of the song in the playlist. However, the links are static and I need them to be linked to a field from custom post type in wordpress. The codes are below:

//The added buy on itunes link is below with a class .playlist-item-buy
_createListItem: function(b) {
      var c = this,
        d = "

";
      if (d += "×", b.free) {
        var e = !0;
        d += "(", a.each(b, function(b, f) {
          a.jPlayer.prototype.format[b] && (e ? e = !1 : d += " | ", d += "" + b + "")
        }), d += ")"
      }
      return d += "" + b.title + (b.artist ? " by " + b.artist + "" : "") + "", d + "Buy on iTunes" + "

"
    },

//This is the metabox. I've succesfully added a "link to itunes field" to the bottom of the code.
$meta_boxes[] = array(
  'id'         => 'album_demo',
  'title'      => __( 'Album Demo', 'cmb' ),
  'pages'      => array( 'album', ),
  'fields'     => array(
   array(
    'id'          => $prefix . 'album_demo',
    'type'        => 'group',
    'description' => __( 'Upload mp3 and ogg files', 'cmb' ),
    'options'     => array(
     'group_title'   => __( 'Single {#}', 'cmb' ), // {#} gets replaced by row number
     'add_button'    => __( 'Add Another Single', 'cmb' ),
     'remove_button' => __( 'Remove Single', 'cmb' ),
     'sortable'      => true, // beta
    ),
    // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
    'fields'      => array(
     array(
      'name' => 'Entry Title',
      'id'   => 'single_title',
      'type' => 'text',
      // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
     ),
     array(
      'name' => 'Mp3 link',
      'id'   => 'single_mp3',
      'type' => 'text',
      // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
     ),
     array(
      'name' => 'Ogg Link',
      'id'   => 'single_ogg',
      'type' => 'text',
      // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
     ),
     array(
      'name' => 'iTunes Link',
      'id'   => 'single_itunes',
      'type' => 'text',
      // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
     ),
    ),
   ),
  ),
 );

The trouble I'm having right now is having to link these 2 together. I can provide further code snippets that aren't posted here if it would help.


text:
Q: Finding duplicate cell values in the same column and returning text in another cell I'm sure there's a simple explanation for the issue I've got, but I can't seem to find anything anywhere...
I've got a table of data that is currently 70+ rows (but is likely to expand in the future) and I'm trying to identify any duplicate values in one column and output text into a different column like below

Date
Job No.
Duplicate

13/05/2021
10542
Y

13/05/2021
10674
Y

13/05/2021
10676

13/05/2021
10434
Y

14/05/2021
10436

14/05/2021
10727

14/05/2021
10542
Y

14/05/2021
10729

14/05/2021
10332

15/05/2021
10334

15/05/2021
10335

15/05/2021
10434
Y

15/05/2021
10674
Y

The problem I'm coming across is finding a formula that looks at the Job No. column to see if there are any duplicate values and identifying them in the Duplicate column.
I've tried working through INDEX MATCH formulas, but can't seem to get anything working properly.

A: Supposing that your sample data shown has the header "Date" in A1 and the header "Job No." in B1, delete everything (including the header) from Column C and place this in C1:
=ArrayFormula({"Duplicate";IF(A2:A="",,IF(COUNTIF(B2:B,B2:B)>1,"Y",))})
This will produce the header (which you can change inside the formula as you like) as well as all results.


text:
Q: add de Clase Derivada Quiero hacer un add de Jugador que es derivado de Persona en mi clase tengo un LinkedList,List<Persona> personas. ¿Hay algún medio de hacer este add? Lo que dice el enunciado es "Añadir una nueva persona de tipo jugador a la lista de personas."
Saludos.

A: Según lo que he entendido quieres añadir un arrayList dentro de otro array:
Lo que he hecho es crear la clase persona que tendrá una lista de personas en este caso un jugador:

public class Persona {

    private String nombre;
    private int edad;
    List<Jugador> jugador;

    public String getNombre() {
        return nombre;
    }
    public void setNombre(String nombre) {
        this.nombre = nombre;
    }
    public int getEdad() {
        return edad;
    }
    public void setEdad(int edad) {
        this.edad = edad;
    }
    public List<Jugador> getJugador() {
        return jugador;
    }
    public void setJugador(List<Jugador> jugador) {
        this.jugador = jugador;
    }
    @Override
    public String toString() {
        return "Persona [nombre=" + nombre + ", edad=" + edad + ", jugador=" + jugador + "]";
    }
}

Clase Jugador:
public class Jugador extends Persona {

    private String apellido;

    public String getApellido() {
        return apellido;
    }

    public void setApellido(String apellido) {
        this.apellido = apellido;
    }

    @Override
    public String toString() {
        return "Hijo [apellido=" + apellido + "]";
    }
}

El método main:
Persona persona;
        Jugador jugador;
        Jugador jugador2;
        List<Jugador> arrayH = null;//Declaras un array que recibe como parametro un objeto de la clase hijo
        String nombre1 = "jugador1";
        String nombre2 = "jugador2";
        String apellidoJugador1 = "Apellido jugador2";
        String apellidoJugador2 = "Apellido jugador2";
        int edad1 = 10;
        int edad2 = 12;

        jugador = new Jugador();
        jugador2 = new Jugador();
        jugador.setNombre(nombre1);
        jugador.setApellido(apellidoJugador1);
        jugador.setEdad(edad1);
        jugador2.setNombre(nombre2);
        jugador2.setApellido(apellidoJugador2);
        jugador2.setEdad(edad2);
        arrayH = new ArrayList<Jugador>();
        arrayH.add(jugador);//Añades al array el hijo
        arrayH.add(jugador2);//Añades al array el hijo

        persona = new Persona();
        persona.setNombre(nombre1);
        persona.setEdad(edad1);
        persona.setJugador(arrayH);//Añade los hijo a la persona.

        System.out.println("Nombre: "+persona.getNombre());
        System.out.println("Edad: "+persona.getEdad());
        for (Jugador hijos : persona.getJugador()) {//Iterando el array de los hijos de la persona
            System.out.println(hijos.toString());
        }


text:
Q: Microsoft Graph or Active Directory Graph for Azure AD B2C I must build a dashboard with users in our Azure AD B2C tenant. Which graph api is the best to use (Microsoft Graph or Active Directory Graph)?
Regards
Stefan

A: You could find the same answer from the nzpcmad's link.

You must use the Azure AD Graph API to manage users in an Azure AD B2C
  directory.

And you could also find the related reason why cannot use the Microsoft Graph API from here.


text:
Q: what is the meaning of 'ruinously'? What meaning does 'ruinously' convey in the given sentence:

"A city so ruinously sad that it had forgotten its name."

Does it mean that, it was so badly sad that it had forgotten its name or that it was sad in a way that tends to cause great harm?

A: Ruinously in this context is a descriptive and superlative way of saying "very."
What the author is saying, is the city was so sad that it had forgotten its name.  Its sense of identity as a city had been ruined.


text:
Q: Error Connecting to a Win Serv 19 CIFS Share I recently decided to upgrade my main file server from Windows Server 2016 to 2019. The issue I'm running into in testing is that my Ubuntu Server 16.04 VMs cannot connect to the Windows CIFS share. I can't seem to find anything about Windows Server 2019 removing SMB features so I'm not sure why this isn't work. The error I get when trying to mount the share is 'Host Down' but I can ping the Windows server just fine from the affected machines. Any ideas? Something in Ubuntu I need to update maybe?

A: From this thread.
In 2017 Microsoft patched Windows Servers and advised to disable the SMB1 protocol.
From now on, mount.cifs might have problems with the protocol negotiation.
There are 14 responses for you to choose from.


text:
Q: What function could do that? (again) Here is a reformulated question: Can one show a real function $f$ (whose domain is the set of all pairs of reals for which $x\lt y$) such that

*

*$x \lt f(x,y)\lt y$,

*$f(a,b) \le f(c,d)$ iff $a \lt f(c,d)$ and $f(a,b) \lt d$ ?

A: Von Eitzen's reference to the Baire category theorem helped me solve my problem. But I have only a strange explanation as to how. In the proof of the said theorem there are five words in this order:  $$...the\  first\  index\ for\ which...$$ These five words suggested to me the olfactory solution.
Now let's construct the desired function the following way: Let $r_1,r_2,...$  be an arbitrary listing of the rational numbers. The definition of my function is then
$$f(x,y)=r_i $$ if $i$ is $$the\  first\  index\ for\ which$$ $r_i$ is in $(x,y)$. Checking that the conditions are met is easy now. Obviously there are plenty of such functions.
My next question is if von Eitzen knew the solution when pointing to the Baire theorem(s)?


text:
Q: How to redraw only an invalidated part of OpenGL context? (for 2D GUI rendering) I'm using OpenGL to optimize GUI rendering. When rendering the whole scene it works fine, but that's not optimal, since often only a small part is changed. So I tried this:
    glReadBuffer (GL_FRONT);
    glDrawBuffer (GL_BACK);
    glCopyPixels (0, 0, sz.X, sz.Y, GL_COLOR);
    glFlush();

This should copy front buffer to back buffer, so that afterwards I can change just a portion limited using glViewport. Unfortunately when a scene is changed, it looks like the glCopyPixels command is performed after the actual rendering, so that the original content sort of alphablends with the new graphics.
What is wrong? Or is there a better way to do this?
(for the record, when I do nothing, the front buffer starts blinking with back buffer and stuff like that...)

A:
but that's not optimal

What makes you think that? OpenGL and modern GPUs are designed on the grounds, that in the worst case you have to redraw the whole thing anyway and things should perform well in that situation, too.

Or is there a better way to do this?

Yes: Redraw the whole scene. (Or what I suggest below)
To a modern low-end GPU which easily capable of throwing tens of millions of triangles to the screen per second, the few hundred to a thousand triangles of a 2D GUI are neglectible.
In fact your copying-stuff-around will probably a worse performance hit, than redrawing everything, because copying from the front to the back buffer is not a very performant operation and causes serious synchronization issues.
If you want to cache things you might split your GUI into separate widgets of content, which you draw to individually using FBOs into textures – design it in a way that widgets may overlap. You redraw a widget if its contents change. For drawing the whole window you just redraw the full window contents from the textures into the main framebuffer.

A: Ok so it seems this solves the problem:
    glDisable( GL_BLEND );

I don't know why, but it looks like before it was blending the data, despite I didn't find anything about it in docs and "glCopyPixels" doesn't seem it should do that.


text:
Q: How do I fix the unimplemented pure virtual method error? So I am trying to learn factory methods, and I am using the game plants vs zombies for example. I am just trying to create 4 different types of zombies. Ive been looking online for quite a while and can't find or understand what the problem is with my code. I am getting the unimplemented pure virtual method error.
I am getting the error on takeDamage(). Why am I getting this error?
I have my main as empty for now trying to figure this out
here is my code
class Zombie
{
public:
    static Zombie *make_zombie(int choice);
    virtual void takeDamage(int d) = 0;
    virtual ~Zombie() {};
    //void die();
};

class Reg_Zombie : public Zombie
{
public:
    int health = 50;

    void takeDamage(int d)
    {
        health -= d;
        cout << "The Regular Zombie has taken 25 damage!";
    }

};

class Cone : public Zombie
{

public:
    int health = 50;
    int acc = 25;
    void takeDamage(int d)
    {
        if (acc > 0)
        {
            acc -= d;
            cout << "The Cone Zombie has taken 25 to the accesory!";
        }
        else{
        health -= d;
        cout << "The Cone Zombie has taken 25 damage to health!";
    }
    }
};

class Bucket : public Zombie
{
public:
    int health = 50;
    int acc = 100;
    void takeDamage(int d)
    {
        if (acc > 0)
        {
            acc -= d;
            cout << "The Bucket Zombie has taken 25 to the accesory!\n";
        }
        else{
        health -= d;
        cout << "The Bucket Zombie has taken 25 damage to health!\n";
        }
    }
};

class Door : public Zombie
{
public:
    int health = 50;
    int acc = 25;
    void takeDamage(int d)
    {
        if (acc > 0)
        {
            acc -= d;
            cout << "The Door Zombie has taken 25 to the accesory!";
        }
        else{
            health -= d;
            cout << "The Door Zombie has taken 25 damage to health!";
        }
    }
};

Zombie *Zombie::make_zombie(int choice)
{
    if (choice == 1)
    {
        return new Reg_Zombie();
    }
    else if (choice == 2)
    {
        return new Cone();
    }
    else if (choice == 3)
    {
        return new Bucket();
    }
    else if (choice == 4)
    {
        return new Door();
    }
    else return NULL;
}

int main(int argc, const char * argv[]) {
Zombie* zomb[100] = NULL;
int choice;

}


text:
Q: Error Uninstall SMB1 I tried to execute this command in powershell
Uninstall-WindowsFeature -Name FS-SMB1 -Remove

but encountered error message

Uninstall-WindowsFeature: The request to add or remove features on the specified server failed. Removal of one or more roles, role services, or features failed. The referenced assembly could not be found. Error: 0x80073701

I executed this command
Get-WindowsFeature -Name FS-SMB1

and the output is
Display Name                                Name                Install State
-------------                               ------              ---------------
[X] SMB 1.0/CIFS File Sharing Support       FS-SMB1             Installed

Please help.. I am using Windows Server 2016


text:
Q: What happens when value is passed to operator overloader function in C++? I failed to understand the steps of compilation of this code.
First, where is what is purpose of the default constructor, and why so many objects of type MyClass?
link to sololearn where I saved the code
#include <iostream>
using namespace std;

class MyClass {
    public:
        int var;
        MyClass() { }
        MyClass(int a)
        : var(a) { }

        MyClass operator+(MyClass &obj) {
            MyClass res;
            res.var= this->var+obj.var;
            //'this' is refering to active (obj1)
            return res;
        }
};

int main() {
    MyClass obj1(12), obj2(55);

    MyClass res = obj1+obj2;

    cout << res.var;
}
//I've not understood, its from a lesson

A: If you suspect you don't need a piece of code, try compiling without it and you'll know pretty quickly whether your suspicion was correct or not.
When you remove the default constructor in the class you provided here's what happens:
..\Playground\: In member function 'MyClass MyClass::operator+(MyClass&)':
..\Playground\:11:21: error: no matching function for call to 'MyClass::MyClass()'
             MyClass res;
                     ^~~
..\Playground\:7:9: note: candidate: MyClass::MyClass(int)
         MyClass(int a)
         ^~~~~~~
..\Playground\:7:9: note:   candidate expects 1 argument, 0 provided
..\Playground\:4:7: note: candidate: constexpr MyClass::MyClass(const MyClass&)
 class MyClass {

Which is to say the problem is in the +operator implementation at the line MyClass res; . This line creates an instance of the object MyClassusing the default constructor, so there's no way the code snippet your provided works without a default constructor.

A: The constructor without parameters is for the object that doesn't pass any value, the one that stores the sum of the two operand objects. ---simple---


text:
Q: push notification when app is close wp8 I am trying to receive a push notification in Windows Phone Silver light 8.1 app, I have learn through This Example. It's work fine when app is running but when I close the app at that time, it is not receiving a notification, or might be not able to display a toast notification.
When app is running at that time notification displayed in a Message Box, so the problem I face is toast notification. Is there any hidden code for Toast Notification?
It was working fine earlier but after some time it automatically stopped displaying toast notification.
Please Help me resolve this problem.

A: ShellToast toast = new ShellToast();
toast.Title = "[title]";
toast.Content = "[content]";
toast.Show();

Check this site: http://msdn.microsoft.com/en-us/library/windows/apps/jj662938(v=vs.105).aspx
Also you have to make sure your app is allowed to run in background, and make sure that it can run in background.


text:
Q: Image Processing open source program? So my project involves transcribing texts in jpg files into text files, and we are currently using tesseract. However, at this current level, tesseract is not doing so well at transcribing the texts in jpg files. So I decided to use some image preprocessing program to make the image files more optimal to be fed into tesseract.
The example of image file is like this: http://i46.tinypic.com/opramo.jpg
basically old news in image forms.
Any suggestion on which image processing engine to use??? Thank you !


text:
Q: Access one item from a dict and store it into a variable I am trying to get all the "uuid"'s from an API, and the issue is that it is stored into a dict (I think). Her is how it looks on the API:
{"guild": {
        "_id": "5eba1c5f8ea8c960a61f38ed",
        "name": "Creators Club",
        "name_lower": "creators club",
        "coins": 0,
        "coinsEver": 0,
        "created": 1589255263630,
        "members":
            [{  "uuid": "db03ceff87ad4909bababc0e2622aaf8",
                "rank": "Guild Master",
                "joined": 1589255263630,
                "expHistory": {
                "2020-06-01": 280,
                "2020-05-31": 4701,
                "2020-05-30": 0,
                "2020-05-29": 518,
                "2020-05-28": 1055,
                "2020-05-27": 136665,
                "2020-05-26": 34806}}]
        }
    }

Now I am interested in the "uuid" part there, and take note: There is multiple players, it can be 1 to 100 players, and I am going to need every UUID.
Now I have done this in my python to get the UUID's displayed on the website:
try:
f = requests.get(
            "https://api.hypixel.net/guild?key=[secret]&id=" + guild).json()
        guildName = f["guild"]["name"]
        guildMembers = f["guild"]["members"]
        members = client.getPlayer(uuid=guildMembers) #this converts UUID to player names
        #I need to store all uuid's in variables and put them at "guildMembers"

And that gives me all the "UUID codes", and I will be using client.getPlayer(uuid=---) to convert the UUID into the Player Names. I have to loop through each "UUID" into that code client.getPlayer(uuid=---) . But first of I need to save the UUID'S in variables, I have been doing members.uuid to access the UUID on my HTML file, but I don't know how you do the .uuid part in python
If you need anything else, just comment :)

A: List comprehension is a powerful concept:
members = [client.getPlayer(member['uuid']) for member in guildMembers]

Edit:
If you want to insert the names back into your data (in guildMembers),
use a dictionary comprehension with {uuid: member_name,} format:
members = {member['uuid']: client.getPlayer(uuid=member['uuid']) for member in guildMembers}

Than you can update guildMembers with your results:
for member in guildMembers:
    guildMembers[member]['name'] = members[member['uuid']]

A: Assuming that guild is the main dictionary in which a key called members exists with a list of "sub dictionaries", you can try
uuid = list()
for x in guild['members']:
    uuid.append(x['uuid'])

uuid now has all the uuids

A: If i understood situation right, You just need to loop through all received uuids and get  players' data. Something like this:
f = requests.get("https://api.hypixel.net/guild?key=[secret]&id=" + guild).json()
guildName = f["guild"]["name"]
guildMembers = f["guild"]["members"]
guildMembersData = dict()  # Here we will save member's data from getPlayer method

for guildMember in guildMembers:
    uuid = guildMember["uuid"]
    memberData = client.getPlayer(uuid=uuid)
    guildMembersData[uuid] = client.getPlayer(uuid=guildMember["uuid"])

print(guildMembersData)  # Here will be players' Data.


text:
Q: permutations of n objects Does the number of permutations of $n$ objects, $r$ alike of one kind and $n−r$ alike of another kind, always equal the combinations of n different objects taken $r$ at a time? Explain.
I know permutations are $\frac{n!}{(n-r)!}$ and combinations are $\frac{n!}{r!(n-r)!}$
the question is wordy so im not sure what it is asking but is it asking if
$\frac{n!}{(n-r)!}$=$\frac{n!}{r!(n-r)!}$ ? because the answer to that would be no

A: The short answer is: yes
See, you know that the permutation formula for $n$ distinct objects can be simplified to $n!$
But if there are, say $a$ of one kind and $b$ of another, with $a+b=n$, you know that the formula changes to $\frac{n!}{a!b!}$
In the present case, $a= r, b = n-r,$ so formula becomes $\frac{n!}{r!(n-r)!}$, which is identical to the combination formula of choosing $r$ objects at a time from $n$ objects.
Added:
The formula $\frac{n!}{(n-r)!}$ that you mention is the permutation formula of $r$ objects at a time being taken from $n$ objects, i.e. $^nP_r\;\; or\;\; P(n,r) = r!\binom{n}{r}$


text:
Q: ¿Por qué sale NaN? Buen dia,
Estoy haciendo un campo que me calcule un digito de verificacion después de un guin, lo que sucede es que cuando ingreso 15 digitos, borro el guion y le doy enter, que hago para validar exacto los 15 digitos y que no me aparezca eso, aca esta el codigo
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script>
            $(document).ready(function () {
                $('#nit').change(function (event) {
                    if(validarSiNumero($('#nit').val())) {
                        $('#nit').val(calcularDigitoVerificacion($('#nit' ).val()));
                    } else {
                        $('#nit').val('');

                    }
                });
            });

            function validarSiNumero(numero){
                if(!/([1-15])/.test(numero)) {
                alert("Número Nit no valido, ingrese  números sin puntos ni comas");
                    return false;
                } else {
                    return true;
                }
            }

            function calcularDigitoVerificacion(nit) {
                console.log("Entro a  la funcion");
                var sumatoria, digitoNit, longitudNit, DV;
                var arregloPrimos=[];

                //procedimiento
                sumatoria = 0;
                digitoNit = 0;
                longitudNit = nit.length;
                arregloPrimos[1] = 3;
                arregloPrimos[2] = 7;
                arregloPrimos[3] = 13;
                arregloPrimos[4] = 17;
                arregloPrimos[5] = 19;
                arregloPrimos[6] = 23;
                arregloPrimos[7] = 29;
                arregloPrimos[8] = 37;
                arregloPrimos[9] = 41;
                arregloPrimos[10] = 43;
                arregloPrimos[11] = 47;
                arregloPrimos[12] = 53;
                arregloPrimos[13] = 59;
                arregloPrimos[14] = 67;
                arregloPrimos[15] = 71;

                console.log("Longitud Nit="+longitudNit);

                for (i = 0; i < longitudNit; i++)
                {
                    digitoNit = (nit.substr(i, 1));
                    sumatoria += (digitoNit * arregloPrimos[longitudNit - i]);
                    console.log("i="+i+" DigitoNit="+digitoNit+" Sumatoria="+sumatoria);
                }

                var modulo = sumatoria % 11;

                if (modulo > 1) {
                    DV = 11 - modulo;
                    return  nit+"-"+DV;
                } else {
                    DV = modulo;
                    return   nit+"-"+DV;
                }
            }
        </script>
    </head>
    <body>
        <label>Nit: </label>
        <input type="text" name"nit"   maxlength="15" size="15"  id="nit"
        placeholder ="Escribe el Nit"  >
    </body>
</html>


text:
Q: extract channel names from a multi-channel image I am using skimage.io.imread (which uses tifffile) to read a QPTIFF file. Multiple channels are successfully read as multiple dimensions. Is it possible to extract the channel names and other metadata?

A: PerkinElmer QPI metadata are stored as XML in the ImageDescription TIFF tags. To read the XML metadata, use the tifffile.TiffFile class, e.g.:
from xml.etree import ElementTree
from tifffile import TiffFile

with TiffFile('LuCa-7color_Scan1.tiff') as tif:
    for page in tif.series[0].pages:
        print(ElementTree.fromstring(page.description).find('Name').text)


text:
Q: Android webserver : how to know the request method received (GET or POST) In my class DeviceHandler I want to know the HTTP request method used; I don't understand how with my HttpRequest object ?
public class DeviceHandler implements HttpRequestHandler {

...

public void handle(HttpRequest request, HttpResponse response,
                        HttpContext httpContext) throws HttpException,
                                                IOException {

// I want to dispatch the treatment according GET or POST request received from my client

Thank you guys !
Anthony

A: Here is documentation
http://developer.android.com/reference/org/apache/http/HttpRequest.html
use
RequestLine rl = request.getRequestLine();
to retrieve RequestLine instance, then you can call
String m = rl.getMethod();
to get method of request.


text:
Q: Is it possible to rename libs to packages in nx? I want to rename libs folder that nx creates to packages.
Is it something possible with nx?

A: To achieve this, you will need to change the workspace.json project's paths that of all the projects that you have into the libs folder.
Also, you will need to update the tsconfig.json to update the project's resultant path too. Here you will update typescript's references.

A: You can rename a lib e.g. nx g @nrwl/workspace:mv --project my-lib --destination their-lib, more details you can find on this issue here.


text:
Q: Comparing collections of Reg Ex Patterns In short how do I best check if two collections of Reg Ex Patterns are equal(ignoring order)?
A bit more info on what i am actually trying to do with it, I have an object i use to filter log messages with, this filter object contains collections for each thing it can be used to filter on, one of those things are a Reg Ex Patterns. I have created a equals method for my filtering object so i can see if two filters are basically the same, for the other collections i can use the collections .equals method, but i have problem with the Pattern objects.
I could keep a list of the string input for the patterns in a different list and compare the string lists with .equals or I could run all the objects through and check them one by one if there .toString matched something in the other list for each list like this:
        boolean equals = true;
        for (Pattern p1: patternList1) {
            boolean found = false;
            for (Pattern p2: patternList2) {
                if(p1.toString().equals(p2.toString())) {
                    found = true;
                    break;
                }
            }
            if(!found) {
                equals = false;
                break;
            }
        }
        if(equals) {
            for (Pattern p1: patternList2) {
                boolean found = false;
                for (Pattern p2: patternList1) {
                    if(p1.toString().equals(p2.toString())) {
                        found = true;
                        break;
                    }
                }
                if(!found) {
                    equals = false;
                    break;
                }
            }
        }
        return equals;

This dos not look very effective but would work, but it would not catch if two of the regexp patterns matches the same but written different. How can the code above be optimized/done differently? and is there any "simple" way of catching reg ex that are written different but matches the same?

A: The issue here is that the Pattern class does not implement equals(), so you can't compare the collections easily. To get around this, create your own Pattern wrapper class, which holds a Pattern and implements equals(). For example:
public class PatternWrapper{
    private final Pattern pattern;

    public PatternWrapper(Pattern p) {
        this.pattern = p;
    }

    /**
     * @return the pattern
     */
    public Pattern getPattern() {
        return pattern;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((pattern == null) ? 0 : pattern.hashCode());
        return result;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (obj == this)
            return true;
        if (!(obj instanceof PatternWrapper))
            return false;
        PatternWrapper other = (PatternWrapper) obj;
        if (pattern == null) {
            if (other.pattern != null)
                return false;
        } else if (!pattern.toString().equals(other.pattern.toString()))
            return false;
        return true;
    }
}

Now you can store PatternWrapper objects in your collections instead.
Since you want to ignore ordering when comparing the collections, you can't simply call equals between the two collections, because that will compare corresponding elements. However, you can use another library such as Apache commons-collections CollectionUtils#isEqualCollection to compare them independent of order. Take a look at this SO question for more info: Is there a way to check if two Collections contain the same elements, independent of order?
I don't think there is a simple way of matching two regexes which have different patterns but match the same text. One way might be to have a list of test strings which you can run against each regex to see if they match.

A: I just answered a rather similar question regarding comparing one Pattern as that is problematic since its flag is ignored when comparing them. Because a list or an array of those is pretty much the same thing anyone running into this question might look there, too.
Regarding unsorted checks see dogbane's answer.


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

A: Как вариант, сделать за лого див с изменяющимся фоном в высоту, будь то картинка, градиент, что бы ни было. Размеры, позицию и координаты задать как у лого, overflow: hidden. И затем, при прокрутке страницы прокручивать его JS'oм. Немного индийский вариант, но шанс на жизнь в контексте предложения, думаю имеет.

A: Предлагаю определять цвет блока, который сейчас находится сверху и при помощи SVG-свойства fill менять цвет логотипа в соответствии с определенным цветом. Если ваш логотип не в SVG-формате, то его надо будет вставить в блок <svg></svg как <image xlink:href="">.

var blockHeight = [],
  blockColor = [],
  blockTop = [],
  $svgPaths = $('svg path');

$(window).scroll(function() {
  blockArr = getBlocks();

  for (var i = 0; i < blockTop.length; i++) {

    if (blockTop[i] <= 0 && -blockTop[i] <= blockHeight[i]) {
      $svgPaths.css('fill', blockColor[i]);
    }
  }
});

function getBlocks() {
  $('.block').each(function(index) {
    blockHeight[index] = $(this).outerHeight();
    blockTop[index] = this.getBoundingClientRect().top;
    blockColor[index] = $(this).css('background-color');
  });
}
* {
  margin: 0;
  padding: 0;
}
.container {
  height: 1500px;
}
.container header {
  position: fixed;
  width: 100%;
  padding: 15px;
  background-color: #fff;
}
.block {
  height: 200px;
}
.block--red {
  background-color: red;
}
.block--green {
  background-color: green;
}
.block--yellow {
  background-color: yellow;
}
.block--blue {
  background-color: blue;
}
svg {
  width: 100px;
  margin: 0 auto;
  display: block;
}
svg path {
  fill: #239fff;
}
svg path.dot {
  fill: #f8db1e;
}

    <svg version="1.1" x="0px" y="0px" viewBox="0 190 250 80" xml:space="preserve">
      <path class="letter" d="M17,231.7l10.7-13c0.8-0.9,0.3-2-0.8-2h-8c-0.8,0-1.5,0.3-2.2,1.1l-7.3,9.3v-8.7c0-1.2-0.6-1.7-1.7-1.7H1.7 c-1.1,0-1.7,0.6-1.7,1.7v30c0,1.2,0.6,1.7,1.7,1.7h5.9c1.1,0,1.7-0.6,1.7-1.7v-11.6l9.8,12.2c0.6,0.7,1.1,1.2,2,1.2h8.3 c1.1,0,1.5-1.2,0.9-1.9L17,231.7z"></path>
      <path class="letter" d="M181.4,216.8h-24.9c-0.8,0-1.4,0.6-1.4,1.4v6.5c0,0.8,0.6,1.4,1.4,1.4h7.9v22.7c0,0.8,0.6,1.4,1.4,1.4h6.5 c0.8,0,1.4-0.6,1.4-1.4v-22.7h7.8c0.8,0,1.4-0.6,1.4-1.4v-6.5C182.8,217.4,182.2,216.8,181.4,216.8"></path>
      <path class="letter" d="M107.7,242.7h-8v-6.3h8C112.6,236.5,113,242.7,107.7,242.7 M99.7,224.2h6c3.9,0,3.9,5.2,0,5.2h-6V224.2z  M114.9,232c5.9-5.7,2-15.2-7.1-15.2H92.1c-0.8,0-1.4,0.6-1.4,1.4v30.6c0,0.8,0.6,1.4,1.4,1.4h17.1 C121.2,250.2,124.3,236.5,114.9,232"></path>
      <path class="letter" d="M83.3,218.2c0-0.8-0.6-1.4-1.4-1.4h-7.4c-0.8,0-1.4,0.6-1.4,1.4v30.6c0,0.8,0.6,1.4,1.4,1.4h7.4 c0.8,0,1.4-0.6,1.4-1.4V218.2z"></path>
      <path class="letter" d="M232.5,232.1h-5v-7.7h4.9c3.3,0,4.4,1.5,4.4,3.8C236.8,230.2,235.9,232.1,232.5,232.1 M233.2,216.8h-13.6 c-0.8,0-1.4,0.6-1.4,1.4v30.6c0,0.8,0.6,1.4,1.4,1.4h6.5c0.8,0,1.4-0.6,1.4-1.4v-9h5.3c7.5,0,13.2-4,13.2-11.4 C246,221.3,240.1,216.8,233.2,216.8"></path>
      <path class="letter" d="M193.8,237.1l3.7-11l3.7,11H193.8z M215.1,248.6L203.7,218c-0.3-0.8-0.9-1.3-1.9-1.3h-8.6c-1,0-1.6,0.5-1.9,1.3 l-11.4,30.5c-0.3,0.9,0.2,1.7,1.1,1.7h7.3c0.6,0,1.2-0.5,1.4-1l1.5-4.5h12.6l1.5,4.5c0.2,0.6,0.8,1,1.4,1h7.3 C214.9,250.2,215.4,249.5,215.1,248.6"></path>
      <path class="letter" d="M65.9,248.8v-30.6c0-0.8-0.6-1.4-1.4-1.4h-7.1c-0.6,0-1,0.3-1.3,0.7l-13.2,17.9l0-17.2c0-0.8-0.6-1.4-1.4-1.4 H35c-0.8,0-1.4,0.6-1.4,1.4v30.6c0,0.8,0.6,1.4,1.4,1.4h7.1c0.6,0,1-0.3,1.3-0.7l13.2-17.9l0,17.2c0,0.8,0.6,1.4,1.4,1.4h6.5  C65.3,250.2,65.9,249.6,65.9,248.8L65.9,248.8z"></path>
      <path class="letter" d="M152.9,243.9l-3.8-4.1l0,0c-0.3-0.3-0.7-0.5-1.1-0.5c-0.4,0-0.7,0.2-1,0.4c-3.3,2.6-5.9,2.8-7.5,2.8 c-4.9,0-8.9-4-8.9-9c0-4.9,4-9,8.9-9c1.6,0,4.2,0.2,7.5,2.8c0.3,0.2,0.6,0.4,1,0.4c0.4,0,0.8-0.2,1.1-0.5h0l3.8-4.1v0 c0.2-0.3,0.4-0.6,0.4-1c0-0.4-0.2-0.8-0.4-1c-4.3-3.9-8.3-5.5-13.3-5.5c-9.8,0-17.8,7.9-17.8,17.8c0,9.9,8,17.9,17.8,17.9 c5,0,9-1.5,13.3-5.4v0c0.3-0.3,0.4-0.6,0.4-1C153.3,244.5,153.1,244.2,152.9,243.9L152.9,243.9z"></path>
      <path class="dot" d="M75.7,203.5c0,4.7-3.8,8.5-8.4,8.5c-4.6,0-8.4-3.8-8.4-8.5c0-4.7,3.8-8.5,8.4-8.5C72,195,75.7,198.8,75.7,203.5"></path>
      <path class="dot" d="M97.5,203.5c0,4.7-3.8,8.5-8.4,8.5c-4.6,0-8.4-3.8-8.4-8.5c0-4.7,3.8-8.5,8.4-8.5 C93.8,195,97.5,198.8,97.5,203.5"></path>
    </svg>

A: Пожалуй «дырявый логотип» это самый простой вариант. Остальные варианты попахивают теми ещё извращениями:
Если цвета фона постоянны (не зависят от контента) то можно вручную сопоставить нужные цвета с соответствующими значениями window.pageYOffset например.
Или определять какой элемент находится в нужной части экрана (не подскажу как именно это делать) и считывать его background-color.


text:
Q: Selecting and entering information into web forms with Python 3.X In a program I am creating in Python 3.3.2, I need to have the program log into my account by selecting forms on the webpage, entering information to the forms, and submitting the information.  Python 2.X versions have mechanize for this, but I would not like to have to port the program to be compatible with 2.X. Is there a library like Mechanize for 3.X or a way I could code this myself without an extensive knowledge of all the built-in web libraries?

A: One popular library/mechanism is Selenium. It has a Python API that supports Python 3, and a whole bunch of features that would be quite useful for your project. Good luck!


text:
Q: "a too strong signal" Or "too strong of a signal"
The object is emitting too strong of a signal that it's unreasonable to consider it to be a mere chunk of scrap metal.
The object is emitting a too strong signal that it's unreasonable to consider it to be a mere chunk of scrap metal.

Actually the first one is the original sentence, but that kind of structure is rather unfamiliar to me. Could you let me know what's the difference or what's the correct usage here?


text:
Q: Trigger Camera on Google Glass I want to have a way to trigger the camera on Google Glass right after I get in (e.g., "Ok Glass", "App", ) but I cannot find any similar examples online.
Any idea how to trigger this?
Also, currently when I try to create a new Android project it will be the default Hello World, is there a template for Google Glass?

A: On Ok glass you can write like -
    String fileUri ="file:///mnt/sdcard/Pictures/" ;

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // file:///mnt/sdcard/Pictures/MyCameraApp/IMG_20130812_105617.jpg

    startActivityForResult(intent, TAKE_PICTURE_REQUEST);

Then you have to call -
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == TAKE_PICTURE_REQUEST && resultCode == RESULT_OK) {
        String picturePath = data.getStringExtra(
                CameraManager.EXTRA_PICTURE_FILE_PATH);
    }

    super.onActivityResult(requestCode, resultCode, data);
}

It will work.

A: If you want to launch the built-in camera application immediately at the beginning of your application, you can call startActivityForResult with an intent whose action is MediaStore.ACTION_IMAGE_CAPTURE inside your initial activity's onCreate method. (But note the differences between Android and Glass with respect to how the captured photo is returned; see the Glass Camera class Javadoc for more details.)
Eclipse and Android Studio do not currently have any special support to generate Glass projects out of the box.

A: You can use my sample Camera Snapshot on GitHub. It does exactly what you're asking.
Here it is:
https://github.com/dazza222/GlassCameraSnapshot


text:
Q: socket: Address family not supported by protocol in ninfod.service I'd generate an OS for an embedded system (based on a i.MX 6Quad Cortex-A9 processor) using buildroot 2020.02. Here are some of my toolchain option :
BR2_GCC_VERSION_8_X=y
BR2_GDB_VERSION_8_3=y
BR2_BINUTILS_VERSION_2_33_X=y.

When I do a : systemctl --failed , one service failed : it's node.service and it status is the following :
 ninfod.service - Respond to IPv6 Node Information Queries
 Loaded: loaded (/usr/lib/systemd/system/ninfod.service; enabled; vendor preset: enabled)
 Active: failed (Result: exit-code) since Mon 2020-07-27 08:26:32 UTC; 6min ago
 Process: 2834 ExecStart=/usr/sbin/ninfod -d (code=exited, status=1/FAILURE)
 Main PID: 2834 (code=exited, status=1/FAILURE)

When i execute the executable here is the message error : [ERR] socket: Address family not supported by protocol. So I think it's an C error comming from the source file ninfod.c
I don't have any precision about this error ; does anyone know how to fix it ?


text:
Q: iOS Swift connect WiFi programmatically and distinguish between bad password and no WiFi in range NEHotspotConfiguration works well, but the error is nil both when the SSID I am trying to connect to is not available (out of range or off) or when the password I've submitted is incorrect.
What am I doing wrong? I want to be able to distinguish between these two scenarios so I can inform the user accordingly.
Code snippet:
func connect(ssid: String, password: String, completionHandler: @escaping(Bool?, String?) -> Void) {
    activityIndicatorView?.startAnimating()

    guard !isAlreadyConnected(ssid: ssid) else {
        activityIndicatorView?.stopAnimating()
        completionHandler(true, nil)
        return;
    }

    let hotspotConfig = NEHotspotConfiguration(ssid: ssid, passphrase: password, isWEP: false)//Secured connections
    hotspotConfig.joinOnce = true

    NEHotspotConfigurationManager.shared.apply(hotspotConfig) {[weak self] (error) in
        guard let self = self else { return; }

        self.activityIndicatorView?.stopAnimating()
        if let error = error {
            completionHandler(false, error.localizedDescription)
        }
        else {
            let ssids = self.currentSSIDs()
            if ssids.count > 0 && ssids.first == ssid {
                completionHandler(true, nil)
            } else {
                completionHandler(false, error?.localizedDescription ?? "An error occured")
            }
        }
    }
}

A: Quickly tried it and it is perfectly reproducible it seems.
Further research revealed that it is an Apple error.
So the answer is: You are nothing doing wrong, it's a bug.
Reasons seems to be:

...the errors that you see via the completion handler are those errors related to the framework itself.  Once the request has made it past the Network Extension framework, down to the Wi-Fi subsystem, errors are displayed to the user rather than delivered to your completion handler.  Whether that's a bug is up for debate.

Later down one can read:

So my 2 bugs (46628017 and 46579891) regarding the NEHotspot marked as duplicated of 42919071

see the whole discussion here:
https://forums.developer.apple.com/thread/96834
Some Experiment
There is this nice SO answer: https://stackoverflow.com/a/5198968/2331445
It shows how to access information about the currently connected WIFI.
As the author explains, you need to add the Access WiFi Information capability for iOS > 12. A test using the getConnectedWifiInfo method from the above SO answer for an experiment might look like this:
import UIKit
import NetworkExtension
import SystemConfiguration.CaptiveNetwork

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    @IBAction func onConnect(_ sender: Any) {
        let configuration = NEHotspotConfiguration.init(ssid: "somessid", passphrase: "somepassphrase", isWEP: false)
        configuration.joinOnce = true

        NEHotspotConfigurationManager.shared.apply(configuration) { [weak self] (error) in
            print("error is \(String(describing: error))")
            if let error = error {
                let nsError = error as NSError
                if nsError.domain == "NEHotspotConfigurationErrorDomain" {
                    if let configError = NEHotspotConfigurationError(rawValue: nsError.code) {
                        switch configError {
                        case .invalidWPAPassphrase:
                            print("password error: \(error.localizedDescription)")
                        case .invalid, .invalidSSID, .invalidWEPPassphrase,
                             .invalidEAPSettings, .invalidHS20Settings, .invalidHS20DomainName, .userDenied, .pending, .systemConfiguration, .unknown, .joinOnceNotSupported, .alreadyAssociated, .applicationIsNotInForeground, .internal:
                            print("other error: \(error.localizedDescription)")
                        @unknown default:
                            print("later added error: \(error.localizedDescription)")
                        }
                    }
                } else {
                    print("some other error: \(error.localizedDescription)")
                }
            } else {
                print("perhaps connected")

                self?.printWifiInfo()
            }
        }

    }

    @IBAction func onInfo(_ sender: Any) {
        self.printWifiInfo()
    }

    private func printWifiInfo() {
        print("printWifiInfo:")
        if let wifi = self.getConnectedWifiInfo() {
            if let connectedSSID = wifi["SSID"] {
                print("we are currently connected with \(connectedSSID)")
            }
            print("further info:")
            for (k, v) in wifi {
                print(".  \(k) \(v)")
            }
        }
        print()
    }

    private func getConnectedWifiInfo() -> [AnyHashable: Any]? {
        if let ifs = CFBridgingRetain( CNCopySupportedInterfaces()) as? [String],
            let ifName = ifs.first as CFString?,
            let info = CFBridgingRetain( CNCopyCurrentNetworkInfo((ifName))) as? [AnyHashable: Any] {
                return info
            }
        return nil
    }

}

And indeed if I run this code I get as result:
error is nil
perhaps connected
printWifiInfo:
we are currently connected with somessid
further info:
.  SSIDDATA <11111111 22222222 333331333 44444444 55>
.  BSSID 70:33:ab:cd:ef:22
.  SSID somessid

The author of this SO answer also shows methods for older iOS versions.


text:
Q: NGinx and multiple docker containers but one subdomain My Goal
I want to use a single NGinx docker container as a proxy.
I want it to respond to traffic on my domain: "sub.domain.com" and listen on port 80 and 443.
When traffic comes in on /admin I want it to direct all traffic to one docker container (say... admin_container:6000).
When traffic comes in on /api I want it to direct all traffic to another docker container (say... api_container:5500).
When traffic comes in on any other path (/anything_else) I want it to direct all traffic to another docker container (say... website_container:5000).
Some Helpful Context
Real quick, let me provide some context in case it's helpful. I have a NodeJS website running in a docker container. I'd like to also have an Admin section, created with ASP.NET Core that runs in a second docker container. I'd like both of these websites to share and make use of a single ASP.NET Core Web Api project, running in a third docker container. So, one NodeJS project and two ASP.NET Core projects, that all live on a single subdomain:

*

*sub.domain.com/

*

*Serves the main website

*sub.domain.com/admin

*

*Serves the Admin website

*sub.domain.com/api

*

*Serves API endpoints and handles Database connectivity

What I have So Far
So far I have the NGinX reverse proxy set up and a single docker container for the NodeJS application. Currently all traffic on :80 is redirected to 443. All traffic on 443 is directed to the NodeJS docker container, running privately on :5000. I'll admit I'm not great with NGinx and don't fully understand how this works.
The NGinx.conf file
worker_processes 2;

events { worker_connections 1024; }

http {
    sendfile on;
    proxy_buffer_size   128k;
    proxy_buffers   4 256k;
    proxy_busy_buffers_size   256k;

    upstream docker-nodejs {
        server nodejs_prod:5000;
    }

    server {
        listen 80;
        server_name sub.domain.com;
        return 301 https://$host$request_uri;
    }

    server {
        listen 443 ssl;
        server_name sub.domain.com;
        ssl_certificate     /etc/nginx/ssl/combined.crt;
        ssl_certificate_key /etc/nginx/ssl/mysecretkeyfile.key;

        location / {
            proxy_redirect     off;
            proxy_set_header   Host $host;
            proxy_set_header   X-Forwarded-Proto https;
            proxy_set_header   X-Forwarded-Ssl on;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host $server_name;
            proxy_pass         http://docker-nodejs;
        }
    }

}

Quick Note: In the above code "nodejs_prod:5000" refers to the container who's name is "nodejs_prod" and listens on port 5000. I don't understand how that works, but it is working. Somehow docker is creating DNS entries in the private network, one for each container name. I'm actually using docker-compose.
My Actual Question: How will this NGinx.conf file look when I have 2 more websites (each a docker container). It's important that /admin and /api are sent to the correct docker containers, and not handled by the "catch all" location. I'm imagining that I'll have a "catch all" location which captures all traffic that DOESN'T START WITH /admin OR /api.
Thank you!

A: In your nginx config you want to add location rules, such as
  location /admin {
    proxy_pass http://admin_container:6000/;
  }

  location /api {
    proxy_pass http://api_container:5500/;
  }

This redirects /admin to admin_container port 6000, and /api to api_container and port 5500.
docker-compose creates a network between all it's containers. Which is why http://api_container:5500/ points to the container named api_container and the port 5500. This can be used for communication between containers. You can read more about it here https://docs.docker.com/compose/networking/


text:
Q: How to monitor ZFS with SNMP in FreeBSD? I'd like to monitor these with SNMP:
zpool iostat -v 1

Per drive and sum.
zpool status

Scrubbing as 1 and not scrubbing as 0.
zpool status -x

Monitor $? (return value). Send trap when value is not 0.
zfs list

Used & free space.
What kind of scripts are needed?

A: Assuming you're using net-snmpd, you'd probably need to write a script per value. Then, using the techniques described in the snmpd.conf man page, section 'extending agent functionality', add references of those scripts to your snmpd.conf.
For example, /root/bin/myzstatus:
#!/bin/sh
/sbin/zpool status -x $1

and in snmpd.conf:
extend status /root/bin/myzstatus tank

With zfs/zpool, you're blessed since most of the subcommands have options for machine output, which will make it easier to grok.

A: I don't know the answer for the zpool status, scrub, etc. but for space I figured something out.
in /etc/snmpd.config, I found this, and uncommented it, and now I have storage values:
#
# Host resources module
#  This requires the mibII module.
#
begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so"

And here is some output:
# snmpwalk -v1 -c public $freebsdzfsmachine | grep -E "Storage.*\.22 " | less
HOST-RESOURCES-MIB::hrStorageIndex.22 = INTEGER: 22
HOST-RESOURCES-MIB::hrStorageType.22 = OID: HOST-RESOURCES-TYPES::hrFSOther
HOST-RESOURCES-MIB::hrStorageDescr.22 = STRING: /tank, type: zfs, dev: tank
HOST-RESOURCES-MIB::hrStorageAllocationUnits.22 = INTEGER: 512 Bytes
HOST-RESOURCES-MIB::hrStorageSize.22 = INTEGER: 2147483647
HOST-RESOURCES-MIB::hrStorageUsed.22 = INTEGER: 1030063349
HOST-RESOURCES-MIB::hrStorageAllocationFailures.22 = Counter32: 0
HOST-RESOURCES-MIB::hrFSStorageIndex.22 = INTEGER: 24

Unfortunately, the Size output (1024 GiB) is wrong. Storage size according to df is 20 TiB and used is 491 GiB, but for some reason, Size here is coincidentally exactly 2^31-1 * 512 bytes. (where 2^31-1 is the maximum value of a signed 32 bit integer). Used is correct though: 1030063349*512/1024/1024/1024 = 491.
Fortunately though, it works fine for my 80 GB root disk. I guess it is limited to 1 TiB on FreeBSD. This same mount seen using SNMP on a Linux NFS client shows the correct value and hrStorageAllocationUnits is "INTEGER: 32768 Bytes"


text:
Q: Get Value of other cells DataGrid WPF Hi I have sucessfully managed to make datagrid with checkbox but i have no idea how to get the state of checkbox it is checked or unchecked.I was recommended to use INotifyPropertyChanged.
of CellEditEnding event handler.Please help me i donot know how can i implement any one of these.
what i want is that check the value of checkbox which is checked/uncheked by user click. and can get the row index as well as value in first cell of that row.
My code so far is
namespace embeddatagridcheckbox
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        List<checkedBoxIte> item = new List<checkedBoxIte>();
        public MainWindow()
        {
            InitializeComponent();
            for (int i = 0; i < 5; i++)
            {
                checkedBoxIte ite = new checkedBoxIte();
                ite.MyString = i.ToString();
                ite.MyBool = false;
                item.Add(ite);
            }
            dataGrid1.ItemsSource = item;
        }
    }

    public class checkedBoxIte
    {
        public string MyString { get; set; }
        public bool MyBool { get; set; }
    }
}

XML is
<DataGrid AutoGenerateColumns="False" Height="323" HorizontalAlignment="Left" Name="dataGrid1" VerticalAlignment="Top" Width="503" BeginningEdit="dataGrid1_BeginningEdit">
            <DataGrid.Columns>
                <DataGridTextColumn Header="MyString" Binding="{Binding MyString}" />
                <DataGridCheckBoxColumn Header="MyBool" Binding="{Binding MyBool}" />
            </DataGrid.Columns>
        </DataGrid>

A: Where do you want to reference the CheckBox value from? Normally I would work with the DataGrid's ItemSource object directly instead of with figuring out rows/columns, but that depends on what you are trying to do.
In your example, you would find the state of the checkboxes in your list named list in the Code Behind, since that is what your datagrid is bound to.
list[0] = first row's data
list[0].MyBool = Checkbox value of first row


text:
Q: Bootstrap breaks row cell in production I have a problem with bootstrap row/cell position.
I am generating 6 col in one row and on my dev env locally I dont have this issue, but on production one cell is moved into like third row.
Here is how its looks:
https://screenshots.firefox.com/byRFg1d6kWAPKbc0/www.javascript.ba
Here is also html:

My goal is to have this six cells in two rows

Most Viewed News Today

43

02:14 02/09/18

The Best Node.js

24

02:14 02/09/18

Quasar Framework

5

08:08 01/09/18

Dependency Injection & Smart Table: Advanced Patterns

43

02:14 02/09/18

The Best Node.js

24

02:14 02/09/18

Quasar Framework

5

08:08 01/09/18

Dependency Injection & Smart Table: Advanced Patterns

A: You could just make 2 rows instead of 1
Each column having col-lg-4 col-md-4 col-sm-4 col-xs-12 (so you would have 3 "cells" in each row) - but of course on smaller screens you have to adjust, hence the col-xs-12

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">


text:
Q: Calling C webassembly function with const *const *inputs from javascript I am planning to use an existing c library in the web using webassembly.
Below is the gist of the function of the library that I do not have any control over the program
#include <stdio.h>
#include <stdlib.h>

int avg(int size, double const *const *inputs, double const *options, double *const *outputs) {
    const double *input = inputs[0];
    const int period = (int)options[0];
    double *output = outputs[0];
    const double scale = 1.0 / period;
    double sum = 0;

    int i;
    for (i = 0; i < period; ++i) {
        sum += input[i];
    }

    *output++ = sum * scale;

    for (i = period; i < size; ++i) {
        sum += input[i];
        sum -= input[i-period];
        *output++ = sum * scale;
    }

    return 0;
}

For the third argument *options passing an array I usually Module._malloc() and send the memory pointer after setting all the required values in that memory pointer location like below and it works fine
var optionsPointer = Module._malloc(options_required.length * 64);
var optionsValues = new Float64Array(Module.wasmMemory.buffer, optionsPointer, options_required.length);
optionsValues.set(option_values);

But how would I send parameters like double const *const *inputs(second) and double *const *outputs (last) arguments. I tried creating pointer array of pointer like below for the second argument with no success.
var inputMemoryPointer = Module._malloc(size * 64);
var inputMemoryValues = new Float64Array(Module.wasmMemory.buffer, inputMemoryPointer, size);
inputMemoryValues.set(user_inputs[input]);

var inputsPointer = Module._malloc(64)
var inputsValues = new Float64Array(Module.wasmMemory.buffer, inputsPointer, 1);
inputsValues.set([inputMemoryPointer]);

I use emscripten to create wasm and the javascript wrapper if it helps.

A: inputsValues should be a Uint32Array, not a Float64Array; pointers are 32-bit unsigned integers in emscripten.
Also double-check the sizes of your allocations; I notice you're allocating 64 bytes for the inputs array of pointers which is room for 16 pointers, but only setting one. (If there are meant to be 16 items for each iteration, then that's fine as long as your real code sets the other items.)


text:
Q: webpack copy plugin gives error: output.filename is required, either in config file or as --output-filename As a clean node project I do:
npm install webpack copy-webpack-plugin

and this is my webpack.config.js file:
var CopyWebpackPlugin = require('copy-webpack-plugin');
var path = require('path');

module.exports = {
  plugins: [
    new CopyWebpackPlugin([
      {
        from: 'src',
        to: 'dist'
      }
    ])
  ]
};

when I run npm run webpack get this error message:
$ npm run webpack

> test@1.0.0 webpack /var/www/html/test
> webpack

/var/www/html/test/node_modules/webpack/bin/convert-argv.js:507
                throw new Error("'output.filename' is required, either in config file or as --output-filename");
                ^

Error: 'output.filename' is required, either in config file or as --output-filename
    at processOptions (/var/www/html/test/node_modules/webpack/bin/convert-argv.js:507:11)
    at processConfiguredOptions (/var/www/html/test/node_modules/webpack/bin/convert-argv.js:150:4)
    at module.exports (/var/www/html/test/node_modules/webpack/bin/convert-argv.js:112:10)
    at yargs.parse (/var/www/html/test/node_modules/webpack/bin/webpack.js:171:41)
    at Object.Yargs.self.parse (/var/www/html/test/node_modules/yargs/yargs.js:533:18)
    at Object.<anonymous> (/var/www/html/test/node_modules/webpack/bin/webpack.js:152:7)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

There is no specific solution around. how to solve it?

A: Try to add entry and output in webpack.config.js
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');

const rootPath = path.join(__dirname, '/');

module.exports = {
  entry: {
    main: `${rootPath}/src/main.js`,
  },

  output: {
    filename: '[name].[hash].js',
    path: `${rootPath}/dist`,
  },

  plugins: [
    new CopyWebpackPlugin([
      {
        from: 'src',
        to: 'dist'
      }
    ])
  ]
};

Hope this may help you.


text:
Q: How does Flyways multiple schemas work? I am trying to figure out how the multiple schemas feature works. Like this question, I experiencing that only the first specified schema is actually used. The others are created, but then nothing happens with them again. I don't think I am understanding the feature correctly.
What I want to have happen is to have multiple, identical, schemas in my Postgres database. So in PG I have the schemas: tenant1, tenant2, etc...  Each of these should have identical schemas so I will have a migration script that says CREATE TABLE users and in the end I want tenant1.users and tenant2.users. Effectively this would be the same as putting it in a loop.

A: This has now been added to the FAQ: http://flywaydb.org/documentation/faq.html#multiple-schemas

If you have multiple identical schemas, say one per tenant, invoke Flyway in a loop and change flyway.schemas to match the name of the schema of the current tenant.


text:
Q: Sampling a distribution with restrictions: eliminating the correlation between two variables I have a collection of $400.000+$ word-pairs. Each word-pair has an association strength, which is a measure of how related the two words are to each other (as in cow-milk). Each word-pair also has a word-frequency, which is how often the two words occur in normal conversation. There is a correlation between the two variables: as association strength increases, word-frequency increases somewhat linearly.
I want to study the effects of association strength and take word-frequency out of the picture. This means I have to correct for word-frequency, so I want to construct a subset of about 1.000 word-pairs with retains the distribution of the association strength, but has no more correlation to word-frequency. I know such a subset exists but am at a loss how to efficiently construct it.


text:
Q: Berkeley DB java edition, any LGPL or BSD alternatives in Java? I am dealing with a huge dataset consisting of key-value pairs. The queries are always in the form of range queries on the key space (keys are numbers) hence any persistent B-Tree like structure will handle the situation. I would like to use BDB-Java Edition but the product is closed source and my company doesn't want to buy BDB-JE License. I am wondering, would you please share your experience with any non-GPL java based key-value storage system.
Thanks,
-A

A: There is also OrientDB, which is a document database written in Java and can be embedded to application (no external server) like BDB Java edition. They use Apache 2.0  license.
They also have key/value based variant: OrientKV. I haven't really used Orient myself, just poking around, so I don't know if it supports your use case (range queries on key space).  However, it advertises itself as really fast.
Though, it seems Orient DB is not very widely used. I even made a question asking if anybody has any experiences to share.

A: Tokyo Cabinet comes to mind as a very fast KV store which is under the LGPL and is embedded like the BDB and supports BTrees. It is c-based but a javaclient is available and I had no trouble installing it.
MongoDB and CouchDB nice , but it runs as a separate server. Again Java support is available.


text:
Q: Calling Authentication Function in react-native I am setting up a basic authentication screen for my app.
What I have going on right now is a button calling a function called auth
My problem is when I click on the button, in turn calling the function, nothing in my function seems to be executed.
Here is my code:
import React from "react";
import {
  View,
  TextInput,
  StyleSheet,
  Alert,
  KeyboardAvoidingView,
  Dimensions
} from "react-native";
import { Button, Text } from "native-base";

let width = Dimensions.get("window").width;
let height = Dimensions.get("window").height;

export default class Login extends React.Component {
  static navigationOptions = {
    title: "Login to Aeries"
  };

  constructor(props) {
    super(props);
    this.state = { isAuthed: false, username: "", authError: false, password: "" };
    this.auth = this.auth.bind(this);

    const showAlert = () => {
      Alert.alert(
        'There was an error loging in. Please check your username and password and try again.'
      )
    }
  }

  auth(){

    //do auth
    this.setState({ authError: false,isAuthed: false });

    if (this.state.isAuthed === false && this.state.isAuthed === false && this.state.username == "admin" && this.state.password == "admin") { // authentication is successful
      this.setState({ isAuthed: true });
      this.props.navigation.navigate("Grades")
    } else { // auth error
      this.setState({ authError: true,isAuthed: false });
      this.showAlert
    }

  };
  render() {
    const { showAlert } = this.state
    return (
      <View style={styles.wrapper}>
        <KeyboardAvoidingView behavior="padding" style={styles.loginContainer}>
          <TextInput
            placeholder="school email"
            keyboardType="email-address"
            autoCapitalize="none"
            autoCorrect={false}
            placeholderTextColor="white"
            style={styles.input}
            value={this.state.username}
          />

          <TextInput
            placeholder="password"
            secureTextEntry
            autoCorrect={false}
            autoCapitalize="none"
            placeholderTextColor="white"
            style={styles.input}
            value={this.state.password}
          />

          <View style={{
            flexDirection: 'column',
            justifyContent: 'center',
            alignItems: 'center',
            margin: 12
          }}>

            <Button
              primary
              onPress={this.auth}
            >

              <Text> Login </Text>

            </Button>
          </View>

        </KeyboardAvoidingView>

      </View>
    );
  }
}

const styles = {
  loginContainer: {
    flexDirection: 'column',
    justifyContent: 'center',
    alignItems: 'center',
    width: width - 42,
    backgroundColor: "#bdc3c7",
    borderRadius: 9,
    marginTop: 21,
    marginBottom: 21
  },

  input: {
    paddingHorizontal: 10,
    color: "#2c3e50",
    backgroundColor: "#95a5a6",
    margin: 12,
    height: 42,
    width: width - 69,
    borderRadius: 3
  },

  logo: {
    width: 231,
    height: 231
  },

  wrapper: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
    marginTop: -21
  },

  loginButton: {
    borderRadius: 3,
    marginTop: 9,
    marginBottom: 21
  },
  error: {
    color: 'red',
    textAlign: 'center',
  }
};

What should be happening when I click the button is it should be calling the auth function
The auth function should check if the username and password are both admin and if so navigate to the screen called Grades
(btw I am using react-navigation)
If the username and password are not 'admin' then an alert should show up saying the authentication was unsuccessful.
Thanks in advance. Let me know if you would like me to append any other code.

A: Your approach is wrong, do this
Bind the function in constructor
constructor(props) {
   super(props);
   this.auth = this.auth.bind(this);
}

set function like this
auth() {
   // Your chunk of code
}

The button should be like this
<Button onPress={this.auth} />

If there is any issue let me know in the comment section!
Check this live demo


text:
Q: What is assertEqual in Python UnitTest supposed to do? assertEqual(a, b) checks if a == b and return True or False,
The documentation says,

Test that first and second are equal. If the values do not compare
equal, the test will fail.

I'm running three tests with assertEqual on a simple class,
The class on test
class Car:
    def __init__(self, name):
        self.name = name

The TestCase
class CarTest(unittest.TestCase):

    def test_diff_equal(self):
        car1 = Car('Ford')
        car2 = Car('Hyundai')
        self.assertEqual(car1, car2)

    def test_name_equal(self):
        car1 = Car('Ford')
        car2 = Car('Ford')
        self.assertEqual(car1, car2)

    def test_instance_equal(self):
        car1 = Car('Ford')
        self.assertEqual(car1, car1)

The results are
F.F
======================================================================
FAIL: test_diff_equal (cartest.CarTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "cartest.py", line 10, in test_diff_equal
    self.assertEqual(car1, car2)
AssertionError: <car.Car instance at 0x7f499ec12ef0> != <car.Car instance at 0x7f499ec12f38>

======================================================================
FAIL: test_name_equal (cartest.CarTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "cartest.py", line 15, in test_name_equal
    self.assertEqual(car1, car2)
AssertionError: <car.Car instance at 0x7f499ec12fc8> != <car.Car instance at 0x7f499ec12f38>

----------------------------------------------------------------------
Ran 3 tests in 0.000s

FAILED (failures=2)

Is assertEqual used to check if both the instances are same? Or is anything wrong in my setup? Why did test_name_equal() fail?

A: Your test is working absolutely fine, and it's found a bug. Hurray!
Your two Car objects may have the same name, but why would that mean that they are the same car? Nothing in your code makes that so.
If you want that to be the case, implement __eq__ on the Car class:
def __eq__(self, other):
    """Return True if other is also a car and has the same name as
    this one."""

    return isinstance(other, Car) and self.name == other.name

Then that test should pass.

A: The whole question is reducible to "How Python compare objects" what is precisely defined in Section 5.9: Comparisons of official documentation.
Quoting from the official documentation (emphasis mine) to clarify on aspects you're asking of.

Most other objects of built-in types compare unequal unless they are
the same object; the choice whether one object is considered smaller
or larger than another one is made arbitrarily but consistently within
one execution of a program.

That's what's covered by test_instance_equal and what essentially is:
o1 = object()
o1 == o1  # will always be True

The operators <, >, ==, >=, <=, and != compare the values of two
objects. The objects need not have the same type. If both are numbers,
they are converted to a common type. Otherwise, objects of different
types always compare unequal, and are ordered consistently but
arbitrarily. You can control comparison behavior of objects of
non-built-in types by defining a cmp method or rich comparison
methods like gt, described in section Special method names.*

Quoting from special method names:

object.__lt__(self, other)
object.__le__(self, other)
object.__eq__(self, other)
object.__ne__(self, other)
object.__gt__(self, other)
object.__ge__(self, other)

New in version 2.1.
These are the so-called "rich comparison" methods, and are called for
comparison operators in preference to __cmp__() below. The
correspondence between operator symbols and method names is as
follows: (...) x==y calls x.__eq__(y), (...)

That's what test_diff_equal and test_name_equal shows. There isn't any __eq__ magic method defined, and therefore it falls back to the default implementation (they compare unequal unless they are the same object).
The question has nothing to do with unit testing a module.

A: Adding to what's been already said: For the example given, you'll need to directly compare the attributes of the objects, and not the objects themselves, for unittest.TestCase.assertEqual to work.
class CarTest(unittest.TestCase):

    def test_diff_equal(self):
        car1 = Car('Ford')
        car2 = Car('Hyundai')
        self.assertEqual(car1.name, car2.name)

    def test_name_equal(self):
        car1 = Car('Ford')
        car2 = Car('Ford')
        self.assertEqual(car1.name, car2.name)

    def test_instance_equal(self):
        car1 = Car('Ford')
        self.assertEqual(car1.name, car1.name)

This should now work (and fail) as expected.


text:
Q: How to use libxml2 with CMake? I am using CLion editor (with CMake) for my C project,
I've never used an external library though,
my question is how do I link an external lib (for ex. libxml2) to my project?
I've seen some questions similar to this but none worked for me.
My project is compiled on Windows, and I have libxml .dll, include, and .lib files(binaries for Windows).
Edit: My CMakeLists.txt file after the answer suggested:
cmake_minimum_required(VERSION 3.2)
project(time_table)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES
    course.c
    course.h
    day.h
    defines.h
    find_tables.c
    find_tables.h
    item.h
    parse_info.c
    parse_info.h
    table.c
    table.h
    time_table.c grades.c grades.h)

link_libraries(C:/Users/Gal/Desktop/time_table/libxml2-2.7.8.win32/lib)
add_executable(time_table ${SOURCE_FILES})
target_link_libraries(time_table libxml2)

and this is what I get:
"C:\Program Files (x86)\JetBrains\CLion 1.1.1\bin\cmake\bin\cmake.exe" --build C:\Users\Gal\.clion11\system\cmake\generated\2eda76ff\2eda76ff\Debug --target time_table -- -j 8
[ 14%] Linking C executable time_table.exe
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -llibxml2
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [time_table.exe] Error 1
CMakeFiles\time_table.dir\build.make:225: recipe for target 'time_table.exe' failed
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/time_table.dir/all' failed
mingw32-make.exe[2]: *** [CMakeFiles/time_table.dir/all] Error 2
CMakeFiles\Makefile2:78: recipe for target 'CMakeFiles/time_table.dir/rule' failed
mingw32-make.exe[1]: *** [CMakeFiles/time_table.dir/rule] Error 2

What is wrong?

A: There is a key work for libraries installed on your machine.  <lib_name>_INCLUDE_DIR and <lib_name>_LIBRARIES once you have done find_package. This works for me.
find_package(LibXml2 REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/<my_stuff> ${LIBXML2_INCLUDE_DIR})
add_executable(<my_exe> <my_source_files>)
target_link_libraries(<my_exe> ${LIBXML2_LIBRARIES})

---- Just a note for your curiosity ----
If you ever needed to build (1) a (static) library of your calculations, maybe reusable, and (2) an executable that uses that library and LIBXML2, do this.
find_package(LibXml2 REQUIRED)

# add a calculation library: file "lib<mycalc>.a"
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/<your header files folder> ${LIBXML2_INCLUDE_DIR})
add_library(<mycalc> STATIC ${CMAKE_CURRENT_SOURCE_DIR}/<your src files folder>)
target_link_libraries(<mycalc> ${LIBXML2_LIBRARIES})

# add the executable: file <my_exe>
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/<your header files folder> ${LIBXML2_INCLUDE_DIR})
add_executable(<my_exe> <your exe src files>)
target_link_libraries(<my_exe> <mycalc> ${LIBXML2_LIBRARIES})

A: Assume that full path to the library(.lib) can be expressed as
<library_dir>/<library_name>.lib

For compile executable, which uses this library, you need:
CMakeLists.txt:
link_libraries(<library_dir>)

add_excutable(<my_exe> ..)
target_link_libraries(<my_exe> <library_name>)

For use(run) compiled executable, you need to have <library_name>.dll either under one of the directory, listed in the PATH environment variable, or within same directory with executable.

A: there are 32bit and 64bit version of libxml2, to be found here.
you can put them below the PATH - or the C:\Windows directory.

A: With moderns CMake (version 3.2 or newer), it got much easier:

*

*Search for the library. CMake has an according find module, thus it boils down to
find_package(LibXml2 REQUIRED)

*Then you can link the library it to your target foo
target_link_libraries(foo PUBLIC LibXml2::LibXml2)

That's it folks! No fiddling around with headers and libraries, all done automatically.
If you have not installed the library, you might want to set LibXml2_DIR to the location where LibXml2 is located, i.e., by passing -DLibXml2_DIR=C:\software\libxml2 to your CMake call. That will help CMake finding LibXml2.


text:
Q: yii translation - words with multiple meaning I am using Yii's translation functionality to translate characters from English to other languages. I sometimes come across a word that has multiple meanings, so I have to make it unique somehow. Is there someway to do this in Yii?
Documentation online only seems to mention plurals, params and a bit about breaking translations into sections per view.
Thanks


text:
Q: mysql join two tables table a
id title
1   aaa
2   ccc

table b
id title categories
1   123     24
2   222     5
3   333     6

How to join table a and table b like this:
id title categories
1    aaa
2   ccc
1   123   24
2    222   5
3   333   6

Thanks a lot.

A: select id, title, null as categories from a
union all
select id, title, categories from b

A: You can use UNION ALL as:
SELECT id,title,'' AS categories FROM a
UNION ALL
SELECT id,title,categories FROM b

Since UNION ALL expects the two result sets to have same number of fields I've added field named categories in the first query whose values is always empty string.

A: You can use UNION to combine the data from the two tables such as:
Select id, title, "" as categories from tableA
UNION ALL
Select id, title, categories from tableB

In the first select query, empty string is provided as categories for column matching. UNION requires identical columns in both select queries. Also UNION ALL lists out the duplicates as well.


text:
Q: Non split extension isomorphic (as a group) to a split extension $\def\Z{\mathbb{Z}}$
Let $A$ be a finite abelian group and $G$ a finite group acting on $A$.
Then the extension $0 \to A \to E \to G \to 1$ is splits if and only if the corresponding $2$-cocycle is trivial in $H^2(G,A)$.
Does there exist such a split extension $E$ such that $E$ can also be seen as a non split extension (for the same action of $G$ on $A$)? Or in other words, can we find two groups $G$ and $A$, and an action of $G$ on $A$ such that there exists $\alpha_1,\alpha_2 \in H^2(G,A)$ which corresponds to the same group $E$, and with $\alpha_1=0$?
With help from user gro-tsen, I can say the following:

*

*In the answer here:
https://math.stackexchange.com/questions/131881/group-extensions/131895#131895
one can find two extensions of $G=(\Z/p\Z)^2$ by $A=(\Z/p\Z)^2$, isomorphic as groups, and one splits and the other not. Unfortunately the action by $G$ on $A$ is different, so this does not quite answer my question.

*In the answer here: Extensions isomorphic as groups but not congruent or pseudo-congruent one can find that there exist non pseudo congruent extensions (but isomorphic as groups), even for the trivial action, even for an abelian extension $E$. But in this example none of the two extensions split.

*In fact if $E$ is abelian, it can't be both a split and a non split extension of $G$ by $A$. This is a special case of
Can a module be an extension in two really different ways?


text:
Q: Can you implement Vue Unit tests without a component using purely the Vue Instance? I briefly looked at the documentation on Vue Unit Testing
It said:

Anything compatible with a module-based build system will work

The documentation describes ways to test components
In my case I am not using a component.
I am adding the vue.js to the page and I create a new Vue Instance.
new Vue({
  el: '#app',
  data: {
    ....
  }
});

A: Yes, you can. Here is a simple example with QUnit where we test a "Hello, World!" message:

QUnit.test('"Hello, World!" is displayed', function (assert) {
  assert.equal(vm.$data.message, 'Hello, World!');
  assert.equal(document.querySelector('h1').textContent, 'Hello, World!');
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/qunit/2.4.0/qunit.min.css" rel="stylesheet">

{{ message }}