text:
Q: Select options dropdown validation inside form We are trying add to validation for Select options inside form,  its working fine for 1st dropdown field, but validation not working for 2nd dropdown & 3rd multi select checkbox fields.
means when we click on submit button ,  form is submitting and values are saving in database without caring about 2nd and 3rd fields.

php
<form method="post" enctype='multipart/form-data' action="update.php" id="" onsubmit="return validate(); ">

        Designer :
          <select onchange="getOrderDetail(event);" name="designer_id" id="designer_id" required>
            <option value="">Select Designer</option>
                  <?php
                       while($data = $stmt->fetch())
                        {
                           if($data['type']=="admin")continue;
                  ?>
            <option value="<?php echo $data['userID'];?>">
                  <?php
                     echo $data['name'];
                  ?>
            </option>
                  <?php } ?>
          </select>

      Order :

          <select name="designerorder_id" id="designerorder_id" required>
            <option>Select Order</option>
          </select>

      Product

          <select id="mySelect" >
            <option>Select Products</option>
          </select>

script
function validate()
{

 var error="";

 var designer_id = document.getElementById( "designer_id" );
 if( designer_id.value == "" )
 {
  error = " Please Select Designer";
  document.getElementById( "error_para1" ).innerHTML = error;
  return false;
 }

 var error="";
 var designerorder_id = document.getElementById( "designerorder_id" );
 if( designerorder_id.value == "" )
 {
  error = " Please Select Order";
  document.getElementById( "error_para2" ).innerHTML = error;
  return false;
 }

 var error="";
 var dproduct_id = document.getElementById( "dproduct_id" );

 if( dproduct_id.value == "" )
 {
  error = " Please Select Product";
  document.getElementById( "error_para3" ).innerHTML = error;
  return false;
 }

}

function getOrderDetail(e)
  {
    var designerId=e.target.options[e.target.selectedIndex].value;
    var url="http://sbdev2.kidsdial.com:81/php/site6/designerpaidstatus.php?designer_id="+designerId+"&opration=2";
       var request = jQuery.ajax( {
                url: url ,
                type: 'POST',
            } );

            request.done( function (result)
            {
              document.getElementById('ordernumbers').innerHTML =result;

            } );
            request.fail( function ( error )
            {
                console.dir(error);
            } );
     }
  function getProductDetail(e)
  {
    var productId = $("#dproductselect option:selected").attr("class");
    var finalstrig=productId.split(",");

    var select='';
    select+='<select class="test" multiple="multiple" name="dproduct_ids" id="dproduct_ids">';

    for(i=0;i<finalstrig.length;i++)
    {
      if(finalstrig[i]!=0)
      {
        select +='<option value="'+finalstrig[i]+'">'+finalstrig[i]+'</option>';
      }
    }
    select +='</select>';
    document.getElementById('productnumbers').innerHTML =select;
    (function($) {
    $(function() {
        $('.test').fSelect();
    });
})(jQuery);

  }

$(function(){
  $("#button_reset").click(function() {
    $("#productnumbers").html('<select id="mySelect"><option>Select Products</option></select>');
  });
});

Edit - Designerpaidstatus.php
$htmltext='';
    $htmltext="<select id='dproductselect' name='designerorder_id' onchange='getProductDetail(this.value)'><option value=''>Select Order</option>";
    foreach ($order as $orderData)
    {
        $orderitems=$orderData['dproduct_id'];

            $finalValue=$orderData->getIncrementId()."-".$orderitemsarray[$k];
            $htmltext=$htmltext.'<option class="'.$orderitems.'" name="'.$orderitems.'" value="'.$orderData->getIncrementId().'">'. $orderData->getIncrementId().'</option>';
    }
    $htmltext=$htmltext."</select>";
    echo $htmltext;exit;

A:

function validate()
{

 var error="";
alert("Test");
 var designer_id = document.getElementById( "designer_id" );
 if( designer_id.value == "" )
 {

  error = " Please Select Designer";
  document.getElementById( "error_para1" ).innerHTML = error;
  return false;
 }

 var error="";
 var designerorder_id = document.getElementById( "designerorder_id" );
 if( designerorder_id.value == "" )
 {
  error = " Please Select Order";
  document.getElementById( "error_para2" ).innerHTML = error;
  return false;
 }

 var error="";
 var dproduct_id = document.getElementById( "dproduct_id" );

 if( dproduct_id.value == "" )
 {
  error = " Please Select Product";
  document.getElementById( "error_para3" ).innerHTML = error;
  return false;
 }

}

<form method="post" enctype='multipart/form-data' action="update.php" id="" onsubmit="return validate(); ">

        Designer :
          <select onchange="getOrderDetail(event);" name="designer_id" id="designer_id" required>
            <option value="">Select Designer</option>

          </select>

      Order :

          <select name="designerorder_id" id="designerorder_id" required>
            <option>Select Order</option>
          </select>

      Product

          <select id="mySelect" >
            <option>Select Products</option>
          </select>

Test

<button type="submit" onclick="validate" >Submit</button>
</form>

For the first select you have explicitly set the option value to empty string

function validate()
{

 var error="";

 var designer_id = document.getElementById( "designer_id" );
 if( designer_id.value == "" )
 {
  error = " Please Select Designer";
  document.getElementById( "error_para1" ).innerHTML = error;
  return false;
 }

 var error="";
 var designerorder_id = document.getElementById( "designerorder_id" );
 if( designerorder_id.value == "" )
 {
  error = " Please Select Order";
  document.getElementById( "error_para2" ).innerHTML = error;
  return false;
 }

 var error="";
 var dproduct_id = document.getElementById( "dproduct_id" );

 if( dproduct_id.value == "" )
 {
  error = " Please Select Product";
  document.getElementById( "error_para3" ).innerHTML = error;
  return false;
 }

  alert("All Good");

}
<form >

        Designer :
          <select  name="designer_id" id="designer_id" required>
            <option value="">Select Designer</option>
                 <option value="1">1</option>
          </select>

      Order :

          <select name="designerorder_id" id="designerorder_id" required>
            <option value="">Select Order</option>
             <option value="1">1</option>
          </select>

      Product

          <select id="dproduct_id" >
            <option value="">Select Products</option>
             <option value="1">1</option>
          </select>

  <button type="submit" onclick="return validate(); ">Submit</button>

T

  </form>

whereas for the next ones you haven't done that.
So the below checks doesn't work
if( designerorder_id.value == "" )
if( dproduct_id.value == "" )

A: Hi use this code for multiple selectbox

function multiple1()
{
var options = $('#dproduct_ids > option:selected');
         if(options.length == 0){
             alert('no value selected');
             return false;
         }

  }

<select class="test" multiple="multiple" name="dproduct_ids" id="dproduct_ids" name="test[]">
  <option value="test1">test1</option>
  <option value="test2">test2</option>
  </select>
<input type="button" value="submit" onclick="multiple1()">


text:
Q: Qt 5.4/QML: How do I correctly implement a custom C++ class as a global QML singleton instance and implement code for its signals (in QML)? I have a little C++ class that I want to register with QML so I can access it from QML code and provide a safe API for the QML developer - while keeping the complex stuff "under the hood" and hidden from the perspective of QML.
So far I have written my custom class like this:

main.cpp
static QObject *myapi_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
    Q_UNUSED(engine)
    Q_UNUSED(scriptEngine)
    MyApi *apiInstance = new MyApi();
    return apiInstance;
}

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    qmlRegisterSingletonType<MyApi>("com.example.myapi", 1, 0, "MyApi", myapi_singletontype_provider);

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("http://server.com/myqml.qml")));
    return app.exec();
}

MyApi.h
#ifndef MyApi_H
#define MyApi_H

#include <QObject>
#include <QtNetwork>
#include <QtCore/QDebug>
#include <QtCore/QObjectList>

class MyApi : public QObject
{
    Q_OBJECT

public:
    explicit MyApi(QObject *parent = 0);
    ~MyApi();

signals:
    void downloadStarted(const QString &uuid);
    void downloadFinished(const QString &uuid);
    void downloadError(const QString &uuid, const QString &errorText);
    void downloadProgress(const QString &uuid, const float progress);

public slots:
    void downloadArchiveInBackground(const QString &uuid);

};

#endif // MyApi_H

MyApi.cpp
#include "MyApi.h"

void MyApi::downloadArchiveInBackground(const QString &uuid) {
    // I would like to connect these signals to JS methods in QML!
    emit downloadStarted(uuid);
    emit downloadProgress(uuid, 0.3);
}

QML (pseudo)
MyApi {
    id: myapi
    onDownloadStarted: {
        console.log("OK STARTED")
        dialogDownload.open()
    }
}

Actually I have no idea how to implement this. I'm aware that I'm creating an instance here, and with Singletons that's not required since it's a singleton instance - but I need some pointers on how to implement the signal handlers in QML that I emit from C++.

A: You can use Connection QML type.
import com.example.myapi 1.0

Connections {
    target: MyApi
    onDownloadFinished: //do something
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I launch Ubuntu after installation I am done with the installation  of Ubuntu. If I turn my chromebook on I see the white screen with the red exclamation point. Then it goes to black terminal screen and prompts me to log in. I do that and it tells me the last time I logged in. The next line reads "user@chrubuntu:" I type CTRL + L to launch the program but it doesn't  do anything.  I am stumped as to what I should next. I want to get out of this terminal  and start using Ubuntu. ( version 15.04)

A: After you have logged in in the terminal type:
sudo systemctl start graphical.target

and press Enter to bring up your default login screen and then login to your Ubuntu desktop environment as usual.
If you can't login to your desktop environment because of a kernel or driver issue, then you could try installing Crouton on your Chromebook instead of Chrubuntu. Crouton runs on top of Chrome OS and at the same time as Chrome OS. Therefore, it uses the kernel provided by Chrome OS, all the drivers from Chrome OS, and everything else that is provided by Chrome OS.
The other alternative is to stay with Chrubuntu and always start the login display manager from the terminal by running sudo systemctl start graphical.target if that works.


text:
Q: No room on ep ring? I just switched to tty1, and I'm getting all kinds of output. It all looks like this:
[timestamp] xhci_hcd 0000:00:14.0: ERROR no room on ep ring

It's happening over 100 times per second, every 5 seconds or so, on every tty. Other similar questions say it's happening because of external drives, but the only drive I have mounted is /dev/sda1 (root), as well as a swap partition on /dev/sda5
EDIT: Here's mount as root:
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=1008641,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=808160k,mode=755)
/dev/disk/by-uuid/eb5e28f7-395f-4556-aff4-8c8910a6295c on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=4924640k)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
gvfs-fuse-daemon on /home/lucas/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
truecrypt on /tmp/.truecrypt_aux_mnt1 type fuse.truecrypt (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
/dev/mapper/truecrypt1 on /media/truecrypt1 type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)

(Note that this issue started before the truecrypt volume was mounted)
My dmseg has been completely bloated out, nothing but this message.
After rebooting, my dmesg is back to normal. It's way too long to post here, so here's a pastebin link:
dmesg

A: I want my tty
The messages are most likely trying to tell you something. If you're only trying to use the tty1 terminal without all messaging you can temporarily turn it down:
$ dmesg -n #

Where the # is a number such as 1,2,3,...
excerpt from dmesg man page
-n level
          Set the level at which logging of messages is done to the
          console.  For example, -n 1 prevents all messages, except
          panic messages, from appearing on the console.  All levels of
          messages are still written to /proc/kmsg, so syslogd(8) can
          still be used to control exactly where kernel messages appear.
          When the -n option is used, dmesg will not print or clear the
          kernel ring buffer.

Debugging the message
If you're attempting to determine what the source of the messages is then we'lll need more information such as the output form the mount command and also look in the output of the dmesg command for this identical message and provide any lines before and after that seem relevant.
Known issue with USB 3.0 devices?
I found this thread over on Ask Ubuntu titled: ERROR no room on ep ring with USB 3.0 device which sounds like you're issue. Looks to already have a bug opened titled, "ERROR no room on ep ring" fills up syslog and hard disk in minutes, but doesn't appear to have been resolved or even assigned at this point.


text:
Q: CMAKE libintl-8.dll is missing from your computer I've been looking for solutions, and honestly I'm stuck.

I'm trying to install Box2D, as you can see by the file paths.
Anyway, this prompt appears several times before the following:

The CXX compiler identification is unknown
Check for working CXX compiler: C:/MinGW/bin/g++.exe
Check for working CXX compiler: C:/MinGW/bin/g++.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/CMakeTestCXXCompiler.cmake:54 (message):
  The C++ compiler "C:/MinGW/bin/g++.exe" is not able to compile a simple
  test program.

  It fails with the following output:

   Change Dir: C:/Users/alexm/Documents/Box2D/Build/CMakeFiles/CMakeTmp

  Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_31089/fast"

  C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_31089.dir\build.make
  CMakeFiles/cmTC_31089.dir/build

  mingw32-make.exe[1]: Entering directory
  'C:/Users/alexm/Documents/Box2D/Build/CMakeFiles/CMakeTmp'

  Building CXX object CMakeFiles/cmTC_31089.dir/testCXXCompiler.cxx.obj

  C:\MinGW\bin\g++.exe -o CMakeFiles\cmTC_31089.dir\testCXXCompiler.cxx.obj
  -c
  C:\Users\alexm\Documents\Box2D\Build\CMakeFiles\CMakeTmp\testCXXCompiler.cxx

  CMakeFiles\cmTC_31089.dir\build.make:64: recipe for target
  'CMakeFiles/cmTC_31089.dir/testCXXCompiler.cxx.obj' failed

  mingw32-make.exe[1]: ***
  [CMakeFiles/cmTC_31089.dir/testCXXCompiler.cxx.obj] Error 1

  mingw32-make.exe[1]: Leaving directory
  'C:/Users/alexm/Documents/Box2D/Build/CMakeFiles/CMakeTmp'

  Makefile:125: recipe for target 'cmTC_31089/fast' failed

  mingw32-make.exe: *** [cmTC_31089/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)

Configuring incomplete, errors occurred!
See also "C:/Users/alexm/Documents/Box2D/Build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/alexm/Documents/Box2D/Build/CMakeFiles/CMakeError.log".

So, there's the error. I'm trying to install it on code::blocks with MinGW, I've currently got 2 copies of MinGW installed, one that's located in the code::blocks folder and the other is in my root drive, I installed MinGW seperately to fix this problem.
This is my first time using CMake, I'm trying to get it to work with my sfml project on code::blocks in C++.
Apologies if I missed anything, if you spot any information you'd need don't hesitate to comment!

A: Go to system variables and add

C:\Program Files (x86)\CodeBlocks\MinGW\bin

to your path

A: You download libintl-8.dll and copy to C:\MinGW\bin:
https://www.dll-files.com/libintl-8.dll.html
It worked for me.

A: You should run Cmake as admin. I had the same problem, worked for me

A: I had the same problem and I tried every solution proposed below and did not work for me then I realized that CMake uses C:\Program Files (x86)\CodeBlocks\MinGW\mingw32\bin instead of C:\Program Files (x86)\CodeBlocks\MinGW\bin so I copied the "dll" files to that folder. If that does not work for you try adding C:\Program Files (x86)\CodeBlocks\MinGW\mingw32\bin to your path.

A: I had the same problem.
I was runing cmake with compability to win 7,
when I untick it, it started work.


text:
Q: Using Karate Robot DSL for Windows desktop apps written in Swing and Mac OS support
*

*For those that have used Karate robot for automating desktop applications in Windows written in Swing I'm curious to know what your experience was like? i.e. were the test runs reliable or flaky?

*What was the best spy object tool you used to help identify Swing components and feed that to Karate scripts?

*Also I see that https://github.com/intuit/karate/projects/3 MacOS support is in the backlog, is there any update on whether this update will support Swing apps on MacOS?
Appreciate your support, thanks.

A: Developer of Karate Robot here. Most known users are targeting Windows MFC / C++ / .NET or Delphi so there are no reports of Swing yet, but my guess is that it should work at least on Windows. "inspect.exe" works well to introspect the component tree. And we are looking for contributions for Mac, but there doesn't seem to be much interest - yet.
To summarize, I think your best bet is to contribute code to Karate, and you can make that decision based on your comfort with Java and your evaluation of how good Karate is in its current state and if it will "stay around", mature into a good desktop testing tool etc.


text:
Q: Is it possible to concatenate data from a row and a column together to display on the axis of a line graph? In Excel, if I have data entered in a matrix format with rows representing years and the columns representing quarters, is there a method to concatenate the row/column names together when selecting the axis label range of a line graph?
Data Entry
Graph
Select Axis Label
In regards to the image of the graph, I have just selected the cells containing Qtr 1, Qtr 2, Qtr 3, Qtr 4 over and over again to get the output.
The simple solution would be to just create a new column containing the desired data. However, the spreadsheet I'm working on has dozens of similar data entry points, which is why I'm looking to see if there is another solution.
Note: I don't seem to have enough reputation to embed images yet, so I can only link.

A: In the image below, I've shown part of your data table and a rearranged version of it.  With the rearranged table, the graph is made naturally using a scatter plot, at the right.

Notice that each quarter is shown by the minor gridlines. This may not be what you want, but it fits very well with how Excel does things.
Here's some code to convert your type of data table to the rearranged version. To run it, first select the data portion of your data table and then run the code. Let me know if you have questions.
Sub qtrTable()
Dim r As Range, qtr As Range, i As Integer, j As Integer
Set qtr = Selection
Set r = Application.InputBox("Select new table location", "Upper left", qtr(1, 1).Offset(0, 6).Address, , , , , Type:=8)
For i = 1 To qtr.Rows.Count
  For j = 0 To 3
    r.Offset(j, 0) = qtr(i, 1) + j * 0.25
    r.Offset(j, 1) = qtr(i, j + 2)
  Next j
  Set r = r.Offset(4, 0)
Next i
End Sub


text:
Q: Javaassists and Java Web Start: class sign doesn't match the others classes sign is the same package i'm using javaassists to modify the behaviour of a class in runtime. When i run the app in my computer all works fine.
But this app is launched by the users with Java Web Start, so that the .jar of the app must be signed. When the class is modified in runtime time by javaassists and loaded with the
CtClass.toClass()

method a SecurityException is launched:
java.lang.SecurityException: class "com.sch.coberturas.db.CobDao"'s signer information does not match signer information of other classes in the same package

I can avoid it by isolating the modified class in a single class package, but this is a weird solution. Is there another workarround?

A: Like OP requested I'm creating an answer regarding my comment.
When you are using a SecurityManager you must always provide the protected domain in use. With this information javassist will be able to be generate classes with the same signing information.
This means that instead of using CtClass.toClass() you should use ClassPool.toClass(CtClass ct, java.lang.ClassLoader loader, java.security.ProtectionDomain domain).
More information about this method in javassist javadoc

A: I'd just like to add, that if the class you're changing has more classes on the package it belongs it may throw a signer's information exception also.
I fixed it by loading them and adding them in the same spot I changed my class.
Example:
ClassPool pool = ClassPool.getDefault();
pool.insertClassPath( new ClassClassPath( this.getClass() ));
ClassLoader loader = this.getClass().getClassLoader();
ProtectionDomain domain = this.getClass().getProtectionDomain();
CtClass class = pool.get("package1.myChangingClass");
// Here goes the code to change the class;
pool.toClass( class, loader, domain );
//
// Now insert code to pre-load other classes with same domain
CtClass otherClass1 = pool.get("package1.someOtherClass1"); // Gets
pool.toClass( otherClass1, loader, domain );                // Preloads
...
CtClass otherClassN = pool.get("package1.someOtherClassN");
pool.toClass( otherClassN, loader, domain );
//
// To be done for all other classes of the same package that throws
// the signer's information exception, after package1.myChangingClass
// is modified and built.

Kind regards.


text:
Q: Writing tests for two methods that share functionality I'm writing some tests for a NodeJS module, but this question can apply for any language / platform. I've got the following situation:
// in moduleA.js

exports.foo = function (var1, var2) {
    // do something to var1 and var2 here

    baz(var1, var2);
};

exports.bar = function (var1, var2) {
    // do something completely different to var1 and var2 here

    baz(var1, var2);
};

function baz(var1, var2) {
    // do something to var1 and var2 yet again that both foo and bar need

    moduleB.doSomething(var1, var2);
}

So, both foo and bar are public methods of moduleA. They've got some specific functionality (they do different things to var1 and var2) but also some shared functionality (to keep things DRY I've moved it into a private method, baz) and then they both call a public method on moduleB.
I've stubbed out moduleB so I know exactly what's going on after foo and bar have been called. I'm writing tests for foo and bar's specific functionality but I'm not 100% sure how to approach testing the shared functionality in baz.
It seems to me I've got three options:

*

*write identical tests for both foo and bar that test for the things in baz

*write a single test for foo and not write the same test for bar since know that baz works

*expose baz as another public method for the module and test it separately.

I'm leaning towards the first option, but I feel I might be missing something.

A: The key its to think in test for feature/behavior not in test for methods.
Its difficult without real names, but, "foo" exists to offer some behavior, the same with "bar", you simply need tests to check that the behavior of foo is correct and other to verify the behavior of "bar", when you discover that this two methods shared some internal functionality and decide to make a refactor your test remain the same, and thanks to that you can be sure that your refactor don't break any functionality.
I know that its probably generic advice, but its really difficult without a concrete example.

A: Unit tests shouldn't care about implementation details. Unit tests need to check that the the function returns the expected result, causes the expected side effects(and, if possible, not causing any other side effects), and throws the expected exceptions. How the functions does it should not concern the unit tests, just like it shouldn't concern the user of the module.
You don't need to unit-test baz(unless it's a module internal unit test) because it's not part of the module's API. That means that you should be able to remove it, rename it, or change it's functionality as long as the module's public functions still work, and neither the user code that uses the module nor the unit tests should change.
With this approach, it's easy to see that you should choose the first option - write unit tests for both foo and bar. The unit tests shouldn't care about baz, since you should be able to refactor it out of foo and/or bar, or to create a new version of it - baz2 - which bar will use while foo keep using original baz, or change some execution path of baz that neither foo nor bar should ever invoke. Those chances do not affect the module user, so they should not affect the unit test either.
If baz has some side-effects that foo activates, as far the the module user and the unit tests care those are side-effects of foo, so you should test them accordingly.

A: The test for moduleB.doSomething() doesn't belong into this test at all, except incidentally. It should be in the test for module B.
If baz were private to its module, and whatever it does is part of the public contract for several routines that use it, then its effects would have to be tested. As it is, the most you should do is query your B mock object whether baz was called, not whether it did its job.


text:
Q: Obj-c method override/polymorphism problem Ok, so I'm using Objective-C.  Now, say I have:
TopClass : NSObject
- (int) getVal {return 1;}
MidClass : TopClass
- (int) getVal {return 2;}
BotClass : MidClass
- (int) getVal {return 3;}

I then put objects of each type into an NSMutableArray and take one out.  What I want to do is run the getVal func on the appropriate object type, but when I put
id a = [allObjects objectAtIndex:0];
if ([a isKindOfClass:[TopClass class]])
{
    int i;
    i = [a getVal];
}

I get firstly a warning about multiple methods called getVal (presumably because the compiler can't determine the actual object type until runtime).  But more seriously I also get an error "void value not ignored as it should be" and it won't compile.
If I don't try and use the return from [a getVal] then it compiles fine e.g.
[a getval];  //obviously no good if I want to use the return value

It will also work if I use isMemberOfClass statements to cast the object to a class before running the function e.g.
if ([a isMemberOfClass:[BotClass]) i = [(BotClass*) a getVal];

But surely I shouldn't have to do this to get the functionality I require?  Otherwise I'll have to put in a statement for every single subclass, and worse have to add a new line if I add a new sub class, which rather defeats the point of method overriding doesn't it?
Surely there is a better way?

A: Since a BotClass is a MidClass and a MidClass is a TopClass, you could just set the type of a to TopClass*.
TopClass* a = [allObjects objectAtIndex:0];
if ([a isKindOfClass:[TopClass class]]) {
    int i;
    i = [a getVal];
}

The better way is to add -getVal to the @interface and #import it. Then the compiler will know such this method is likely to return an int and won't complain even if a is an id. Make sure the method name won't coincide with others, though.
(BTW, in ObjC, getters won't be named as -getFoo. The convention is just call it -foo.)

A: Your code compiles without any warning:
#import <Foundation/Foundation.h>

@interface TopClass : NSObject
{
}

- (int) getVal;

@end

@interface MidClass : TopClass
{
}

- (int) getVal;

@end

@interface BotClass : MidClass
{
}

- (int) getVal;

@end

@implementation TopClass

- (int) getVal {
    return 1;
}

@end

@implementation MidClass

- (int) getVal
{
    return 2;
}

@end

@implementation BotClass

- (int) getVal
{
    return 3;
}

@end

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    NSMutableArray *array = [NSMutableArray array];

    [array addObject:[[[TopClass alloc]init]autorelease]];
    [array addObject:[[[MidClass alloc]init]autorelease]];
    [array addObject:[[[BotClass alloc]init]autorelease]];

    for (int objectNumber = 0; objectNumber < [array count]; objectNumber++) {
        id a = [array objectAtIndex:objectNumber];
        if ([a isKindOfClass:[TopClass class]])
        {
            int i = [a getVal];
            NSLog(@"%d",i);
        }
    }

    [pool drain];
    return 0;
}

The test "isKindOfClass" is always true in this case, as MidClass and BotClass inherit from TopClass.
Are you sure the compiler knows about the method signatures that you call?


text:
Q: Hamiltonian cycle that contains a specified edge in a 3-connected cubic bipartite planar Hamiltonian graph Assume that we have a 3-connected cubic bipartite planar graph with a Hamiltonian cycle. That graph must have at least 4 Hamiltonian cycles, because of Theorem 1 and Theorem 10 of this paper.
I would like to know whether every edge of that graph is contained in at least one Hamiltonian cycle. It seems true for small 3-connected cubic bipartite planar graphs.

A: According to Theorem 2.5 (on page 71) of Mathematical Combinatorics, Vol. 3/2014: international book series, what I'm asking for is true if and only if Barnette's conjecture holds true.


text:
Q: How to remove a folder recursively in PowerShell Core 6? Since PowerShell 6 supports aliases from unix I tried running
rm -rf node_modules

to force remove the node_modules folder and all its subdirectories.
However, I get
Remove-Item : A parameter cannot be found that matches parameter name 'rf'.
At line:1 char:4
+ rm -rf node_modules
+    ~~~
+ CategoryInfo          : InvalidArgument: (:) [Remove-Item], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

So how can I correctly specify the parameters?


text:
Q: 'Null check operator used on a null value' while creating Interstitial Ads I'm trying to add an interstitial ads, but got 'Null check operator used on a null value' error.
Error
E/flutter (21082): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Null check operator used on a null value
Code problem
onTap: () async {
                    isInterstitialVideoAvailable =
                        (await FlutterApplovinMax.isInterstitialLoaded(
                            listener!))!;

                    if (isInterstitialVideoAvailable) {
                      FlutterApplovinMax.showInterstitialVideo(
                          (AppLovinAdListener? event) => listener!(event));
                    }

Main code involved
class CollectionCard extends StatefulWidget {
  const CollectionCard();

  @override
  State<CollectionCard> createState() => _CollectionCardState();
}

class _CollectionCardState extends State<CollectionCard> {
  AppLovinListener? get listener => null;

  // AppLovinListener get listener => null;

  void initState() {
    super.initState();
    FlutterApplovinMax.initInterstitialAd('91b26a5859e1b480');
  }

  bool isInterstitialVideoAvailable = false;

  @override
  Widget build(BuildContext context) {
    var size = MediaQuery.of(context).size;

    /*24 is for notifications bar on Android */
    final double itemHeight = (size.height - kToolbarHeight - 28) / 2;
    final double itemWidth = size.width / 4;

    // var len = listener?.length ?? 0;

    return Container(
        child: Padding(
      padding: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 10.0),
      child: Column(
        children: <Widget>[
          GridView.count(
            primary: true,
            padding: const EdgeInsets.fromLTRB(20, 0, 20, 20),
            crossAxisSpacing: 10, //Reduce Horizontal Spacing
            mainAxisSpacing: 10, //Reduce Vertical Spacing
            crossAxisCount: 3,
            physics: ScrollPhysics(),
            childAspectRatio: (6 / 8),
            // (itemWidth / itemHeight),
            shrinkWrap: true,
            children: <Widget>[
              Card(
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(15.0),
                ),
                elevation: 2,
                color: Theme.of(context).scaffoldBackgroundColor,
                child: InkWell(
                   onTap: () async {
                    isInterstitialVideoAvailable =
                        (await FlutterApplovinMax.isInterstitialLoaded(
                            listener!))!;

                    if (isInterstitialVideoAvailable) {
                      FlutterApplovinMax.showInterstitialVideo(
                          (AppLovinAdListener? event) => listener!(event));
                    }

                    Navigator.push(
                      context,
                      MaterialPageRoute(
                        builder: (ctx) => LearnPage(),
                      ),
                    );
                  },
                  child: Center(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.spaceAround,
                      children: [
                        ImageIcon(
                          AssetImage('assets/icons/learn.png'),
                          color: kLightPrimary,
                          size: 60,
                        ), // Icon(
                        //   layout.icon,
                        //   size: 40,
                        // ),
                        Text(
                          'Learn',
                          style: TextStyle(
                            fontSize: 14,
                            fontWeight: FontWeight.bold,
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
              ),

Can anyone provide a solution for this?

A: You have to init a Interstitial Ads before use it,
Example:
Init Ads on initState()
InterstitialAd? _interstitialAd;
int _countMaxAdFailedToLoad = 3;
int _countAdInitialToLoad = 0;

@override
void initState() {
  super.initState();
  _createAds();
}

void _createAds(){
  InterstitialAd.load(
    adUnitId: Platform.isAndroid
      ? 'ca-app-pub-3940256099942544/1033173712'
      : 'ca-app-pub-3940256099942544/4411468910',
    request: AdRequest(),
    adLoadCallback: InterstitialAdLoadCallback(
      onAdLoaded: (InterstitialAd ad) {
        _interstitialAd = ad;
        _countAdInitialToLoad = 0;
      },
      onAdFailedToLoad: (LoadAdError error) {
        print('InterstitialAd failed to load: $error');
        _countAdInitialToLoad += 1;
        _interstitialAd = null;
        if (_countAdInitialToLoad >= _countMaxAdFailedToLoad) {
          _createInterstitialAds();
        }
      },
    ),
  );
}

And you can show this ads.
onTap: (){
if (_interstitialAd != null) {
   _interstitialAd?.fullScreenContentCallback =
       FullScreenContentCallback(
         onAdDismissedFullScreenContent: (InterstitialAd ad) {
           print('$ad onAdDismissedFullScreenContent.');
           ad.dispose();
           _createAds();
        },
         onAdFailedToShowFullScreenContent:
           (InterstitialAd ad, AdError error) {
           print('$ad onAdFailedToShowFullScreenContent: $error');
           ad.dispose();
           _createAds();
              });
     _interstitialAd?.show();
  }
}


text:
Q: Convergence of Types Theorem
(Convergence of Types Theorem) Suppose that $F_n(u_nx+v_n) \Rightarrow F(x)$ and $F_n(a_nx+b_n) \Rightarrow G(x)$, where $u_n>0, a_n>0$ and $F$ an $G$ are non-degenerate. Then there exist $a>0$ an $b \in\mathbb R$ such that $a_n/u_n \to a$ and $(b_n-v_n)/u_n \to b$, and $F(ax+b) = G(x).$

In Billingsley's textbook, he proves the above theorem using the following lemmas.

*

*If $F_n \Rightarrow F$, $a_n \to a$ and $b_n \to b$, then $F_n(a_nx +b_n) \Rightarrow F(ax+b)$.

*If $F_n \Rightarrow F$ and $a_n \to \infty$, then $F_n(a_nx) \Rightarrow \Delta(x)$, where $\Delta(x)$ is the degenerate distribution at $x$.

*If $F_n \Rightarrow F$ and $b_n$ is unbounded, then $F_n(x+b_n)$ cannot converge weakly.

*If $F_n(x) \Rightarrow F(x)$ and $F_n(a_nx+b_n) \Rightarrow G(x)$, where $F$ and $G$ are non-degenerate, then $$ 0<\inf_n a_n \leq \sup_n a_n < \infty;\; \sup_n |b_n| < \infty .$$

I have difficulty in understanding the proof of the forth lemma (highlighted parts). The argument in the book is as follows. Suppose that $a_n$ is not bounded above. Arrange by passing to a sub-sequence that $a_n \to \infty$. Then by lemma 2,
$$F_n(a_nx) \Rightarrow \Delta(x).(*)$$
Then since
$$F_n\left[a_n \left(x+\frac{b_n}{a_n}\right)\right] = F_n(a_nx+b_n)\Rightarrow G(x),(**)$$
it follows by lemma 3 that $\frac{b_n}{a_n}$ is bounded. [Note that in lemma 3, we did not have $a_n$ in front of $(x+b_n)$. But we do now. My question is how to use lemma 3 to get the desired boundedness of $b_n/a_n$, please?] By passing to a further sub-sequence, arrange that $b_n/a_n$ converges to some $c$. By $(*)$ and lemma 1,$F_n\left[a_n \left(x+\frac{b_n}{a_n}\right)\right] \Rightarrow \Delta(x+c)$ along this sub-sequence. But $(**)$ now implies that $G$ is degenerate, contrary to hypothesis. Thus $a_n$ is bounded above. If $G_n(x) = F_n(a_nx+b_n)$, then $G_n(x) \Rightarrow G(x)$ and $G_n(a_n^{-1}x - a_n^{-1}b_n) = F_n(x) \Rightarrow F(x)$. The result just proved shows that $a_n^{-1}$ is bounded. Thus $a_n$ is bounded away from $0$ and $\infty$. My question here is how to know $a_n$ is positive, please? How come $a_n$ cannot be negative? Thank you!

A: It seems that Lemma 3 is applied with $\widetilde{F_n}(t):=F_n(a_nt)$ instead of $F_n$ (which is allowed by Lemma 2) and the sequence $(b_n/a_n)_{n\geqslant 1}$ instead of $(b_n)_{n\geqslant 1}$.

A: This is an old question but I think it is worth while to have a rather detail solution in MSE.
For each $n$, let $X_n$ be a random variable with distribution $F_n(u_nx+b)$. Then $Y_n=\frac{u_n}{a_n}X_n+\frac{v_n-b_n}{a_m}$ has distribution $F_n(a_nx+b_n)$:
$$\mathbb{P}\big[\frac{u_n}{a_n}X_n+\frac{v_b-b_n}{a_n}\leq x\big]=\mathbb{P}\big[X_n\leq \frac{a_n}{u_n}x+\frac{b_n-v_n}{u_n}\big]=F[a_nx+b_n]
$$
By assumption $X_n\Longrightarrow X$ and $Y_n\Longrightarrow Y$ where
$\mathbb{P}[X\leq x]=F(x)$ and $\mathbb{P}[Y\leq y]=G(y)$ are bot non-degenerate (i.e., neither $X$ nor $Y$ are constants). The problem in the OP reduces to show that:

If $X_n\Longrightarrow X$, and for numeric sequences $\alpha_n>0$, $\beta_n\in\mathbb{R}$, $Y_n:=\alpha_nX_n+\beta_n\Rightarrow Y$, where $X$ and $Y$ are non-degenerate random variables, then there are $\alpha>0$ and $\beta\in\mathbb{R}$ such that $\alpha_n\xrightarrow{n\rightarrow\infty}\alpha$ and $\beta_n\xrightarrow{n\rightarrow\infty}\beta$. As a consequence, $Y=\alpha X+\beta$ in law.

Following Breiman, L. Probability, Addison-Wesley Publishing Company, 1968, the proof presented here  is based on characteristic functions. Denote by $\widehat{F_n}$ the characteristic function of $X_n$, and by $\widehat{G_n}$ the characteristic function of $Y_n$. Similarly, let $\widehat{F}$ and $\widehat{G}$ be the characteristic functions of $X$ and $Y$ respectively. Then
$$ \widehat{G_n}(t)=\int_{\mathbb{R}}e^{-itx}\,G_n(dx)=\int_{\mathbb{R}}e^{it(\alpha_n x+\beta_n)}\,F_n(dx)=e^{-it\beta_n}\int_{\mathbb{R}}e^{-it\alpha_nx}\,F_n(dx)=e^{-it\beta_n}\widehat{F_n}(\alpha_nt)$$
The assumptions imply that

*

*$\widehat{F_n}(t)\xrightarrow{n\rightarrow\infty}\widehat{F}(t)$ uniformly in compact sets in $\mathbb{R}$,

*$e^{-it\beta_n}\widehat{F_n}(\alpha_nt)=\widehat{G_n}(t)\xrightarrow{n\rightarrow\infty}G(t)$ uniformly in compact sets in $\mathbb{R}$.

Suppose $a\in[0,\infty]$ is a sub sequential limit of $\alpha_n$, i.e., for some subsequence $\alpha_{n_k}\xrightarrow{k\rightarrow\infty}a$.
Claim I: $0<a<\infty$. Suppose $a=\infty$. Then, from $|\widehat{F_n}(\alpha_n x)|=|\widehat{G_n}(t)|$ it follows that for any $t$
$$|\widehat{F}(t)|=\lim_k|\widehat{F_{n_k}}(t)|=\lim_k|\widehat{G_{n_k}}\big(\tfrac{t}{a_{n_k}}\big)|=|G(0)|=1$$
where in the last part we have used the fact that the convergence of characteristic functions is uniform in compact sets. However $|F(t)|=1$ for all $t$ implies that $F$ is the characteristic function of a degenerate random variable, which is a contradiction to the assumption on $X$. Similarly, if $a=0$, then
$$|G(t)|=\lim_k|\widehat{G_{n_k}}(t)|=\lim_k|\widehat{F_{n_k}}(a_{n_k}t)|=|F(0)|=1$$
in which case, $Y$ is a degenerate random variable. This is a contradiction to the assumption on $Y$.
Claim II: $\alpha_n$ converges. Suppose $\alpha_n$ admits two different sub sequential limits $0<a'<a<\infty$. Then
$$ |\widehat{F}(a't)|=|\widehat{F}(at)|$$
for all $t$ since
\begin{align}
|\widehat{F}(a't)|&=\lim_{n'}|\widehat{F}(ta_{n'})|=\lim_{n'}|\widehat{G_{n'}}(t)|=|G(t)|\\
|\widehat{F}(at)|&=\lim_{n''}|\widehat{F}(ta_{n''})|=\lim_{n''}|\widehat{G_{n''}}(t)|=|G(t)|
\end{align}
Consequently
$$|\widehat{F}(t)|=\big|F\big(a\tfrac{t}{a}\big)\big|=\Big|\widehat{F}\big(\frac{a'}{a} t\big)\Big|=\ldots \Big|\widehat{F}\Big(\big(\tfrac{a'}{a}\big)^nt\Big)\Big|\xrightarrow{n\rightarrow\infty} |F(0)|=1$$
implying that $X$ is degenerate, a contradiction! As the set of sub sequential limits of a sequence in not empty in $[-\infty,\infty]$, $\alpha_n$ has a unique sequential limit in $(0,\infty)$; hence  $\alpha_n\xrightarrow{n\rightarrow\infty}\alpha$ for some $\alpha>0$.
Now we turn our attention to $\beta_n$. Notice that on a neighborhood $(-\delta,\delta)$ of $0$ where $\widehat{F}(at)\neq0$
$$ e^{it\beta_n}=\frac{\widehat{G_n}(t)}{\widehat{F_n}(\alpha_n t)}\xrightarrow{n\rightarrow\infty}\frac{\widehat{G}(t)}{\widehat{F}(\alpha t)}$$
Claim III: $\beta_n$ converges in $\mathbb{R}$. If $\beta_n$ admits a subsequential limit $|\beta_{n_k}|\xrightarrow{k\rightarrow\infty}\infty$, then for all $k$ large enough $|\beta^{-1}_{n_k}|<\delta$ and so
$$e^{-i}=\frac{\widehat{G_{n_k}}(\beta^{-1}_{n_k})}{\widehat{F_{n_k}}(\alpha_{n_k}\beta^{-1}_{n_k}t)}\xrightarrow{k\rightarrow\infty}\frac{\widehat{G}(0)}{\widehat{F}(0)}=1$$
which is absurd. Hence all sub sequential limits of $\beta_n$ are finite. If there were two different subsequential limits  $b$, $b'$ of $\beta_n$, then
$$e^{-ib't}=\frac{\widehat{G}(t)}{\widehat{F}(\alpha t)}=e^{-ibt},\qquad -\delta < t< \delta$$
Then $h(t)=\frac{t(b-b')}{2\pi}$ is a continuos map on $(-\delta,\delta)$ taking integer values. Hence $h$ is constant and $h(t)=h(0)=0$ for all $|t|<\delta$. This shows that $b=b'$. We conclude that $\beta_n\xrightarrow{n\rightarrow\infty}\beta$ for some $\beta\in\mathbb{R}$.
As $\widehat{G_n}(t)=e^{-it\beta_n}\widehat{F_n}(\alpha_nt)\xrightarrow{n\rightarrow\infty}e^{-i\beta t} \widehat{F}(\alpha t)$ uniformly in compacts in $\mathbb{R}$, we also conclude that $Y=\alpha X+\beta$ in distribution. $\Box$.

In the course of the proof we use the following result from analysis and Probability

*

*If $f_n:\mathbb{R}\rightarrow\mathbb{C}$ converges uniformly in compacts to $f$, then for any convergent real sequence $\lambda_n\xrightarrow{n\rightarrow\infty}\lambda$,  then
$f_n(\lambda_n t)\xrightarrow{n\rightarrow\infty}f(\lambda t)$ uniformly in compacts.

*If $X$ is a random variable with characteristic function $\widehat{F}$ and $|\widehat{F}(t)|=1$ for all $t$ in a neighborhood  of $0$, then $X$ is a degenerate random variable (i.e., for some $b\in\mathbb{R}$, $\mathbb{P}[X=b]=1$).


text:
Q: How to perform left join in django? i like to join two tables using left join operation.
this is what i like to do:
SELECT * FROM orders LEFT JOIN products ON (orders.product_id = products.id);

my model classes:
class Orders(models.Model):
    name = models.CharField(max_length=100, null=False, blank=False)
    qty = models.IntegerField(null=False, blank=False)
    product = models.ForeignKey(Products, on_delete=models.CASCADE)
    customer = models.ForeignKey(Customers, on_delete=models.CASCADE)

    class Meta:
        db_table = 'orders'

class Products(models.Model):
    name = models.CharField(max_length=100, null=False)
    qty = models.IntegerField(default=0, null=True)
    price = models.FloatField(null=True, default=0)
    description = models.CharField(max_length=500, null=True, default=None)

    class Meta:
        db_table = "products"

A: I don't see any point of JOINs in Django. If you really want model data equivalent to Left JOIN, you can use a list for that.
def leftJoin():
    lst = []
    lst += Orders.objects.all()
    for order in Order.objects.all():
        for product in Products.objects.all():
            if order.product_id == product.id:
                lst += product
    return lst

A: The beauty about an ORM is that you no longer think in "Rows and Columns" rather in "Objects and Properties"
Django will do the Joins for you if you structure your query correctly.
e.g.
If you want to retrieve rows for a related table in a single query, you can do the following:
orders = Orders.objects.all().select_related('product')

# This will do a join on the two tables and you can access the products from the orders without causing another DB request

for order in orders:
  print(order.id, order.product.id)

If you want to filter orders by a certain product you can do the below:
orders = Orders.objects.filter(product__name='Cool Product Name')

You can see this answer also:
https://stackoverflow.com/a/21272153/1184181


text:
Q: Get value from select statement in php if (isset($_POST['submitProf'])){
if (isset($_POST['address'])) {
    $address = $_POST['address'];

    if (!empty($address)) {
        $query = "SELECT `username` FROM `users` WHERE `username` = '$username'";
        $query_run = mysqli_query($connection,$query);

            if (mysqli_num_rows($query_run) == 1){
                $query_username = mysqli_fetch_field_direct($query_run,1);
                 $query = "INSERT INTO `users`(`Address`) VALUES ('".mysqli_real_escape_string($connection,$address)."') WHERE `username` = '$query_username'";
                    if ($query_run = mysqli_query($connection,$query)) {
                          echo "<script type='text/javascript'>alert('Updated')</script>";
                     }
            }
        }
    }
}

I have a submit button, when its pressed I want to update the address column in my database for the user who is logged in.
The first select statement is to check wether the user exists.
But how do I take his username in a variable so that I can specify in my INSERT INTO statement in the WHERE clause the correct user.
I tried it with fetch field direct but this doesn't work.
Thanks!

A: insert have not where clause  so should be
$query = "INSERT INTO `users`(`Address`)
    VALUES ('".mysqli_real_escape_string($connection,$address)."')";

but could be you need  an update
$query = "Update `users`
          set `Address` = '".mysqli_real_escape_string($connection,$address)."'
         WHERE `username` = '$query_username'";


text:
Q: pytz package: can only be run with python2 (after pip install pytz) even though python3 is normally used When installing pytz to be used in a Python project, I get following Terminal output on my wsl Terminal:
pip install pytz
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7.
More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Collecting pytz
  Downloading pytz-2019.3-py2.py3-none-any.whl (509 kB)
     |████████████████████████████████| 509 kB 1.3 MB/s
Installing collected packages: pytz
Successfully installed pytz-2019.3

Afterwards, when running test.py I still got the error:
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    import pytz
ModuleNotFoundError: No module named 'pytz'

Trying import pytz-2019.3 and pytz2019.3 threw SyntaxErrors.
Finally, I could run the file with: python2 test.py.
I am wondering (for this package and for other packages which yield to similar problems) how I could run it normally with python3 test.py. Would I need to change anything in the installation?
Just for reference, this is the code I wanted to use:
from datetime import datetime
import pytz
tz_NY = pytz.timezone('America/New_York')
datetime_NY = datetime.now(tz_NY)
print("NY time:", datetime_NY.strftime("%H:%M:%S"))

Thanks for your help!


text:
Q: Align environment creates extra vertical space I'm typing a very large document (a thesis) and at some point align environment produces abnormally large vertical space before and after equation. I double-checked that it is neither in the beginning nor in the end of a paragraph. And the weird thing is that, when I copy the problematic piece of code and create a new document containing it alone, spacing is perfectly normal (hence, presenting it here is pointless). Also this abnormal spacing thing happens only once in the whole original document, although similar codes are used frequently.
My question is, what do you recommend me to check?

A: there is stretchable space inserted before and after any multi-line display structure
when amsmath is used.  (stretchable space is similarly inserted around single-line
displays, but they aren't as susceptible to the surrounding context.)
take a look at what appears on the following page.  if there is another large multi-line
display near the top (preceded by only one or two lines of text), it isn't by default
allowed to break the display if it doesn't fit on the previous page.  instead, the
stretchable gaps (around displays, before section headings, between paragraphs -- all
to a different degree) are stretched to produce a bottom-aligned page.
this isn't really what you usually want, as you have observed.
if you are willing to allow the long display on the second page to break, you can approach
this in the following ways:

*

*if you are willing to allow breaks in displays throughout the whole document, place
the command \allowdisplaybreaks in the preamble;

*if you want to be selective about where a long display breaks, insert \displaybreak
immediately before the \\ in the display where it is to take effect.

additional possibilities are described in the amsmath documentation (texdoc amsmath).
another possibility is that a box of some sort (e.g. a minipage) or other large
unbreakable element appears near the top of the "second" page.  the tactics for
dealing with such a situation depend on what kind of element it is.


text:
Q: Where can I access mono-develop on Ubuntu 10.10 ? I'm done installing it using synaptic manager I just browsed for mono-devel on the synaptic manager and installed it with its dependencies. Now, I'm stocked. I don't know if I still need to configure something, run some scripts on a terminal. I can't find it anywhere.

A: Just use ubuntu software center to install monodevelop IDE then it will appear on applications->programming.


text:
Q: Change Layout of Joomla article list with custom php Having spent a few days banging my head against a brick wall with this I need some help. I basically want to change the code here:

        <?php if(isset($this->leading) && count($this->leading)): ?>

            <?php foreach($this->leading as $key=>$item): ?>

            <?php
            // Define a CSS class for the last container on each row
            if( (($key+1)%($this->params->get('num_leading_columns'))==0) || count($this->leading)<$this->params->get('num_leading_columns') )
                $lastContainer= ' itemContainerLast';
            else
                $lastContainer='';
            ?>

            <div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->leading)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_leading_columns'), 1).'%;"'; ?>>
                <?php
                    // Load category_item.php by default
                    $this->item=$item;
                    echo $this->loadTemplate('item');
                ?>

            <?php if(($key+1)%($this->params->get('num_leading_columns'))==0): ?>

            <?php endif; ?>
            <?php endforeach; ?>

        <?php endif; ?>

        <?php if(isset($this->primary) && count($this->primary)): ?>

            <?php foreach($this->primary as $key=>$item): ?>

            <?php
            // Define a CSS class for the last container on each row
            if( (($key+1)%($this->params->get('num_primary_columns'))==0) || count($this->primary)<$this->params->get('num_primary_columns') )
                $lastContainer= ' itemContainerLast';
            else
                $lastContainer='';
            ?>

            <div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->primary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_primary_columns'), 1).'%;"'; ?>>
                <?php
                    // Load category_item.php by default
                    $this->item=$item;
                    echo $this->loadTemplate('item');
                ?>

            <?php if(($key+1)%($this->params->get('num_primary_columns'))==0): ?>

            <?php endif; ?>
            <?php endforeach; ?>

        <?php endif; ?>

        <?php if(isset($this->secondary) && count($this->secondary)): ?>

            <?php foreach($this->secondary as $key=>$item): ?>

            <?php
            // Define a CSS class for the last container on each row
            if( (($key+1)%($this->params->get('num_secondary_columns'))==0) || count($this->secondary)<$this->params->get('num_secondary_columns') )
                $lastContainer= ' itemContainerLast';
            else
                $lastContainer='';
            ?>

            <div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->secondary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_secondary_columns'), 1).'%;"'; ?>>
                <?php
                    // Load category_item.php by default
                    $this->item=$item;
                    echo $this->loadTemplate('item');
                ?>

            <?php if(($key+1)%($this->params->get('num_secondary_columns'))==0): ?>

            <?php endif; ?>
            <?php endforeach; ?>

        <?php endif; ?>

        <?php if(isset($this->links) && count($this->links)): ?>

<?php echo JText::_('K2_MORE'); ?>

            <?php foreach($this->links as $key=>$item): ?>

            <?php
            // Define a CSS class for the last container on each row
            if( (($key+1)%($this->params->get('num_links_columns'))==0) || count($this->links)<$this->params->get('num_links_columns') )
                $lastContainer= ' itemContainerLast';
            else
                $lastContainer='';
            ?>

            <div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->links)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_links_columns'), 1).'%;"'; ?>>
                <?php
                    // Load category_item_links.php by default
                    $this->item=$item;
                    echo $this->loadTemplate('item_links');
                ?>

            <?php if(($key+1)%($this->params->get('num_links_columns'))==0): ?>

            <?php endif; ?>
            <?php endforeach; ?>

        <?php endif; ?>

So that 'leading' displays a certain number of articles, then 'primary' displays the next two, 'secondary' the next four and so on.
Any help on how to do that would be great

A: The file is located here:

/layouts/joomla/content/category_default.php

To override it place a copy here:

[YOUR_TEMPLATE]/html/layouts/joomla/content/

You can read more about Joomla layouts here:
Sharing layouts across views or extensions with JLayout


text:
Q: Gender showing for table and Font Color based on age for Table I need my table to list out the genders of the heroes as "M" or "F" in the table based on the gender of the heroes whether its male or female. So if its Male it will only show out as "M". Furthermore, I need the fonts to be of specific color based on the ages. For example, if 0 < age <= 20  font color #000000(black). if 20 < age <= 50 = font color #85929E
I don't know how to Bind the hero.gender data to the table to show M or F & and bind the font colors to the age.

        Hero ID
        Hero Name
        Gender
        Age
        Superpower
        Delete

    {{hero.id}}
    {{hero.name}}
    {{hero.gender}}
    {{hero.age}}
    {{hero.superpowers}}

    <button class="delete" title="delete hero"
        (click)="delete(hero)">X</button>

Mock-heroes:
export const HEROES: Hero[] = [
  { id: 11, name: 'Mr.Incredible', gender: 'Male', superpowers: 'Super Strength', age: 10  },
  { id: 12, name: 'Missappear', gender: 'Female', superpowers: 'Invisibility', age: 29  },
  { id: 13, name: 'Jetstream', gender: 'Female', superpowers: 'Flying', age: 32 },
  { id: 14, name: 'Nightcrawler', gender: 'Male', superpowers: 'Shapeshifting', age: 17 },
  { id: 15, name: 'Flash', gender: 'Female', superpowers: 'Super Speed', age: 23 },
  { id: 16, name: 'Professor X', gender: 'Male', superpowers: 'Telepathy', age: 38 },
  { id: 17, name: 'Jean Grey', gender: 'Female', superpowers: 'Telekinesis', age: 35 },
  { id: 18, name: 'Wolverine', gender: 'Male', superpowers: 'Regeneration', age: 24 },
];

A: Just add another  in the table with something like the following:

<span [ngClass]="{'black-text' : hero.age <= 20}">M
 20 && hero.age <= 50}">M

Just created the css classes, and then do what you need to with the Female variant.
Above is just an example I wrote on here and might not actually compile successfully.

A: To change color based on condition you need to use ngStyle directive like below
component.html

        {{hero.id}}
    {{hero.name}}
    {{hero.gender == 'Male' ? 'M': 'F'}}
     {{hero.age}}
    {{hero.superpowers}}
    <button class="delete" title="delete hero">X</button>

component.ts
  getColorByAge(age) {

    switch (true) {
      case age > 0 && age <= 20:
        return '#000000';
      case age > 20 && age <= 50:
        return '#85929E';
    }
  }

Here is solution on stackblitz

A: Use to change color
[style.color]="hero.age <= 20 ? '#000000': hero.age <= 50 ? '#85929E' : 'green'"
Use to see only M/F:
{{hero.gender.charAt(0)}}
Here is the code
  <span class="badge" [style.color]="hero.age <= 20 ? '#000000': hero.age <= 50 ? '#85929E' : 'green'">{{hero.gender.charAt(0)}}

See working code


text:
Q: Error : BinderProxy@b4d6acb0 While running my project, I am getting the BinderProxy@b4d6acb0 error. Can I know the reason of this error. I have pasted my code below
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.custom_activity);

listView = (ListView) findViewById(R.id.list);
adapter = new CustomListAdapter(this, movieList);
listView.setAdapter(adapter);

   swipeContainer = (SwipeRefreshLayout) findViewById(R.id.swipeContainer);
   swipeContainer.setOnRefreshListener(new OnRefreshListener() {

@Override
public void onRefresh() {
// TODO Auto-generated method stub
//fetchTimelineAsync(0);
//Toast.makeText(getApplicationContext(), "Menu", Toast.LENGTH_SHORT).show();
//Intent i= new Intent(MainActivity.this,MainActivity.class);
//startActivity(i);
swipeContainer.setRefreshing(true);
adapter.clear();
method();
}

});


text:
Q: Error when cross-compiling Rust: Relocations in generic ELF (EM: 62) I am trying to compile a rust project (amp) for an OpenWrt router running mipsel.
I've already been able to cross-compile a few programs for this target.
However when I try to compile this project I come across this error:
mipsel-openwrt-linux-musl-ld: /tmp/amp/target/mipsel-unknown-linux-musl/release/deps/libbacktrace_sys-75cc20f8a52b27e7.rlib(fileline.o): Relocations in generic ELF (EM: 62)

The error suggests the library has been compiled for x86 instead of mipsel.
I tried putting all dependencies for amp in an empty cargo crate and it compiles fine. However the files found in target/mipsel-unknown-linux-musl/release/deps don't match that of those in amp.
I tried removing that particular backtrace_sys from the linker command, and then it fails on miniz-sys and if I remove that it fails on onig_sys. So it seems the issue lies at the compilation of the syntect crate which depends on the previously mentioned libraries. But I can cross-compile syntect and scribe (which requires syntect) just fine.
My flags and environment:
cargo +nightly test --lib --release --target mipsel-unknown-linux-musl -Z build-std

set -x PATH $TOOLCHAIN/bin $PATH
set -x AR_mipsel_unknown_linux_msl mipsel-openwrt-linux-musl-ar
set -x CC_mipsel_unknown_linux_msl mipsel-openwrt-linux-musl-gcc
set -x CXX_mipsel_unknown_linux_msl mipsel-openwrt-linux-musl-g++
set -x CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER mipsel-openwrt-linux-musl-ld


text:
Q: AudioSink outside of the Sandbox malfunctioning with REDHAWK IDE When I try to use the AudioSink component design by Axios which can be downloaded from: https://github.com/Axios-Engineering/audio-components
and used as a component is not working outside of the sandbox chalkboard.
I created a SCA Waveform Project with the AudioSink as a component and when I try to launch it with the Device Manager it doesn't launch it because it can't initiate an instance of the AudioSink component.
You can create a simple waveform using 2 components: AudioTestSource and connect this one to the AudioSink and it will not let the Device manager launch the component.
Some help please.

A: I have tested the components running within the DomainManager in the manner you suggested and they work for me.  It will be difficult to isolate the problem without some additional information about your system and the errors you are experiencing.
Here are a few things to check first.

*

*Have you installed the components into the SDRROOT?  This can be done by either dragging
the component project in the IDE over to the Target SDR or by running "make install" in
the components folder.  You can confirm that they have been installed to doing ls
$SDRROOT\dom\components.  In that folder you should see AudioTestSource and AudioSink.

*When you attempt to launch the waveform; can you provide the error printout that the
DomainMananger and DeviceManager produced?


text:
Q: How to use JavaScript search on the same page while the user is still typing? I'm trying to make a JavaScript search for a div within the same page. I'm currently using this code to display my search query:
$('.form-search').on('submit',function(){return false;});
$('.form-search .btn').on('click', function(e){
    var query = $.trim($(this).prevAll('.search-query').val()).toLowerCase();
    $('div.staff-container .bold').each(function(){
         var $this = $(this);
         if($this.text().toLowerCase().indexOf(query) === -1)
             $this.closest('div.staff-container').fadeOut();
        else $this.closest('div.staff-container').fadeIn();
    });
});

Here's a demo of an example with HTML and CSS:
DEMO
So I want to display the div, while the user is still typing. I know there is a refresh function, but I just cannot understand JavaScript. I'm a newbie student.

A: With a bit of refactoring you can both handle the click on the Search button and updating the search results as you type on the text input. This should work:
function updateResults() {
    var query = $.trim($('.search-query').val()).toLowerCase();
    $('div.staff-container .bold').each(function(){
         var $this = $(this);
         if($this.text().toLowerCase().indexOf(query) === -1)
             $this.closest('div.staff-container').fadeOut();
        else $this.closest('div.staff-container').fadeIn();
    });
}

$('.form-search').on('submit',function(){return false;});
$('.form-search .btn').on('click', updateResults);
$('.search-query').on('input', updateResults);

Updated Jsfiddle: http://jsfiddle.net/1w8L0oeq/

A: Is that you want ?
You just have to listen 'input' event instead of click.
$('.form-search .search-query').on('input', function(e){ ... });
http://jsfiddle.net/817tfr03/

A: You can use the keyup() function on the searchfield as a trigger, instead of click().
Similar to what is done here


text:
Q: angular js repeat in the defined numbers I am new in Angular JS. I am working on a caraousel in angular js. I want to repeat a DIV which is having a SET of 4.
I can see now divs are created after using ng-if="$index % 4 == 0" but I am not able to get the 4 items.
How can I use INDEX for getting 4 items in my repetitive DIV?
Please have a look at the code as following :

   {{specialDeals.name}}

View details »

 {{specialDeals.name}}

View details »

Product name

View details »

Product name

View details »

function _getSpecialDeals() {
    if (document.getElementById('FCDivID')) {
        $scope.requestData = $scope.requestData + '&category_id=' + $scope.featuredCategoryId;
    }

    $http(
        {
            method : 'POST',
            url : $scope.base + '/specialoffers/GetSpecialDeals',
        crossDomain : true,
        headers : {
            'Content-Type' : 'application/x-www-form-urlencoded',
            'key' : 'xxxxxxxxxxx'
        },
        data : $scope.requestData,
    })
    .then(
            function successCallback(response) {
                document.getElementById("gifLoader").style.display = "none";
                //document.getElementById("gifLoader1").style.display = "none";

                document.getElementById("loader").style.display = "none";

                if(response.data.SpecialProductsList!=undefined){
                    if(response.data.SpecialProductsList.length<5){
                    $scope.flagArrow=false;}
                }
                if (response.data.status == "200") {
                    $scope.specialDeals = response.data;
                    $scope.totalPages = response.data.total_pages;

                    if ($scope.pageNumber > 1) {
                        for (var i = 0; i < response.data.SpecialProductsList.length; i++) {
                            $scope.SpecialDealsList
                                    .push(response.data.SpecialProductsList[i]);
                        }
                    } else {
                        $scope.SpecialDealsList = $scope.specialDeals.SpecialProductsList;
                    }
                    if (document
                            .getElementById("list_item")) {
                        $scope.SpecialDealsList
                                .push({
                                    "product_id" : "1",
                                    "name" : "Get All Deals",
                                    "product_selling_price" : "0.00",
                                    "wish_list" : "False",
                                    "images" : "img/view-more.jpg",
                                    "product_special_from_date" : "",
                                    "product_special_to_date" : "",
                                    "product_special_price" : "",
                                })
                    };
                }
                /*document.getElementById("wpf-loader-two").style.display = "none";*/
            });
    }
}

A: EDIT:Found it.. You have to use ng-repeat to iterate through specialDeals. Hope this helps

{{x.name}}

Although I was not able to make the code run, I would just like to point out a few mistakes in order to be helpful,
it should be:-
if(response.data.SpecialProductsList!==undefined){

instead of a single '='
and instead of writing function getSpecialDeals() ,do this :
$scope.getSpecialDeals=function () {  if (document.getElementById('FCDivID')).....


text:
Q: Double ng-view/ui-view in AngularJS, is it possible? I am developing an app with the MEAN stack...and the question is...
How can I divide the interface of my app?
I have a static page(such a webpage) and an application page, the interface is different but the development that I have followed is...
In the file 'index.js' of my app, where I put all the dependencies and set the . In this file I have set the header and the footer of the static page for not repeat it in all the html files. It is working when I navegate above the static page, but when I am developing the app-page I want to change the main interface.
So, Must I repeat the code? or Can I set directives like ng-show to show each interface in each situation?
There I show you the mockups of my app:
Static:

Application:

The body target of my 'index.js' file:

                        R.U. Pino Montano

                            Inicio

                                Noticias

                                Información

                                Equipo

                                Servicios

                                Contacto

                                Resi App

                                moodInicio

                                new_releasesNoticias

                                infoInformación

                                peopleEquipo

                                businessServicios

                                contact_mailContacto

                                exit_to_appResi App

                        menu

                BETA

Contacto

location_on Avda. Alcalde Manuel del Valle nº 28

41008, Sevilla (España)

account_balance C.I.F.: XXXXX

local_phone Tel: XXX XXX XXX

email rupinomontano@gmail.com

web rupinomontano.com

Desarrollo

Síguenos en

                © 2018 Developed by

Thank you in advance!

A: As you are using angularjs, you can create a single page application.
answering to your qustions
Q: Must I repeat the code?
Ans - in angularjs you should not repeat your code, you maintain common part in one page and from that page you can render to diffrent page. this the beauty of single page application. to create a single page application you need routing. to achive routing in angular js you can use angular router package or you can use UI Router package.
please chack this example for angular router : https://www.journaldev.com/6225/angularjs-routing-example-ngroute-routeprovider
please chack this example for UI router : https://scotch.io/tutorials/angular-routing-using-ui-router
Q: Can I set directives like ng-show to show each interface in each situation?
Ans - you should use routing directive. from these directive you can navigate to different page without reloading pages again again.


text:
Q: Matching article text against pre-existing list of categories I'm new to Azure Cognitive Services, and while I'm pretty sure it can help me solve my problem, I don't quite understand which part of it to use for it...
Here's what I want to do:
We have blog posts, say ~1k, and those blog posts all have categories and tags (multiple each). What I want to do, is to "guess" the right categories/tags for each article based on the content, and then present that to the editor as a suggestions at the time of input ("looks like this article is about: health, well-being, ..."). The ~1k articles we already have in the system are currently correctly tagged/categorized, so I'd like to use these a data source for this "guessing".
I've used Azure Search before, and it seems like some combination of EntityRecognition and KeyPhraseExtraction might be a way in the right direction? Azure Cognitive Services also seems to have an API that supports TextAnalytics that would do something similar. I'm a bit confused about why these are two different things (or are they not?)
This also seems like an entirely common problem (matching text against pre-defined categories based on other text that is categorized), so I'm wondering if I'm just missing an obvious solution here?
Thanks in advance.

A: I think the Azure Cognitive Text Analytics API is your best bet as you are looking for real-time analysis prior to tagging/categorizing for storage.
Text Analytics could return a list of named entities that you could map to your available tags/categories and present to the user.
Azure Cognitive Search requires an indexer and skillset to process target text with an end result of storing the processed results to an index specifically for searching.


text:
Q: Startup timestamp in Eureka metadata We're using Spring Cloud Angel.SR6 with Netflix Eureka and Spring Config Server. One of our microservices is a distributed system that uses Eureka as a discovery mechanism to find peers. In order to start up the system in the correct way when multiple instances are started in parallel, we would like to know which node started first. The application information in Eureka contains a few different timestamps, but they change when the Eureka client updates the status so it seems that we can't rely on them.
Our idea now is to have the application register its own boot timestamp in the Eureka metadataMap which we have been able to accomplish using the EurekaInstanceConfigBean. With this approach however, the timestamp is added too late in the process. The instances initially appear in Eureka without the timestamp, which is not good enough for us (and even if it would be, it takes to long to be a nice solution).
What we are trying to do instead is to get the timestamp included in the initial Eureka registration. Properties declared in bootstrap.properties are included, so if we could somehow get the timestamp in here everything would work:
eureka.instance.metadataMap.bootTimestamp=<here we want the timestamp>
We have tried to add a custom PropertySourceLocator using the approach mentioned in the Spring Cloud Documentation, but still no luck. The initial Eureka registration happens before the the PropertySourceLocator is initialized which again is too late.
How can we get the boot timestamp into the environment before the initial Eureka registration so the application never appears in Eureka without a timestamp?

A: We found a not altogether satisfying work-around, so I'm posting this in somebody finds it useful. By passing a timestamp in an environment variable or a system property we are able to include it in the initial registration of metadata in Eureka.
Command line (assuming Linux/bash):
BOOT_TIMESTAMP=$(date +%s%3N) java ...

bootstrap.properties:
eureka.instance.metadataMap.bootTimestamp=${boot.timestamp:0}

A: you can set an evn Property by using System.setProperty when the application gets started. and after that you can use it through the property file like below.
    public static void main(String[] args) {
        System.setProperty("APP_TIMESTAMP", String.valueOf(System.currentTimeMillis())); //this is the line to set the time that the application gets started.
        SpringApplication.run(UseServiceApplication.class, args);
    }

usage of env value in property file (i have used yml file here.)
eureka:
  instance:
    metadata-map:
      timestamp: ${APP_TIMESTAMP}


text:
Q: How to configure a k8s reverse proxy service with MetalLB I'd need to reach jupyter-lab from port 80 and have the k8s configuration redirect to 8888. This is a problem I have set myself to learn about k8s networking, and also get a jupyter-lab running.
Here is the MetalLB config map.
Local DNS resolves "jupyter-lab.k8s.home" to these ip addresses
---
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 10.10.10.24-10.10.10.26

Here is my LoadBalancer pointing to the ingress controller, is this not exposing port 80 and redirecting to the target 8888 ?
---
apiVersion: v1
kind: Service
metadata:
  name: jupyter-lab-lb
  namespace: default
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 8888
  selector:
    app: jupyter-lab-ingress

This is my ingress controller, is it correctly configured the with ingress object pointing to the CIP ?
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: jupyter-lab-ingress
  annotations:
    # nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io: /
spec:
  rules:
  - host: jupyter-lab.k8s.home
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: jupyter-lab-cip
            port:
              number: 8888

This is the CIP that targets my deployment of jupyer-lab
---
apiVersion: v1
kind: Service
metadata:
  name: jupyter-lab-cip
  namespace: default
spec:
  type: ClusterIP
  ports:
    - port: 8888
      targetPort: 8888
  selector:
    app: jupyter-lab

This is my deployment that is running jupyter-lab on port 8888
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jupyter-lab-dpt
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jupyter-lab
  template:
    metadata:
      labels:
        app: jupyter-lab
    spec:
      volumes:
        - name: jupyter-lab-home
          persistentVolumeClaim:
            claimName: jupyter-lab-pvc
      containers:
        - name: jupyter-lab
          image: docker.io/jupyter/tensorflow-notebook
          ports:
            - containerPort: 8888
          volumeMounts:
            - name: jupyter-lab-home
              mountPath: /var/jupyter-lab_home
          env:
            - name: "JUPYTER_ENABLE_LAB"
              value: "yes"

I do see jupyter-lab.k8s.home:8888, but I can't log in with the token I get from  kubectl logs -n default jupyter-lab-dpt-dfbd554b7-bf7fk
How do I set the configuration up so that I can browse to http://jupyter-lab.k8s.home?noportnumber

A: After you installed nginx ingress conrtoller (this is the link from your previous question) there should be a service created:
# Source: ingress-nginx/templates/controller-service.yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
  labels:
    helm.sh/chart: ingress-nginx-3.23.0
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/version: 0.44.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: controller
  name: ingress-nginx-controller
  namespace: ingress-nginx
spec:
  type: NodePort
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: http
    - name: https
      port: 443
      protocol: TCP
      targetPort: https
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/component: controller

You can make sure it exists by running:
kubectl  get svc -n ingress-nginx ingress-nginx-controller
NAME                       TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
ingress-nginx-controller   NodePort   10.105.157.46   <none>        80:30835/TCP,443:31421/TCP   17s

Notice its type is NodePort and you want LoadBalancer. Run kubectl edit svc -n ingress-nginx ingress-nginx-controller and change NodePort to LoadBalancer.
Now you should se this:
kubectl get svc -n ingress-nginx ingress-nginx-controller
NAME                       TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
ingress-nginx-controller   LoadBalancer   10.105.157.46   <pending>     80:30835/TCP,443:31421/TCP   83s

If your metalLB is configured correctly there should be an IP in place of a <pending>. Now point your domain to this IP.
You mentioned that: Local DNS resolves "jupyter-lab.k8s.home" to these ip addresses. Don't resolve to all addresses. Use the one that is assigned to the LB. Only this one.
Your ingress looks fine but you don't need this annotations.
jupyter-lab-cip service also looks good.
I don't like the jupyter-lab-lb service. You don't need it. What you need is a load balancer but pointing to ingress controller as described earlier.
Also i am not sure what is this:
  selector:
    app: jupyter-lab-ingress

Your deploymet doesn't have app: jupyter-lab-ingress label. Nginx ingress controller also doesn't have it (unless you added it, and didn't mention). So I am not sure what was the idea behind it and what you've tried to achieve. Anyway, you probably don't need it.

I do see jupyter-lab.k8s.home:8888, but I can't log in with the token I get from kubectl logs -n default jupyter-lab-dpt-dfbd554b7-bf7fk

I am not sure why this works because the configuration you provided shouln't allow it (Unless I am missing sth).


text:
Q: Why i get error when use spring input tag Whenever i use s:input i get org.apache.jasper.JasperException, i don't know why this doesn't work. Here is my code:
<c:forEach var="msg" items="${listMonAn}">
   <s:form action="XuLyThemMon.htm" commandName="chitietdon" method="get" modelAttribute="chitietdon">

         <img src="
         <c:url value="/resource/images/${msg.getMon_hinhAnh()}"/>
         " style="border-radius: 20px;">

         <s:input path="name" value="name"></s:input>
         <input type="submit" value="Đặt món" class="btn btn-info"/>

   </s:form>
</c:forEach>

There code use http://www.springframework.org/tags/form

A: Oh, i solved the issue, i just create a bean and import data in it:
@ModelAttribute("chitietdon")
    public ChiTietDon getThongTinBan(){
        return new ChiTietDon();
    }


text:
Q: Why is the generic parameter necessary in CDI? I use Java 1.7 and Glassfish 4.0.
There is a generic interface Service<T> with 2 implementations where the second extends the first.
public interface Service<T>{
  void serve(T t);
}

@Singleton @ServiceQualifier(type=ServiceType.DEFAULT)
public class DefaultService implements Service<MyType>{
  public void serve(MyType t){
    ...
  }
}

@Singleton @ServiceQualifier(type=ServiceType.SPECIAL)
public class SpecialService extends DefaultService{
  @Override
  public void serve(MyType t){
    ...
  }
}

In order to use CDI there is a qualifier annotation where ServiceType is a simple enum with ServiceType.DEFAULT and ServiceType.SPECIAL.
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE, ElementType.METHOD})
public @interface ServiceQualifier {
  ServiceType type();
}

If the Service is injected like this
@Inject @ServiceQualifier(type=ServiceType.DEFAULT)
private Service service;

the CDI Container throws an exception (I deploy the app to glassfish 4 if that matters.)

Error occurred during deployment: Exception while loading the app :
  CDI deployment failure:WELD-001408 Unsatisfied dependencies for type
  [Service] with qualifiers [@ServiceQualifier]

But if the Service is injected with the generic parameter it works.
@Inject @ServiceQualifier(type=ServiceType.DEFAULT)
private Service<MyType> service;

I am very confused now because i thought that generic parameters are removed at compile time in Java. Can someone explain why it is necessary to specify the generic parameter although it is compiled away?
Thanks in advance.

A: Yes, it's required as the type parameter goes into the selection.  You can put the qualifier anywhere , but if it doesn't match type you won't be able to inject the bean into it.


text:
Q: SyntaxError: invalid character in identifier Python 3.5.2 & tensorflow i am now starting to learn about tensorflow..was following along with a youtube vid on this and followed the program but getting a SyntaxError: invalid character in identifier -line 53 sess.run(tf.global_variables_initializer())...see program below..any assistance appreciated:
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data

mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)

n_nodes_hl1 = 500
n_nodes_hl2 = 500
n_nodes_hl3 = 500

n_classes = 10
batch_size = 100

#height x width
x = tf.placeholder('float',[None, 784])
y = tf.placeholder('float')

def neural_network_model(data):
    hidden_1_layer = {'weights' :tf.Variable(tf.random_normal([784, n_nodes_hl1])),'biases':tf.Variable(tf.random_normal([n_nodes_hl1]))}

    hidden_2_layer = {'weights': tf.Variable(tf.random_normal([n_nodes_hl1, n_nodes_hl2])),
                      'biases': tf.Variable(tf.random_normal([n_nodes_hl2]))}

    hidden_3_layer = {'weights': tf.Variable(tf.random_normal([n_nodes_hl2, n_nodes_hl3])),
                      'biases': tf.Variable(tf.random_normal([n_nodes_hl3]))}

    output_layer = {'weights': tf.Variable(tf.random_normal([n_nodes_hl3, n_classes])),
                      'biases': tf.Variable(tf.random_normal([n_classes]))}

    # (input_data * weights) + biases

    l1 = tf.add(tf.matmul(data, hidden_1_layer['weights']), hidden_1_layer['biases'])
    l1 = tf.nn.relu(l1)

    l2 = tf.add(tf.matmul(l1, hidden_2_layer['weights']), hidden_2_layer['biases'])
    l2 = tf.nn.relu(l2)

    l3 = tf.add(tf.matmul(l2, hidden_3_layer['weights']), hidden_3_layer['biases'])
    l3 = tf.nn.relu(l3)

    output = tf.matmul(l3, output_layer['weights']) + output_layer['biases']

    return output

def train_neural_network(x):
    prediction = neural_network_model(x)
    cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=prediction, labels=y))
    optimizer = tf.train.AdamOptimizer().minimize(cost)

    hm_epochs = 10

    with tf.Session() as sess:
        sess.run(tf.global_variables_initializer())

        for epoch in range(hm_epochs):
            epoch_loss = 0
            for _ in range(int(mnist.train.num_examples/batch_size)):
                epoch_x, epoch_y = mnist.train.next_batch(batch_size)
                _, c = sess.run([optimizer, cost], feed_dict={x: epoch_x, y: epoch_y})
                epoch_loss += c
            print('Epoch', epoch, 'completed out of', hm_epochs, 'loss:', epoch_loss)

        correct = tf.equal(tf.argmax(prediction,1), tf.argmax(y,1))
        accuracy = tf.reduce_mean(tf.cast(correct,'float'))
        print('Accuracy:',accuracy.eval({x:mnist.test.images, y:mnist.test.labels}))

    train_neural_network(x)

A: I got the same error some time ago. Please don't copy paste the code from different editors or web pages. If you type it in you editor, it won't give you that error.

A: It is because copying code and pasting it lead to copying of spaces also. Remove spaces and add spaces manually around the identifier code works fine.

A: Your code contains unprintable and invalid characters. You can fix it by manually retyping it.
# copied and pasted from your code
s1 = 'sess.run(tf.global_variables_initializer())'

# manually typed
s2 = 'sess.run(tf.global_variables_initializer())'

The two strings look identical but they are not. Using repr we can see the difference:
print(repr(s1))
'sess.run(tf.global_variables_initializer())\ufeff'

print(repr(s2))
'sess.run(tf.global_variables_initializer())'

The extra character in s1is a ZERO WIDTH NO-BREAK SPACE. Wondering where that came from.


text:
Q: Java String index out of bounds with text file input I am trying to split a String input into two using the following code:
public TypeValue(String line) {
    while (line.charAt(i) != ' ') {
        i++;
        System.out.println(i);
    }
    type = line.substring(0,i);
    value = line.substring(i);
}

my input is a textfile that looks like this:
10 16
10 32
10 9024720
F 10
F 1
F 111111
F 100000
F 10110110100111001

However, I always get a java.lang.StringIndexOutOfBoundsException: String index out of range: 13. This only happens when I try to read the input from a text file. When I use the terminal to input the lines one by one it works just fine.
I have been looking for a couple hours but I cannot figure out what is causing this. It is also always "13", even when I delete all but the first line from the text file. Can anybody help me with this?
Edit: Thank you for the help everybody. The problem was with something else entirely. I didn't properly put my File in the Scanner in my main method...

A: You should simply use line.split(" ") which will return an array of String, then get either the first or the second value using respectively the index 0 and 1 of the resulting array as next:
String[] values = line.split(" ");
type = values[0];
value = values[1];

Another way could be to use line.indexOf(' ') to get the index of the space character in your String.
int index = line.indexOf(' ');
// From 0 to the index where we found the space
type = line.substring(0, index);
// Starts from index + 1 to skip the space
value = line.substring(index + 1);

A: You forgot to initialize i. Try this:
public TypeValue(String line) {
    int i=0;
    while (line.charAt(i) != ' ') {
        i++;
        System.out.println(i);
    }
    type = line.substring(0,i);
    value = line.substring(i);
}

A: Try comparing raw ascii values than characters,
as in
public TypeValue(String line) {
    int i=0;
    //ascii value for space is 32
    while ((int)line.charAt(i) != 32) {
        i++;
        System.out.println(i);
    }
    type = line.substring(0,i);
    value = line.substring(i);
}


text:
Q: Create new matrix from existing matrices java I have a matrix A, B, C, D of dimension n*m which I already created. I want to create a new matrix from that existing matrices.
Can anyone tell me how to create that type of matrix using Java programming?


text:
Q: Hawaiian diacriticals Should you use an aria label within an abbreviation?
Example, UH is the abbreviation for University of Hawaiʻi. In locations where there is a use of diacritical marks, I am using an aria-label. But does it make sense to use the aria-label within the abbreviation? Or can I simply explain the abbreviation without the diacritical mark?
Combine the following:
Hawaiʻi(with the diacritical mark)
and the abbreviation UH
To make:
 <abbr title="University of Hawaiʻi"UH

Or simplified?
UH with no diacritical marks

A: My guess would be a screen reader would read both of these items fine and you would not need an aria-label or anything else in this circumstance.
However, if you need to add text in markup attributes such as those used by aria then you will have to do the best you can without the diacritical mark. You could also investigate the use of aria-labelledby with an element otherwise not displayed or read out, but that would be over the top in my opinion.


text:
Q: Can I backup photos stored on parse.com? We can export parse.com database data as JSON, but how can you export pictures stored there together with text data?
I was looking at the settings and couldn't find anything what would help with that.

A: There is no way to do it automatically via an export button, however it is fairly easy to do manually.
You'll want to iterate through your table and pull down each item individually via the ParseFile interface.
Depending on what platform you are using, you could use the OSX or C# APIs. Or just go with using Python.


text:
Q: Carriage Return tooltip text in a title tag using JS I have a simple JS function that outputs some results from a DB to a JS String. I then use the results from the function in a title tag, so that when you hover over a link  you'll see a tool tip. And that all works, except I don't know why I'm not getting new line when I use
?  Am I missing something.  Below is the code I'm using:
      //loop through returned DB results and form string.
      //use
 to break line
     function getResults(id, state, dte){
      :
      :
      $.each(data.results, function(key, val) {
        output = output + x + ". " + val.abr_month +": "+ val.result +" ("+val.point+")
";
        x = x + 1;
        //output = + output;
      });//end each
          return output;
          }//end function

     result = getResults(id, state, dte);
     //return the HTML DOM object
     $('#'+id)[0].title=result;

The string I see being returned when I hover over the link is: 1. Apr: Result(45)&#xA2. May: Result (45)&#xA.
What I want to see is this:
1. Apr: Result (45)
2. May: Result (45)
if you can help in any way, that would be great
Note: I've removed the semi-colon for the purpose i've displayin the text &#Xa
I'm not using JQuery 1.9 so I can't use tooltip
Many thanks

A: Some browsers will allow

Others will not let you format the tool tip unless you use  jQuery UI tooltip or similar
Live demo
The demo is using jQuery 1.6.4 and jQuery UI v1.11.0pre just to let you see that jQuery and jQuery UI can have different versions
the dynamic part is found here:
jQuery Tooltip UI - trigger tooltip after x seconds
var titles = {
    "aprmay":"1. April: Result (49)
2. May: Result (47)",
    "junjul":"1. June: Result (50)
2. July: Result (42)"
}
$(function() {
    $(".result").each(function() {
        var title = this.title.replace(/; /g,"
");
        $(this).tooltip({ "content": title });
    });

    // dynamic generate on hover
    // https://stackoverflow.com/a/16523285/295783

  $(document).tooltip({
    items: '.dynresult',
    show: 100,
    hide: 500,
    position: { my: 'center bottom', at: 'center top' },
    content: function( callback ) {
      var title = titles[this.id];
      callback( title );
    }
  });
});

function getTitles(obj) {
    return titles[obj.id];
}

using this HTML

Static titles

April/May
June/July

Dynamic titles

April/May
June/July


text:
Q: PhoneGap error: Plugin 'LowLatencyAudio' not found, or is not a CDVPlugin We're using PhoneGap 3.4. We installed the LowLatencyAudio plugin, following the instructions here: https://github.com/triceam/LowLatencyAudio
However, we see the following error:
2014-03-10 19:59:25.960 S[7828:60b] CDVPlugin class LowLatencyAudio (pluginName: LowLatencyAudio) does not exist.
2014-03-10 19:59:25.962 S[7828:60b] ERROR: Plugin 'LowLatencyAudio' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2014-03-10 19:59:25.963 S[7828:60b] -[CDVCommandQueue executePending] [Line 127] FAILED pluginJSON = [
"INVALID",
"LowLatencyAudio",
"preloadFX",
[
"sounds\/right.mp3",
"sounds\/wrong.mp3"
]
]

the mapping does exist in config.xml. we invoke the code with:
LowLatencyAudio.preloadFX( GUESS_RIGHT_SOUND, GUESS_RIGHT_SOUND);
LowLatencyAudio.preloadFX( GUESS_WRONG_SOUND, GUESS_WRONG_SOUND);

we have also tried:
PGLowLatencyAudio.preloadFX( GUESS_RIGHT_SOUND, GUESS_RIGHT_SOUND);
PGLowLatencyAudio.preloadFX( GUESS_WRONG_SOUND, GUESS_WRONG_SOUND);

both approaches fail, and only the LowLatencyAudio one generates error messages.

A: Found the answer here: Cordova iOS plugins not found
Make sure the plugin source classes have their "target membership" include the right applications.


text:
Q: Postgres many to one relationship join multiple tables and select all rows, provided that at least one row matches some criterea Suppose I have a schema something like
create table if not exists user (
  id serial primary key,
  name text not null
);

create table if not exists post (
  id serial primary key,
  user_id integer not null references user (id),
  score integer not null
)

I want to run a query that selects a row from the user table by ID, and all the rows that reference it from the post table, provided that at least one row in the post table has a score of greater than some number n (e.g. 50). I'm not exactly sure how to do this though.

A: You can use window functions.  Let me assume that post has a user_id column so the tables can be tied together:
select u.*
from user u join
     (select p.*, max(score) over (partition by user_id) as max_score
      from post p
     ) p
     on p.user_id = u.id
where p.max_score > 50;

If you just wanted all scores, then aggregation with filtering might be sufficient:
select u.*, array_agg(p.score order by p.score desc)
from user u join
     post p
     ) p
     on p.user_id = u.id
group by u.id
having max(p.score) > 50;


text:
Q: Solve the equation $6\cos^4 y+\sin^2 y =5$
Solve the equation $$6\cos^4 y+\sin^2 y =5 \qquad (0\leq y \leq 360^\circ).$$

I used quadratics and got the answers $y= 18.0, 162.0, 198.0,$ and $342.0$ degrees, but it differs from the answer given which is $y= 45, 135, 225, 315 $ degrees. I am not sure how to solve this problem, thus any help would be appreciated. Thank you!

A: Your answers are correct. None of given answers: $45^\circ,135^\circ,225^\circ,315^\circ$ satisfies given equation.
$$6\cos^4y+\sin^2y=5$$
$$6\cos^4y-\cos^2y-4=0$$
$$\cos^2y=\frac{1\pm\sqrt{97}}{12}$$
$$\cos y=\pm\sqrt{\frac{1+\sqrt{97}}{12}}$$
$$y=\cos^{-1}\sqrt{\frac{1+\sqrt{97}}{12}}\approx 18.04^\circ, 180^\circ-\cos^{-1}\sqrt{\frac{1+\sqrt{97}}{12}}\approx 161.96^\circ,$$$$ 180^\circ+\cos^{-1}\sqrt{\frac{1+\sqrt{97}}{12}}\approx 198.04^\circ, \quad 360^\circ-\cos^{-1}\sqrt{\frac{1+\sqrt{97}}{12}}\approx 341.96^\circ$$

A: Well, if you substitute $x=\cos^2(\text{y})$ we get:
$$6x^2-x-4=0\space\Longleftrightarrow\space x=\frac{1\pm\sqrt{97}}{12}\tag1$$

A: $$5=6\cos^4y+1-\cos^2y\iff6\cos^4y-\cos^2y-4=0$$
$$\cos^2y=\dfrac{1\pm\sqrt{1+24\cdot4}}{12}=\dfrac{1+\sqrt{97}}{12}\text{ or }\dfrac{1-\sqrt{97}}{12}<0$$
$$\implies\cos2y=\cdots=\dfrac{\sqrt{97}-5}6$$