text:
Q: How to pass motion from one viewpager to another? I want 2 view pagers scroll simultaniously. If I scroll one, second mimic it. OnPageScrolledListener has all required data for it, but i dont see where to plug it.
new OnPageChangeListener() {

      @Override public void onPageScrolled(int page, float scale, int offset) {
      }

      @Override public void onPageSelected(int i) {
        setIndicators(i);
      }

      @Override public void onPageScrollStateChanged(int i) {

      }
    }

I tried to duplicate motioneven, but it always fire IlligalStateException
pager.setOnTouchListener(new View.OnTouchListener() {
      @Override public boolean onTouch(View v, MotionEvent event) {
        pagerInner.dispatchTouchEvent(event);
        return false;
      }
    });
java.lang.IllegalArgumentException: pointerIndex out of range
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.MotionEvent.nativeGetAxisValue(Native Method)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.MotionEvent.getX(MotionEvent.java:1981)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.support.v4.view.MotionEventCompatEclair.getX(MotionEventCompatEclair.java:32)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getX(MotionEventCompat.java:110)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.support.v4.view.MotionEventCompat.getX(MotionEventCompat.java:462)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.support.v4.view.ViewPager.onTouchEvent(ViewPager.java:2054)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.View.dispatchTouchEvent(View.java:7127)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2170)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1905)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at yarh.bigdig.newreveil.view.activities.TutorialActivity$2.onTouch(TutorialActivity.java:90)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.View.dispatchTouchEvent(View.java:7122)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2170)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1905)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1925)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1379)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.app.Activity.dispatchTouchEvent(Activity.java:2396)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1873)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.View.dispatchPointerEvent(View.java:7307)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3172)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3117)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4153)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4132)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4224)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4203)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4243)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.Choreographer.doCallbacks(Choreographer.java:555)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.Choreographer.doFrame(Choreographer.java:523)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.os.Handler.handleCallback(Handler.java:615)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:92)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:137)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:4745)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at java.lang.reflect.Method.invokeNative(Native Method)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:511)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-08 14:23:32.580 25711-25711/yarh.bigdig.newreveil E/AndroidRuntime:  at dalvik.system.NativeStart.m

A: a bit sharp yet, but pagerInner mimics pagerOuter gragging;
pagerOuter.addOnPageChangeListener(new OnPageChangeListener() {
  @Override public void onPageScrolled(int page, float scale, int offset) {
    if (currentPage == page) {
      if (part != 1) currentOffset = 0;
      part = 1;
    } else {
      if (part != -1) currentOffset = 0;
      part = -1;
    }
    if (currentOffset != 0 && pagerInner.isFakeDragging()
        && Math.abs(currentOffset) < width - 20) {
      pagerInner.fakeDragBy(-1 * ((offset - currentOffset)));
    }
    currentOffset = offset;
  }

  @Override public void onPageSelected(int i) {
    setIndicators(i);
    currentOffset = 0;
    currentPage = i;
    if (pagerInner.getCurrentItem() != i) pagerInner.setCurrentItem(i, true);
  }

  @Override public void onPageScrollStateChanged(int i) {
    switch (i) {
      case ViewPager.SCROLL_STATE_DRAGGING:
        pagerInner.beginFakeDrag();
        break;
      case ViewPager.SCROLL_STATE_IDLE:
        break;
      case ViewPager.SCROLL_STATE_SETTLING:
        pagerInner.endFakeDrag();
        break;
    }
  }
});


text:
Q: How to make overflow-y: scroll account for border size I would like to make ul's overflow account for the borders of div it is contained in.
I have tried adding padding with the same px measurement as border tag.
.resizable {
  background: black;
  width: 80%;
  height: 50%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}

.resizable .resizers {
  width: 100%;
  height: 100%;
  border: 3px solid #4286f4;
  box-sizing: border-box;
}

.resizable .resizers .resizer {
  width: 10px;
  height: 10px;
  border-radius: 50%; /* Magic to turn square into circle. */
  background: white;
  border: 3px solid #4286f4;
  position: absolute;
}

.resizable .resizers .resizer.top-left {
  left: -5px;
  top: -5px;
  cursor: nwse-resize;
}

.resizable .resizers .resizer.top-right {
  right: -5px;
  top: -5px;
  cursor: nesw-resize;
}

.resizable .resizers .resizer.bottom-left {
  left: -5px;
  bottom: -5px;
  cursor: nesw-resize;
}

.resizable .resizers .resizer.bottom-right {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
}

#npc_events {
  width: 100%;
  height: 100%;
  flex-grow: 1;
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid lightgrey;
  overflow-y: scroll;
}

#npc_events li {
  padding: 10px 10px 10px 10px;
  color: white;
}

                        <form id="npc_chat-form">
                            <input id="npc_chat" autocomplete="off" title="chat"/>
                            <button id="npc_say">Say</button>
                        </form>

I expected the text, which is
 elements of
 contained in
 to not appear above div's blue borders, but I got this:
https://cdn.discordapp.com/attachments/401030271417188355/613446713629343756/unknown.png

A: The reason that your list is overflowing (or going out of the div/appearing on top of the line) is due to the fact that you have the tag #npc_events set to 100% height and this is not accounting for the input bar (chat-wrapper div).
One solution would be to add a padding to .resizers class and calculating the height of the class .chat-wrapper div, from there you can add the following to the #npc_events div.
height: calc(100% - (height of chat-wrapper));

Otherwise, I'd recommend setting the height of the chat-wrapper to a certain percentage of the wrapper div (.resizers) and the remaining to the list. For example:
.resizers {padding: 10px;}
.chat-wrapper {height: 20%;}
#npc_events {height: 80%;}

This would get you the desired result.

redpajama_set_name: RedPajamaStackExchange


text:
Q: "this" in Arrow functions , function function makeCounter() {

    return {
        count:0,
        counter:function(){
            return ++this.count;
        },
        counter1:()=>{
            return ++this.count
        }

    }
  }
let counters= makeCounter();
console.log(counters.count)// 0
console.log(counters.counter())//1
console.log(counters.counter1())// NaN`

//in counter() ,counter1(), 'this' is different ,why ???
//in counter() ,counter1(), 'this' is different ,why ???


text:
Q: Hide JqueryUI dialog window on mobile browsers I have a jqueryUI dialog window that opens at pageload.  Very simple, very easy:

The problem is, I'd like to hide this on mobile browsers, but it's not working at all.  Any attempts to use a css media query to display: none on certain monitor resolutions isn't getting picked up, as the element style on jquery-ui is display: block;
Any other way to achieve this?

A: Check the size of the screen. If it less than minimum size, skip dialog.
if($(window).height() >= miniumHeight && $(window).width() >= minimumWidth) {
    /*Show Dialog Box*/
} else {
    /*Do Something Else*/
}

Another way would be the css visibility: hidden;


text:
Q: QTCreator: Tracepoints: How to print the value of a variable My question is simple, but I couldn't find an answer online.
How can I print the value of a variable in a tracepoint message ?
I know it's possible, but I forgot the formatting rules. I tried different kinds of brackets/braces around the variable name because I think it was done in a similar way, but nothing seems to work anymore.


text:
Q: Radio button onclick bring div to highest zindex Background:
So... first shot with radio buttons triggering onclick javascript function.
I have a collection of radio buttons (name = 'div_select') that i'm attempting to pair each button with a specific div ('beginner1', 'beginner2', etc.).  When the radio button is selected, I'm trying to set the zIndex of the paired div to be the highest via onclick.
Each of the paired divs are formatted via CSS so that they're all in the exact same location (#beginner1, #beginner2, #adept1, etc. {}).
At this point I'm attempting to make a different onclick for each pairing.

Issue:
I have not been having luck changing the zindex to bring the div to the foreground.

Question:
As I am fairly new to the html/javascript realm, the fairly blanket question would be "where am i going wrong?"
I have read through several posts (e.g., bring div element to front with zIndex and set zIndex onclick) to try and make some headway on my own, but I feel my skills in these languages are so limited that I'm at a fairly utter loss to understand what tags to even use.

Code in question

function highest_index() {
  var highest_index
  highest_index = highest_index +
}

function beg1() {
  document.getElementByID('beginner1').style.zIndex = highest_index;
}

function adt1() {
  document.getElementByID('adept1').style.zIndex = highest_index;
}
<form>

        Beginner

      <input type="radio" name="div_select" onclick="beg1()" />Video

        Adept

      <input type="radio" name="div_select" onclick="adt1()" />Video

        Label for Table

        second div intended to test

</form>

Edit to javascript based on comments section:

var highest_index = highest_index++;
}
function beg1() {
   document.getElementByID('beginner1').style.zIndex = highest_index();
}
function adt1() {
   document.getElementByID('adept1').style.zIndex = highest_index();
}

A: So there are quite a few issues here but I'll address them individually.

*

*Your highest_index variable should be declared globally so that it isn't reset each time the function is called.

*Having a variable and a function with the same name in the same scope will cause conflict. Change the name of one or the other.

*highest_index+ should be highest_index++, or if you want to return the result at the same time you can use ++highest_index (both increment highest_index, but var++ returns the value before incrementing, whereas ++var returns the value after incrementing).

*As 3 points out, you want to return the updated highest_index so that you can use it.

*getElementByID is not a function (JS is case-sensitive!). Change ID to Id.
Feel free to remove the console.log()s that I've added; they're solely for demo purposes.
I've added comments to the code below to highlight the changes above by number.

var highest_index = 0;        //1. Highest index declared globally

function getHighestIndex() {  //2. Function renamed
  return ++highest_index;     //3 & 4. Increment and return
}

//5. GetElementByID changed to GetElementById
function beg1() {
  document.getElementById('beginner1').style.zIndex = getHighestIndex();
  console.log(`The z-index of beginner1 is ${document.getElementById('beginner1').style.zIndex}`);
}

//5. GetElementByID changed to GetElementById
function adt1() {
  document.getElementById('adept1').style.zIndex = getHighestIndex();
  console.log(`The z-index of adept1 is ${document.getElementById('adept1').style.zIndex}`);
}
<form>

        Beginner

      <input type="radio" name="div_select" onclick="beg1()" />Video

        Adept

      <input type="radio" name="div_select" onclick="adt1()" />Video

        Label for Table

        second div intended to test

</form>


text:
Q: Change JFrame in WindowBuilder Eclipse I'm working with swing and I'm not able to change the JFrame in COMPONENTS area in WindowBuilder.
I can only see the main frame.
When I press a button I create a new Frame but I cant edit it with WindowBuilder.

        frameMain.setVisible(false);
        frameLogin = new JFrame("Login Admin");
        frameLogin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frameLogin.setSize(600, 400);
        frameLogin.setLocationRelativeTo(null);
        frameLogin.setVisible(true);

I WANT TO EDIT frameLogin in WindowBuilder, any solution?
By creating a new JFrame in WindowBuilder it creates another class in other file.

A: I did this :
In my view (frameMain) I declared this :
private loginFrameAdmin frameLoginA;
private loginFrameUser frameLoginU;

where loginFrameAdmin is a JFrame like this :
import javax.swing.JFrame;

public class loginFrameAdmin {

    private JFrame frameLogin;
    public loginFrameAdmin() {
        frameLogin = new JFrame("Login Amministratore");
        frameLogin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frameLogin.setSize(600, 400);
        frameLogin.setLocationRelativeTo(null);
        frameLogin.setVisible(true);
    }
}

Then in the same view (frameMain) I added a class :
public void adminPage() {
        JOptionPane.showMessageDialog(null, "Login for admins");
        frameMain.setVisible(false);
        frameLoginA = new loginFrameAdmin();
    }

And now I'm able to edit my JFrame, thanks to @kalsowerus


text:
Q: How to restore a over-written built-in function in Julia The question may apply for other languages, too.
If I use a built-in function name as a variable name,
I can restore the function by doing:
all = 123
all = Base.all

But If I define, for example, a custom function sum() and then I do,
sum = Base.sum

I got an error saying "invalid redefinition of constant sum"
Is there a way to restore a built-in function if I over-wrote it? Or is that impossible by design?

A: For this example, you could just redefine sum as Base.sum:
sum(x) = Base.sum(x)
Is that what you would like?
NB. this may not "overwrite" your definition of sum. If it uses type parameters (e.g. sum(x::Vector) it may still be dispatched in preference to the general sum(x), in which case you would need to repeat the above for those specific methods.

A: If this is simply a problem for you when you are working in the REPL, and you don't mind losing all your other definitions, you could do workspace() to reset Main.


text:
Q: iMessage with shared Apple ID I was recently notified that my ex boyfriend signed into iMessage on his laptop using my email address. I have since then changed my Apple ID password and was immediately asked to enter my new password into iCloud. If I changed the password, will it automatically sign out on his computer as well? And, if so, is he still able to use my email for iMessage?

A: Changing the password should be sufficient. You can see which devices are currently logged in with your Apple ID by following the instructions provided in this Apple support article:
Check your Apple ID device list to see where you're signed in
You can also remove devices from your Apple ID profile by clicking the Remove button that appears in the device information box after you've clicked on one of the devices.
As an added step, I would highly recommend turning on two-factor authentication after you get everything squared away. You can read more about two-factor authentication and how to enable it in the following Apple support article:
Two-factor authentication for Apple ID

A: If you change the password, he will can't login iMessages with your Apple ID. When he open it and want to launch iMessage, it will tell him the password is not correct. He can't use  it any more.


text:
Q: Is there an elegant way to achieve target dependency ordering in Ant? Suppose I have a simple build script with the following 4 targets:

*

*build - Compile's the project's code, depends on init

*init - Sets up the build environment, depends on nothing

*clean - Deletes all files generated by build and init, depends on nothing

*all - Simply cleans and then builds, depends on clean and build
<project>
    <target name="build" depends="init">
        <echo>Building the project</echo>
    </target>

    <target name="init">
        <echo>Setting up the build environment</echo>
    </target>

    <target name="clean">
        <echo>Deleting all generated files</echo>
    </target>

    <target name="all" depends="build,clean">
        <echo>Full build complete!</echo>
    </target>
</project>

The problem here is that the order of init and clean is ambiguous in Ant. If clean is called, it needs to run before all other targets, including init. However, init cannot have depends="clean" because we don't always want to run clean.
I realize that reversing the order of build and clean in the all target's dependencies (i.e. depends="clean,build") would technically get them to run in that order, however I don't consider this to be a satisfactory solution. Ant will still consider these targets to be siblings on the dependency tree, and will not actually enforce this order at all.
Another "solution" of course is to just hard code the ordering by using sequential <antcall/> tasks. This might be what I have to eventually fall back on, but it's something I'm trying to avoid (for multiple reasons that probably aren't worth expanding on).
Also, I'm aware that Gradle has exactly this feature built in (believe me, I'm jealous of it), but at this point my company's project is deeply entrenched in Ant, so switching really isn't an option.
EDIT - To give a better idea of the sort of thing I'm looking for, here's an example using features that I wish Ant had:
<condition property="init.depends.list" value="clean" else="">
    <contains string="${ant.project.call-graph}" substring="clean" />
</condition>

<target name="clean" />

<target name="init" depends="${init.depends.list}" />

After reading the manual page on Ant's bindtargets task, I'm starting to think Ant's target dependency list is immutable as part of its core design philosophy, so there might actually be no good answer to this question.

A: If you want to ensure that init never runs before clean. Then you can use a property to serve as a flag:
<target name="init">
    <property name="init-called" value="true"/>
</target>

<target name="clean">
    <fail if="init-called" message="init ran before clean"/>
</target>

If init runs before clean, the init-called property will be set and the <fail> task will fail the build.
Another option is to have all depend on two targets: enable-clean-target and init. enable-clean-target would set a property that would be used by the if attribute of the clean target:
<target name="enable-clean-target">
    <property="run-clean" value="true"/>
</target>

<target name="clean" if="run-clean">
    <!-- ... -->
</target>

<target name="init" depends="clean">
    <!-- ... -->
</target>

<target name="all" depends="enable-clean-target, init">
    <!-- ... -->
</target>

The init target explicitly depends on clean, but clean will only run if enable-clean-target ran earlier in the build.

A: From the Ant Targets documentation:

Ant tries to execute the targets in the depends attribute in the order
they appear (from left to right). Keep in mind that it is possible
that a target can get executed earlier when an earlier target depends
on it.

So unless your init and clean targets become more complex with additional dependencies, you can count on the ordering to be in order. So depends="clean,build" would work reliably.


text:
Q: Administrative places with openstreetmap I'm having alot of problems understanding the queries of the overpass-turbo api
I am trying to get all the provinces of every country in the world.
Or all the provinces of 1 certain country.
I think the province in this api is called an administrative boundary but I'm not sure
For example in Belgium it is:
Henegouwen
Luik
Luxemburg
Namen
Waals-Brabant
Antwerpen
Limburg
Oost-Vlaanderen
Vlaams-Brabant
West-Vlaanderen
If any of you guys have an idea how to form the good query for this, thanks !


text:
Q: MySQL Outer Join 3 Tables I have 3 sql tables and I want to make 1 table in html
The tables are:
Norm (norm_id, name, description, cluster_cluster_id, orden_orden_id)
Cluster (cluster_id, cluster_name)
Orden (orden_id, orden_name)

The table must contain:
norm_id - norm_name - norm - description - cluster_name - orden_name
I think i need to do this with a left outer join?
And how to show it in a table?
Right now i have
    while($row = mysqli_fetch_array($result)){
        echo "
";
            echo "" . $row['norm_id'] . "	";
            echo "" . $row['norm_name'] . "	";
            echo "" . $row['description'] . "	";
            echo "" . $row['cluster_name'] . "	";
            echo "" . $row['orden_name'] . "	";
        echo "
";
    }

A: You can make left outer join like, SELECT column-names
  FROM table-name1 LEFT JOIN table-name2
    ON column-name1 = column-name2
 WHERE condition


text:
Q: For-loop which should print out ArrayList attribute and other ArrayList Attribute I am trying to print out attribute from two different ArrayLists in the same syso. Cant get it to work and killed myself finding out why it doesnt
    for (int i = 0; i < resultlist.size(); i++) {
        Athlete matched = null;
        Result res = resultlist.get(i);
        for (int x = 0; x < resultlist.size(); x++) {
            Athlete del = athletes.get(i);
            if (res.compStartNumber() == del.startNumber()) {
                matched = del;
                break;
            }
        }
        System.out.println(matched.surName() + " " + matched.lastName() + " has result: " + res.resultValue());
    }

Works fine just printing out the resultValue for each Result but cant get it to work with the name aswell. So my question is: What am I doing wrong?

A: I think you should change
for (int x = 0; x < resultlist.size(); x++) {
    Athlete del = athletes.get(i);
    ...

to
for (int x = 0; x < athletes.size(); x++) {
    Athlete del = athletes.get(x);
    ...

so as to loop through the athletes arraylist correctly, since the 2 arraylists are probably not the same size. Also, this way you would scan all the athletes for each Result.


text:
Q: Using back/forward after AJAX link in rails app only shows partial In my rails application, I've begun to tinker with AJAX for the first time and although I have it working wonderfully, it has one unusual behavior: Hitting back or forward after using an AJAX link will give you only the unrendered AJAX-pulled partial in plain text form.
How does one fix this? I can't find anything on Google pertaining to this particular problem.

A: For any others with this problem, I found the culprit. There were a couple javascript links on the page with their hrefs set to # which messes with the browser's history when clicked. Replacing # with javascript:void(0) fixes the problem, giving the expected AJAX history behavior.


text:
Q: Scattering() for volatility_opt and returns not displaying for matplot: x and y not the same size I'm trying to represent the efficient frontier from an old financial model (MPT). Everything is fine until it comes to representation. In particular, from Matplot I got a neverending error, and from Plotly (I've tried both) a blank figure.
The first code is the following:
returns = np.linspace(0, 0.7, 50) volatility_opt = []

def GR(w):
    w = np.array(w)
    R = np.sum(meanlogReturns*w)
    return R

for R in returns:
    opt = minimize(minimizeMyvolatility, w0, method = 'SLSQP', bounds = bounds, constraints = constraints)
    constraints = ({'type': 'eq', 'fun': b},
                   {'type': 'eq', 'fun': lambda w: GR(w) - R})

def minimizeMyvolatility(w):
    w =np.array(w)
    V = np.sqrt(np.dot(w.T, np.dot(Sigma, w)))
    return V

volatility_opt.append(opt['fun'])

The scatter is working only without the plt.scatter() for volatility and returns:
plt.figure(figsize=(20,6))
plt.scatter(expectedVolatility,expectedReturn,c=sharpeRatio)
plt.xlabel('expected volatility')
plt.ylabel('expected log returns')
plt.colorbar(label='sharpe ratio')
plt.scatter(expectedVolatility[maxIndex],expectedReturn[maxIndex],c='red')
plt.scatter(volatility_opt,returns)
plt.show()

ValueError: x and y must be the same size


text:
Q: Using Text data type in Mysql I'm using Mysql with INNODB Engine and the row_format is Barracuda.
Now I have a table which has a PK column and lots of(about one hundred and eighty) columns with Text data type.
My question is If the table's data get large what will the main performance issue or any disadvantages?

A: If you just store data in those TEXT columns - it's acceptable. If you have indexes on those columns - use dictionary encoding for them.


text:
Q: Disadvantage of multilayer perceptron over CNN Suppose I train a binary classifier - a dog or not a dog, images are input, so the question is, let's say I use a multilayer perceptron as a classifier and suppose I train it using images of dogs whose face is in the center of the image, and then if I submit a photo of dog, on which her face is located in the corner, then the perceptron will not be able to correctly classify
But if I use CNN, then it will be able to recognize the dog in this case. Am I right?

A: Unfortunately this is not so simple. In short the answer is no, there is no guarantee this will happen. While MLP has a high-ish chance of failing, it does not have to, it depends what it ended up learning as discriminating factor. And symmetrically CNNs are not translation invariant (unless by CNN you mean lack of a single linear layer). They can fail if you move an object around, they are just less affected than MLPs.


text:
Q: Python program function I understand completely that I have to do this assignment on my own. BUT, I'm a bit confused about the language of this second question.
def getRVal(pressure_change,viscosity,length,radius, density , choice)
( this is what I've got so far)

A  function called getRVal that:
– Has six input parameters: pressure change, viscosity, length, radius, density and a final
parameter called choice ( ?; and
– returns a calculated value as determined by the value of the parameter choice.
If choice equals 1, return the maximum possible pressure drop for flow to be laminar.
If choice equals 2, return the minimum fluid viscosity required for flow to be laminar.
If choice equals 3, return the minimum tube length required for flow to be laminar.
If choice equals 4, return the maximum possible tube radius for flow to be laminar.
Note that when calculating each of these minimum/maximum values, the corresponding
input parameter will not be used in the function, so it does not matter what value is passed
in.
For example, when calculating minimum viscosity, the value of the viscosity parameter
is not used; when calculating maximum radius, the value of the radius parameter is not
used, and so on

A: your questions is asking you to make a function getFlow which accepts four arguments(pressure change, viscosity, length, and radius), the function getFlow is expected to make use of these arguments and calculate Hagen-Poiseuille flow rate in mL/sec and return this value.
something like
def getFlow(pressure_change, viscosity, length, radius):
    hagen_flow_rate= (formula to calculate flow rate)
    return hagen_flow_rate

#take input of the values

pressure_change = float(raw_input("Enter Pressure Change"))
viscosity = float(raw_input("Enter viscosity"))
length = float(raw_input("Enter length"))
radius = float(raw_input("Enter radius"))

#call the function here passing the values

getFlow(pressure_change, viscosity, length, radius)

A: You can define a function that takes several parameters easily, e.g:
def getFlow(p_c, visc, length, radius):
    #these 4 variables are now available in the function name space, use them
    flowrate = p_c*visc*length*radius #insert real formula here ;)
    return flowrate


text:
Q: cross site upload via iframe I have developed an api for image uploads and am using a jquery plugin which uploads the image via an iframe. But because the upload api's domain is different i cant access the return data in the iframe.
Is there a way to access this data in the iframe?

A: postMessage allows you to send messages across iframes via strings. You could base64 encode your image source if that's what you are asking.
Otherwise, you can't.
If you just need messaging, you can use hash polling technique or postMessage depending on what is supported.
Google these as there is in depth articles on them that would be kind of long to post on there, not that this is an adequate enough solution that I've posted but it should steer you in the right direction in terms of research.


text:
Q: error : Element input with attribute type whose value is button must have non-empty attribute value I am using joomla 2.5.8 with virtuemart 2.0.6. Upon w3 validation i get following error's :

Element input with attribute type whose value is button must have
  non-empty attribute value <input type="button"class="quantity-controls quantity-minus" />. Element input with
  attribute type whose value is button must have non-empty attribute
  value.

A: You must provide a value attribute for your button.
<input type="button" id="myButton" value="Click Here" />

if you don't want to display anything in it then use value=" "

A: You can try to use a <button> tag.
<button type="button" id="myButton">Click</button>

It is a valid markup for HTML5. If you need this button submit a form you can change the type to submit.
<button type="submit" id="myButton">Click</button>


text:
Q: How to use vue-select with b-pagination? I'm trying to work with pagination using the v-pagination component from bootstrap-vue. It's working more or less as I want, however when I click on a certain page the component is closing.

I would like to know how I can prevent v-select from closing before I select one of the options.
My code:
<v-select
    id="municipio"
    v-model="municipioState"
    :options="municipiosPaginaAtual"
    :filterable="false"
    placeholder="Selecione seu município"
    label="municipio"
    @search="buscarMunicipio"
>

    Selecione o Estado!

</v-select>

If there is a workaround or other option than v-select I would be pleased to know.

A: you can use @mouseup.native.capture.stop in the b-pagination tag to prevent closing the dropdown of the vue-select.
Also, in my opinion, you can use vue-multiselect for a better user experience, but it's up to you and your need. I just wanted to suggest it to you as another option.
I provided a simple snippet to show this:

Vue.component("v-select", VueSelect.VueSelect);

new Vue({
  el: '#app',
  data() {
    return {
      books: [{
          title: "Old Man's War"
        },
        {
          title: "The Lock Artist"
        },
        {
          title: "HTML5"
        },
        {
          title: "Right Ho Jeeves"
        },
        {
          title: "The Code of the Wooster"
        },
        {
          title: "Thank You Jeeves"
        }
      ],
      perPage: 2,
      currentPage: 1,
      rows: 6
    }
  },
})
<link href="https://unpkg.com/vue-select@3.16.0/dist/vue-select.css" rel="stylesheet"/>

<link type="text/css" rel="stylesheet" href="https://unpkg.com/bootstrap@4.5.3/dist/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="https://unpkg.com/bootstrap-vue@2.21.2/dist/bootstrap-vue.css" />

  <v-select :options="books" label="title">

  </v-select>


text:
Q: error when starting android kivy app using mediapipe this is my first entry here means i am also thankful for any advice on how i can improve my postings here.
I am working on an app written in python which i want to build also for Android devices.For this purpose i have:

*

*Setup an Ubuntu 20.4 VM

*Installed  and configured buildozer

*Written the app with the kivy framework

Building Android APK files with this setup works quit fine for smaller kivy apps with only basic functionalities and dependencies. Unfortunately i also need Googles pose estimation Mediapipe https://mediapipe.dev/.
When i try to run the App on my Android device
Samsung Galaxy S10+ : CPU Architecture ARMv8-A / arm64-v8a
i receive the following error:
Logfile
[11-28 19:27:08.240 14013:30612 I/python]
ImportError: dlopen failed: "/data/user/0/sens.app.sensaiapp/files/app/_python_bundle/site-packages/mediapipe/python/_framework_bindings.so" is for EM_X86_64 (62) instead of EM_AARCH64 (183)
Respective Entry in the Buildozer config file:
requirements = python3,kivy,opencv,pandas,numpy,mediapipe,android
(str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
android.arch = arm64-v8a
I have also tried to build mediapipe according to the following guidelines:
https://github.com/jiuqiant/mediapipe_python_aarch64/blob/main/README.md
Unfortunately this didnt solve the issue and i couldnt find any related issues online so i am stuck now.
Means i would be really thankfull if anyone has faced the same issue and give me a hint towards the right solution.Let me know if there is further information i need to provide to draw the full picture for you.
Thanks in advance!


text:
Q: Meaning of extended audiotape. What does "extended audiotape" means? I found the meaning for "extended" and found out that it means "prolonged". Then does "extended audiotape" mean a tape that plays for long time?

A: This is the Amazon link for the extended version of the Hobbit movies. They were called extended because they had additional scenes than the movies that were released in theaters.
Although it would be easier with context, from your question, I am assuming that the audiotape was released, and then released as an extended audiotape, which was longer than the original.


text:
Q: When does NHibernate JoinQueryOver load full collection? I've got a model where a Person has a lazy-loaded collection of Registrations.  My NHibernate 3.3.3 query uses JoinQueryOver across that relation and some more:
var reg = Session.QueryOver<Person>()
    .Where(p => p.ID == pid)
    .JoinQueryOver<Registration>(p => p.Registrations)
    .Where(r => r.IsDropped == false)
    .JoinQueryOver<Slot>(r => r.Slot)
    .JoinQueryOver<Position>(s => s.Position)
    .JoinQueryOver<AcademicTerm>(p => p.Term)
    .Where(t => t.ID == currentTerm.ID)
    .SingleOrDefault();

In the log, I see the expected SQL for the query, and I get the expected Person instance, but when I access the Registrations collection, the full collection of registrations gets (lazy) loaded.  I was expecting it would just be a partial collection of the registrations that meet the criteria.
In a previous question, I had the opposite problem, and fixed it by adding a Fetch() clause to the query.
When does a JoinQueryOver criterion cause the root entity to have a partial collection, and when does it have an unloaded collection that will get lazy loaded?  I feel like I should understand this.
My fluent mapping for Person:
public class PersonMapping : ClassMap<Person>
{
    public PersonMapping()
    {
        Id(x => x.ID).GeneratedBy.Guid();
        Map(x => x.Username).Length(20).Unique();
        Map(x => x.HashedPassword).Length(Security.HashedPasswordEncodedLength);
        Map(x => x.PasswordSalt).Length(Security.PasswordSaltEncodedLength);
        Map(x => x.LastName).Length(25).Index("FullName");
        Map(x => x.FirstName).Length(20).Index("FullName");
        Map(x => x.StudentID).Length(12).Nullable();
        Map(x => x.EmployeeID).Length(12).Nullable();
        Map(x => x.EmailAddress).Length(72);
        Map(x => x.IsAdmin).Nullable();
        Map(x => x.IsAgencyStaff).Nullable();
        Map(x => x.IsCenterStaff).Nullable();
        Map(x => x.IsFaculty).Nullable();
        Map(x => x.IsRegistrant).Nullable();
        Map(x => x.IsStudent).Nullable();

        Map(x => x.Type);
        Map(x => x.AuthenticationMode);

        HasMany<Registration>(x => x.Registrations).KeyColumn("Registrant_id")
            .LazyLoad()
            .AsBag()
            .Inverse()
            .Access.CamelCaseField(Prefix.Underscore)
            .Cascade.SaveUpdate();
    }
}

Update
Comparing this with my other question (linked above), where I had the opposite problem, that one uses a Left.JoinQueryOver to get from the base entity to the collection.  I tried that here, and then got the expected partial collection.  (I don't actually need the left join in the other case; I don't remember why it's there.)
The records fetched are the same with or without the left join, but NHibernate populates the collection in one case, and not in the other.  I doubt that's behavior I can depend on, so I've changed my strategy to query for the registrations separately.

A: This condition in the QueryOver:
...
.JoinQueryOver<Registration>(p => p.Registrations)
.Where(r => r.IsDropped == false)
...

Is in fact a WHERE clause for a Person. I mean, this condition is deciding if there is such a Person, having at least one Registration which is NOT dropped. It is not a way, how to filter the Registration colleciton. BUT:
NHibernate has two nice ways how to filter collections themselves. These are where clause and filter.
1. where clause
Easily said: we can extend the collection mapping, whit a SQL Statement, which will be always added as a where condition. See where 6.2. Mapping a Collection, extract:

where="arbitrary sql where condition"
  == (optional) specify an arbitrary SQL WHERE condition to be used when retrieving or removing the collection (useful if the collection should
  contain only a subset of the available data)

so in our case the mapping:
HasMany<Registration>(
  ...
  .Where("IsDropped = 0"); // SQL Statement

2. filter setting
While where clause is static, baked into the assembly/mapping... filter is a way how to do that dynamically. So just imagine, that we would sometimes like to have a set of Registrations, which are dropped, next time, which are not dropped.
We would like to be able to change "IsDropped = 0" to "IsDropped = 1" (better scenario could be switch by culture or lang). And that's where the filter could be applied, see 18.1. NHibernate filters
There is a small draft of the filter stuff with fluent, see the links below to get a complete picture.
HasMany
  ...
  .ApplyFilter<MyFilter>()

And filter could be like:
public class MyFilter: FilterDefinition
{
    public MyFilter()
    {
        WithName("dropped")
          .WithCondition("IsDropped == :isDropped")
          .AddParameter("isDropped", NHibernate.NHibernateUtil.Boolean);
    }
}

And finally, we can enable the Filter for a whole session (coool, all collections will be filtered the same way in that transaction/session, all collection mapped with MyFilter)
session.EnableFilter("dropped").SetParameter("isDropped", false);

See more here:

*

*Syntax to define a NHibernate Filter with Fluent Nhibernate (NOT Accepted answer)

*How do you do additional filtering on a HasMany mapping in Fluent nHibernate?


text:
Q: How to have a clickable button I have a text link as "Click Me To Get There" that I transformed into a button via CSS.
This is what I used successfully:

.product-buttons-container {
  background-color: #ff6347;
  padding: 11px 24px;
  line-height: 17px;
  border-radius: 35px;
  cursor: pointer;
  text-align: center;
}

.product-buttons-container:hover {
  background-color: #E5423A;
}
Click Me To Get There

The problem with that is that only the text still has the "a" tag with the destination URL. The area of the button is just look-and-feel and, although on mouse-hover the cursor change as pointer there is no link in the button padding.
What am I missing in order to get a fully clickable button?

A: The  tag has display: inline as default. You can make it display: inline-block or display: block to adjust the size of the element. As user Terry already pointed out, you can use cursor: pointer to style the cursor (it won't be necessary though if you use an  tag.)
You can either:
Style the  itself like a button

.button-link {
  padding: 10px;
  border-radius: 10px;
  background: silver;
  text-decoration: none;
  color: black;
}
I can be a button, too

Wrap the <button> with a link element

.button-link {
  background-color: silver;
}

button {
  border: none;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
}
<button>I am clickable</button>

Use <button> with JS and onclick (not recommended)

document.body.onload = function() {
  let buttons = document.querySelectorAll('[data-link]');
  for (let i = 0; i < buttons.length; i++) {
    let button = buttons[i];
    button.onclick = function() {
      window.location.href = button.dataset.link;
    }
  }
}();
.button {
  padding: 10px;
  border: none;
  border-radius: 10px;
  background-color: silver;
  cursor: pointer;
}
<button class="button" data-link="https://www.google.com">I am a link, too</button>

You don't even have to use  or <button> you could link whatever element you like. You can always add a link with the onclick attribute in javascript.
Here is a link in a bigger context:

.button {
  display: inline-block;
  margin: 0 20px;
  width: 100px;
  padding: 10px;
  border: 2px solid #333;
  border-radius: 10px;
  background-color: silver;
  color: #000;
  text-decoration: none;
}

.button:hover {
  background-color: #eaeaea;
}

This represents some text on a website la-di-da
  this whole box shall be linked and act like a button and after the link it just goes on ...

Some other paragraph


text:
Q: Manually retry an sqs failed job with shoryuken I'm currently building an admin dashboard to monitor our SQS queues, inspired by this medium post.
I managed to have everything working fine with this code in my custom shoryuken middelware :
class DashboardMiddleware
  def call(worker_instance, queue, sqs_msg, body)
    redis = Redis.new(url: ENV['REDIS_DASHBOARD_URL'])
    check_if_already_failed(redis, sqs_msg.attributes['SentTimestamp'].to_i)
    redis.incr("sqs-dashboard-enqueued")
    yield
    redis.incr("sqs-dashboard-consumed")
  rescue Exception => e
    data =     {
      id: sqs_msg.attributes['SentTimestamp'].to_i,
      worker: worker_instance.class.to_s,
      queue: queue,
      error: e,
      attributes: sqs_msg.attributes,
      receipt_handle: sqs_msg.receipt_handle,
      body: body,
      enqueued_at: Time.at(sqs_msg.attributes['SentTimestamp'].to_i / 1000)
    }.to_json
    redis.lpush("sqs-dashboard-failures", data)
    raise e
  end

  def check_if_already_failed(redis, job_id)
    jobs = redis.lrange("sqs-dashboard-failures", 0, -1).map { |job| JSON.parse(job) }
    i = 0
    g = nil
    jobs.each do |j|
      g = i if j["id"] == job_id
      i += 1
    end
    unless g.nil?
      redis.lset("sqs-dashboard-failures", g, "DELETED")
      redis.lrem("sqs-dashboard-failures", 1, "DELETED")
    end
  end
end

So i display all my failed jobs in my admin dashboard, and details about the error. That was first step. Now i would like to be able to retry manually thoses jobs (one at the time to begin with). I've been searching around the web for a long time now, and didn't find anything to do that (with shoryuken or directly with sqs sdk).
Does anyone have a clue to manually retry a failed message ?
We already gave a look at dead-letter queues, but we would prefer not to use them.
Thanks a lot for any tips or starting point :)


text:
Q: Get matched element from the selectors used in jquery.is function $("#see1, #seeAlso1, .see").is(':checked')

The above code will return a boolean value. Is there any way to get first matched element which will return 'true'....?

A: You can use the :checked selector along with first(), to get the first found element in the page:
var $el = $("#see1:checked, #seeAlso1:checked, .see:checked").first();

A: You can use $.each:
function getFirstChecked() {
    var firstChecked = null;

    $("#see1, #seeAlso1, .see").each(function(this, index){
        var $this = $(this);

        if ($this.is(':checked')) {
            firstChecked = $this;
        }
    });

    return firstChecked;
}

Edit:
Better solution:
$("#see1, #seeAlso1, .see").filter(':checked').eq(0);


text:
Q: iOS7: Pop-up picker on touch of a button (with blurred background) What I'm trying to figure out is how to pop-up a PickerView from the bottom of the screen when I press a button. And a blurred background would be nice ;D
I saw some setting the inputView of a textfield but as I got no textfield I can't do that.
Here's a screenshot from the iTunes Store where they do it exactly how I want it to be:
http://dl.dropboxusercontent.com/s/1bs30sz2ovmk0oa/screen.png

A: Create a UIViewController with UIPickerView in the storyboard and set an identifier.
Connect the button to it and choose view/push (depends if you want to cover the entire screen or not). once it's called you can change the setting of how it will appear.
You can get the UIViewController from the storyboard like this:
     UIViewController  *viewController = [self.storyboard instantiateViewControllerWithIdentifier:vcName];

You can also save a property in your UIViewController of a UIView which contains a UIPickerView.
Once the button is pressed call a method which fade/slide the view with animation inside.
   [UIView beginAnimations:nil context:NULL];
   [UIView setAnimationDuration:0.30];
        self.pikerView.frame = CGRectMake(100,100,SCREEN_WIDTH,300); //something like that
   [UIView commitAnimations];


text:
Q: jQuery jPlayer issue in IE I have an issue, following code is not working in Internet Explorer:

    ...

    mute
    unmute

    ...

Unfortunately it doesn't even alert me something.. :(
Has anybody any hints?

A: There maybe couple issues going on here...
1. Make sure your path to  swfPath: "js/" file is correct. It should point to a swf file for IE to work. I used fiddler to see if it was getting a 404 error when downloading the swf file.

*

*There is an extra comma after the mp3 assignment.

*This is a suggestion but you can turn errorAlerts to true.
$(document).ready(function() {

$("#jquery_jplayer").jPlayer({
ready: function () {
    // alert("test");
    $(this).jPlayer("setMedia", {
        mp3:"media/music.mp3"
    }).jPlayer("play");
},
swfPath: "/jquery-jplayer/something.swf", ---not sure what this path will be
solution: "flash, html",
supplied: "mp3",
wmode: "window",
loop: "true",
errorAlerts:"true"
});

});

A: This is IE picking up on your comma after mp3" - remove that and it will work fine
       $("#jquery_jplayer").jPlayer({
          ready: function () {
            // alert("test");
            $(this).jPlayer("setMedia", {
                mp3:"media/music.mp3"    // <--- Remove the comma
            }).jPlayer("play");
        },


text:
Q: javascript - One image in an array is not loading I'm having a bit of trouble when preloading images in an array to later be drawn on a canvas (like a 2D top-down game board). However, it seems like one of these images (Greyscale GIFs, btw) refuses to load. I know it is one because when using an example from somewhere to count down the remaining images, it stops if set to 256, but will continue if set to 255.
var xhttp = new XMLHttpRequest() || new ActiveXObject("Microsoft.XMLHTTP");
var xmlDoc;
var canvas = document.getElementById("leveldraw");
var displayLevel = document.getElementById("leveldisp");
var levelList = document.getElementById("level");
var setlayer1 = document.getElementById("layer1");
var setlayer2 = document.getElementById("layer2");
var setlayer3 = document.getElementById("layer3");
var setlayer4 = document.getElementById("layer4");
var setmarkings = document.getElementById("marks");
var objects = [];

xhttp.onreadystatechange = function()
{
    if (xhttp.readyState == 4 && xhttp.status == 200)
    {
        xmlDoc = xhttp.responseXML;
        preloadImages()
    }
};
xhttp.open("GET", "levels.xml", true);
xhttp.send();

if(canvas.getContext)
{
    var ctx = canvas.getContext("2d");
}

function preloadImages()
{
    var img;
    var remaining = 256;
    for(var i=0; i<256; i=i+1)
    {
        img = new Image();
        img.onload = function()
        {
            --remaining;
            document.getElementById("loader").innerHTML = "Loading: " + parseInt((1-(remaining/256))*100) + "%";
            if(remaining<=0)
            {
                ChangeLevel();
            }
        };
        img.src = "objects/img" + ("00" + i.toString(16)).slice(-2) + ".gif";
        objects.push(img);
    }
}

function ChangeLevel()
{
    document.getElementById("loader").innerHTML = "Loading...";
    var levelnumber = levelList.selectedIndex;
    var width=xmlDoc.getElementsByTagName("width")[levelnumber].childNodes[0].nodeValue;
    var height=xmlDoc.getElementsByTagName("height")[levelnumber].childNodes[0].nodeValue;
    var layout=xmlDoc.getElementsByTagName("layout")[levelnumber].childNodes[0].nodeValue;
    var type=xmlDoc.getElementsByTagName("type")[levelnumber].childNodes[0].nodeValue;
    var layer0data=xmlDoc.getElementsByTagName("layer0")[levelnumber].childNodes[0].nodeValue;
    var layer1data=xmlDoc.getElementsByTagName("layer1")[levelnumber].childNodes[0].nodeValue;
    var layer2data=xmlDoc.getElementsByTagName("layer2")[levelnumber].childNodes[0].nodeValue;
    var layer3data=xmlDoc.getElementsByTagName("layer3")[levelnumber].childNodes[0].nodeValue;
    canvas.width=width*16;
    canvas.height=height*16;
    ctx.fillStyle = "#FFFFFF";
    ctx.fillRect(0,0,canvas.width,canvas.height);
    if(layer1.checked==true)
    {
        console.log("layer1");
        var i=1;
        for(var y=0; y<height; y=y+1)
        {
            for(var x=0; x<width; x=x+1)
            {
                try {
                    ctx.drawImage(objects[parseInt(layer0data.substring(i,i+2),16)],x*16,y*16);
                } catch(err) {
                    console.log(err.message + " at " + ("00" + x).slice(-2) + "x" + ("00" + y).slice(-2) + " obj:" + layer0data.substring(i,i+2));
                }
                i=i+2;
            }
        }
    }
    if(layer2.checked==true)
    {
        console.log("layer2");
        var i=1;
        for(var y=0; y<height; y=y+1)
        {
            for(var x=0; x<width; x=x+1)
            {
                try {
                    ctx.drawImage(objects[parseInt(layer1data.substring(i,i+2),16)],x*16,y*16);
                } catch(err) {
                    console.log(err.message + " at " + ("00" + x).slice(-2) + "x" + ("00" + y).slice(-2) + " obj:" + layer1data.substring(i,i+2));
                }
                i=i+2;
            }
        }
    }
    if(layer3.checked==true)
    {
        console.log("layer3");
        var i=1;
        for(var y=0; y<height; y=y+1)
        {
            for(var x=0; x<width; x=x+1)
            {
                try {
                    ctx.drawImage(objects[parseInt(layer2data.substring(i,i+2),16)],x*16,y*16);
                } catch(err) {
                    console.log(err.message + " at " + ("00" + x).slice(-2) + "x" + ("00" + y).slice(-2) + " obj:" + layer2data.substring(i,i+2));
                }
                i=i+2;
            }
        }
    }
    if(layer4.checked==true)
    {
        console.log("layer4");
        var i=1;
        for(var y=0; y<height; y=y+1)
        {
            for(var x=0; x<width; x=x+1)
            {
                try {
                    ctx.drawImage(objects[parseInt(layer3data.substring(i,i+2),16)],x*16,y*16);
                } catch(err) {
                    console.log(err.message + " at " + ("00" + x).slice(-2) + "x" + ("00" + y).slice(-2) + " obj:" + layer3data.substring(i,i+2));
                }
                i=i+2;
            }
        }
    }
    document.getElementById("loader").innerHTML = "";
}

Any ideas why this is happening? Been reuploading the same GIF over and over (imgad.gif).

A: Because the image file name is imgad.gif, most AdBlockers block it, because of the ad part.... Renaming the image should solve it.

A: SOLUTION: Never use hexadecimals because the number AD can be blocked by Adblockers.
Thanks to Philip for discovering that.


text:
Q: Syntax error on WITH clause I am working on a web app and there are some long winded stored procedures and just trying to figure something out, I have extracted this part of the stored proc, but cant get it to work. The guy who did this is creating alias after alias.. and I just want to get a section to work it out. Its complaining about the ending but all the curly brackets seem to match. Thanks in advance..
FInputs is another stored procedure.. the whole thing is referred to as BASE.. the result of this was being put in a temp table where its all referred to as U. I am trying to break it down into separate sections.
;WITH Base AS
(
SELECT
    *
FROM F_Inputs(1,1,100021)
),
U AS
(
SELECT
    ISNULL(q.CoverPK,r.CoverPK) AS CoverPK,
    OneLine,
    InputPK,
    ISNULL(q.InputName,r.InputName) AS InputName,
    InputOrdinal,
    InputType,
    ParentPK,
    InputTriggerFK,
    ISNULL(q.InputString,r.InputString) AS InputString,
    PageNo,
    r.RatePK,
    RateName,
    Rate,
    Threshold,
    ISNULL(q.Excess,r.Excess) AS Excess,
    RateLabel,
    RateTip,
    Refer,
    DivBy,
    RateOrdinal,
    RateBW,
    ngRequired,
    ISNULL(q.RateValue,r.RateValue) AS RateValue,
    ngClass,
    ngPattern,
    UnitType,
    TableChildren,
    TableFirstColumn,
    parentRatePK,
    listRatePK,
    NewParentBW,
    NewChildBW,
    ISNULL(q.SumInsured,0) AS SumInsured,
    ISNULL(q.NoItems,0) AS NoItems,
    DisplayBW,
    ReturnBW,
    StringBW,
    r.lblSumInsured,
    lblNumber,
    SubRateHeading,
    TrigSubHeadings,
    ISNULL(q.RateTypeFK,r.RateTypeFK) AS RateTypeFK,
    0 AS ListNo,
    0 AS ListOrdinal,
    InputSelectedPK,
    InputVis,
    CASE
        WHEN ISNULL(NewChildBW,0) = 0
        THEN 1
        WHEN q.RatePK is NOT null
        THEN 1
        ELSE RateVis
    END AS RateVis,
    RateStatus,
    DiscountFirstRate,
    DiscountSubsequentRate,
    CoverCalcFK,
    TradeFilter,
    ngDisabled,
    RateGroup,
    SectionNo
FROM BASE R
LEFT JOIN QuoteInputs Q
    ON q.RatePK = r.RatePK
    AND q.ListNo = 0
    AND q.QuoteId = 100021 )

A: Well, I explained the issue in the comments section already. I'm doing it here again, so future readers find the answer more easily.
A WITH clause is part of a query. It creates a view on-the-fly, e.g.:
with toys as (select * from products where type = 'toys') select * from toys;

Without the query at the end, the statement is invalid (and would not make much sense anyhow; if one wanted a permanent view for later use, one would use CREATE VIEW instead).


text:
Q: how to retrieve the class from pagemethod in javascript I would like to use Pagemethod to return the class to javascript. Does it need to create the same construction of the class on the both sides, client and server sides?

A: I figured out. I use the following code on vb.net
  <WebMethod()> _
      Public Shared Function checkTime(ByVal ID As Integer) As Integer()

      Do something and return the value
      End Function

On javascript calling the method:
 PageMethods.checkTime(ID, OncheckTimeComplete, OncheckTimeError, senderInfo);


text:
Q: AVCaptureMetadataOutputObjectsDelegate, DidOutputMetadataObjects not always called I trying to scan QR-codes in my app. It works sometimes and sometimes not. The feeling is that it doesn't work when something is loading on another thread. For example, if I press the scan button when nearby stores still are loading. Often it works if I wait.
The video capture is working because I will see the preview.
Here is my code:
    private bool resultFound;

    public ScannerView()
    {
        InitializeComponent();

        On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(false);

        view = new UIView();
        ScannerArea.Children.Add(view);
    }

    void HandleAVRequestAccessStatus(bool accessGranted)
    {
        if (!accessGranted)
        {
            MainThread.BeginInvokeOnMainThread(async () =>
            {
                await NavigationHelper.Current.CloseModalAsync();
            });
        }

        metadataOutput = new AVCaptureMetadataOutput();

        var metadataDelegate = new MetadataOutputDelegate();
        metadataOutput.SetDelegate(metadataDelegate, DispatchQueue.MainQueue);

        session = new AVCaptureSession();

        camera = AVCaptureDevice.DevicesWithMediaType(AVMediaType.Video).First();

        input = AVCaptureDeviceInput.FromDevice(camera);
        session.AddInput(input);

        session.AddOutput(metadataOutput);

        metadataOutput.MetadataObjectTypes = AVMetadataObjectType.QRCode | AVMetadataObjectType.EAN8Code | AVMetadataObjectType.EAN13Code;

        metadataDelegate.MetadataFound += MetadataDelegate_MetadataFound;

        camera.LockForConfiguration(out var error);
        camera.VideoZoomFactor = 2;
        camera.UnlockForConfiguration();

        layer = new AVCaptureVideoPreviewLayer(session);
        layer.VideoGravity = AVLayerVideoGravity.ResizeAspectFill;

        layer.MasksToBounds = true;

        layer.Frame = UIApplication.SharedApplication.KeyWindow.RootViewController.View.Bounds;

        view.Layer.AddSublayer(layer);

        session.StartRunning();
    }

    protected override void OnAppearing()
    {
        base.OnAppearing();

        var status = AVCaptureDevice.GetAuthorizationStatus(AVMediaType.Video);

        if (status != AVAuthorizationStatus.Authorized)
        {
            MainThread.BeginInvokeOnMainThread(() =>
            {
                AVCaptureDevice.RequestAccessForMediaType(AVMediaType.Video, HandleAVRequestAccessStatus);
            });

            return;
        }

        HandleAVRequestAccessStatus(true);
    }

    protected override void OnDisappearing()
    {
        base.OnDisappearing();

        session.StopRunning();
        session.RemoveInput(input);

        session = null;
    }

    void Handle_Clicked(object sender, System.EventArgs e)
    {
        NavigationHelper.Current.CloseModalAsync();
    }

    void MetadataDelegate_MetadataFound(object sender, AVMetadataMachineReadableCodeObject e)
    {
        if (resultFound)
        {
            return;
        }

        resultFound = true;

        var text = e.StringValue;

        Device.BeginInvokeOnMainThread(async () =>
        {
            Vibration.Vibrate(100);
            await NavigationHelper.Current.CloseModalAsync();
            TinyPubSub.Publish(NavigationParameter.ToString(), text);
        });
    }

}

public class MetadataOutputDelegate : AVCaptureMetadataOutputObjectsDelegate
{
    public override void DidOutputMetadataObjects(AVCaptureMetadataOutput captureOutput, AVMetadataObject[] metadataObjects, AVCaptureConnection connection)
    {
        foreach (var m in metadataObjects)
        {
            if (m is AVMetadataMachineReadableCodeObject)
            {
                MetadataFound(this, m as AVMetadataMachineReadableCodeObject);
            }
        }
    }

    public event EventHandler<AVMetadataMachineReadableCodeObject> MetadataFound = delegate { };
}


text:
Q: Solving a system of equations with constraints in specific order This code gives about 1000 solutions for the variables a,b,c,d,e,f,g,h:
Solve[{
Max[{a, b, c, d, e, f, g, h}] == 14,
Min[{a, b, c, d, e, f, g, h}] == 1,
Total[{a, b, c, d, e, f, g, h} - Sort[{a, b, c, d, e, f, g, h}]] ==
0,
a == 11, h == 4,
a + h == 15, b + g == 15, c + f == 15, d + e == 15,
a + b + c + d + e + f + g + h == 60
},
{a, b, c, d, e, f, g, h}, Integers]

I would like to add the further constraints, ie:
Mod[a, 2] > 0, Mod[b, 2] == 0, Mod[c, 3] > 0, etc
However if I add those constraints into the code above it seems very inefficient and slow.  Is there a way to select the order that constraints are applied, or use the output of Solve as input to another Solve[] with more constraints?  Thanks.
cheers,
Jamie
(update1, edited twice)
In your version 3 code, the 5 equations:
Abs[Total[Table[v[[i]],{i,n/2}]]-Total[Table[v[[i]],{i,n/2+1,n}]]]==
Abs[Total[Take[v,n/2]]-Total[Drop[v,n/2]]]==
Abs[Total[Take[v,n/2]]-(35*24-Total[Take[v,n/2]])]==
Abs[Total[Take[v,n/2]]-35*24+Total[Take[v,n/2]]]==
Abs[2*Total[Take[v,n/2]]-35*24]

I verified those 5 equations are all equal for n=48.  After replacing 35 and 24 with the correct values for n, (ie for n=48: 35=constant2 = constant1/(n/2)).  The output of those 5 equations is = constant5:
n=8:
all five equations equal: 16 (16=8*2)
n=48:
all five equations equal: 192 (192=48*4)
n=480:
all five equations equal: 3840 (3840=480*8)
n=5760:
all five equations equal: 552960 (552960=5760*96)
For n=8,48,480,5760,... I think that gives the sequence 2,4,8,96,... = OEIS A058262.
Also for the product of prime factors > 2 in 192,3840,552960,...:
3, 3x5=15, 3x3x3x5=135,.. gives 3,15,135 which is OEIS A059861 I think.
I have to convert a lot of the other patterns into equations still, may be a couple days but will work on it.  If you are interested to see the patterns I have a word doc I could email.

A: (*Version 1*)
Clear[a,b,c,d,e,f,g,h];
sol={a,b,c,d,e,f,g,h}/.Solve[{
  Max[{a, b, c, d, e, f, g, h}] == 14,
  Min[{a, b, c, d, e, f, g, h}] == 1,
  a == 11, h == 4, b + g == 15, c + f == 15, d + e == 15},
  {a, b, c, d, e, f, g, h},Integers
];
Select[sol,({a,b,c,d,e,f,g,h}=#; Mod[b, 2] == 0 && Mod[c, 3] > 0 (*&&etc*))&]

If you can complete the work on all equations for n==8 and describe what form you want the code to be in to directly generate the result then I will see what I can do. Thanks.
Begin to generalize for any even n variables.
Thank you for the pastebin, that was essential for doing this.
(*Version 2*)
n=8;(*must be even*)
vars=Table[v[i],{i,1,n}];
cons=Join[
  { Total[vars - Sort[vars]] == 0,(*I think this line is always true*)
    Abs[Total[Take[vars,n/2]]-Total[Drop[vars,n/2]]]==16,(*Is there a formula of n to replace 16 *)
    v[n-1]>0
  },
  Table[v[i]+v[n-i+1]==15,{i,1,n/2}],
  { Total[Table[v[i],{i,1,n}]]==60 },(*Is there a formula of n to replace 60*)
  Table[v[i]-v[i+1]==v[n-i]-v[n-i+1],{i,1,n/2-1}],
  { v[4]-v[5]==v[2]-v[3],
    v[4]-v[5]==v[6]-v[7],
    v[1]-v[8]==7,
    v[8]-v[1]== -7},
  { Total[Abs[Table[v[i]-v[i+1],{i,1,n-1}]]]==35}
];
sol=vars/.Solve[cons,  vars,Integers]
(* returns {{11, 2, 1, 8, 7, 14, 13, 4}} *)

Please check to see if your code returns the same result and if not then let me know what the result should be.
Revised
(*Version 3*)
n = 48;
(* Goal
v = {27, -18, 1, 4, 23, 26, 13, 32, 19, 22, 41, 44,
     31, 18, 37, 24, 27, 46, 33, 36, 23, -6, -3, 16,
     19, 38, 41, 12, -1, 2, -11, 8, 11, -2, 17, 4,
     -9, -6, 13, 16, 3, 22, 9, 12, 31, 34, 53, 8};
*)

(*Verify that this returns True so that doesn't seem to solve for any unknowns*)
v=Table[x[i],{i,n}];
Total[Total[Table[v[[i]]-Sort[Table[v[[i]],{i,n}]],{i,n}]]] == 0

(*Verify this is correct*)
Table[v[[i]]+v[[n-i+1]]==constant2,{i,n/2}];
(*so*)
Table[v[[n-i+1]]==35-v[[i]],{i,n/2}];
(*so*)
Reverse[Table[v[[n-i+1]]==35-v[[i]],{i,n/2}]];
(*so this reduces 48 unknowns to 24 unknowns*)
Join[Table[x[i],{i,n/2}],Reverse[Table[35-v[[i]],{i,n/2}]]];

v={x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12],
 x[13], x[14], x[15], x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[24],
 35-x[24], 35-x[23], 35-x[22], 35-x[21], 35-x[20], 35-x[19], 35-x[18], 35-x[17],
 35-x[16], 35-x[15], 35-x[14], 35-x[13], 35-x[12], 35-x[11], 35-x[10], 35-x[9],
 35-x[8], 35-x[7], 35-x[6], 35-x[5], 35-x[4], 35-x[3], 35-x[2], 35-x[1]};

(*Verify this returns True so that doesn't seem to solve for any unknowns*)
Total[v]==840

(*Verify this returns True so that doesn't seem to solve for any unknowns*)
Total[v]==Total[Table[v[[i]],{i,n/2-n/4+1,n/2+n/4}]]*2

(*Verify this returns True so that doesn't seem to solve for any unknowns*)
Total[Table[v[[i]],{i,n/2-n/4+1,n/2+n/4}]]==Total[Table[v[[i]],{i,n/2-n/8+1,n/2+n/8}]]*2

(*Verify this returns {True,True,True...} so that doesn't seem to solve for any unknowns*)
Table[v[[i]]-v[[i+1]]==v[[n-i]]-v[[n-i+1]], {i,n/2-1}]

(*Verify this returns x[1]==27*)
Total[Table[v[[i]]-v[[i+1]],{i,1,n-1}]]==19//Simplify

(*Verify this returns x[1]==27*)
v[[1]]-v[[n]]==19//Simplify

(*Verify this returns x[1]==27*)
v[[n]]-v[[1]]== -19//Simplify

(*Verify this returns 35+x[22]==x[23]+2*x[24]*)
v[[n/2]]-v[[n/2+1]]==v[[n/2-2]]-v[[n/2-1]]//Simplify

(*Verify this returns 35+x[22]==x[23]+2*x[24]*)
v[[n/2]]-v[[n/2+1]]==v[[n/2+2]]-v[[n/2+3]]//Simplify

Min[Table[v[[i]]-v[[i+1]],{i,n-1}]]== -19

Max[Table[v[[i]]-v[[i+1]],{i,n-1}]]==45

Total[Abs[Table[v[[i]]-v[[i+1]],{i,n-1}]]]==641

Abs[Total[Table[v[[i]],{i,n/2}]]-Total[Table[v[[i]],{i,n/2+1,n}]]]==192

(*Verify this is correct*)
Abs[Total[Table[v[[i]],{i,n/2}]]-Total[Table[v[[i]],{i,n/2+1,n}]]]==
Abs[Total[Take[v,n/2]]-Total[Drop[v,n/2]]]==
Abs[Total[Take[v,n/2]]-(35*24-Total[Take[v,n/2]])]==
Abs[Total[Take[v,n/2]]-35*24+Total[Take[v,n/2]]]==
Abs[2*Total[Take[v,n/2]]-35*24]
(*I think I can verify everything except the last line of that
  and the last line of that seems like it should also be correct.
  This should simplify even further and possibly solve for no more variables.*)

(*This seems to simplify the problem as much as I can see to do now*)
n=48;
v={x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12],
 x[13], x[14], x[15], x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[24],
 35-x[24], 35-x[23], 35-x[22], 35-x[21], 35-x[20], 35-x[19], 35-x[18], 35-x[17],
 35-x[16], 35-x[15], 35-x[14], 35-x[13], 35-x[12], 35-x[11], 35-x[10], 35-x[9],
 35-x[8], 35-x[7], 35-x[6], 35-x[5], 35-x[4], 35-x[3], 35-x[2], 35-x[1]};
Reduce[{x[1]==27,35+x[22]==x[23]+2*x[24],
 Min[Table[v[[i]]-v[[i+1]],{i,n-1}]]== -19,
 Max[Table[v[[i]]-v[[i+1]],{i,n-1}]]==45,
 Total[Abs[Table[v[[i]]-v[[i+1]], {i,n-1}]]]==641,
 Abs[Total[Table[v[[i]],{i,n/2}]]-Total[Table[v[[i]],{i,n/2+1,n}]]]==192},
 {x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12],
  x[13], x[14], x[15], x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[24]}]

But that is still 24 unknowns and only 6 equations. And it seems to run forever. It might, but there is no guarantee, be faster if there were another 18 reasonably simple equations constraining the solution. But the Min and Max and Abs mean that some methods of speeding this up cannot be used.
Please check all this carefully and see if you can find any mistakes that I have made. If you bookmark this page and check it every day or so then I will increment the version number on the code when I make any substantial change given your input and we will see if we can get you the last few steps to your solution. If you keep checking the version number then I don't have to add "more revision" comments and there is a small limit on the number of comments before they start trying to push this off into another chat page. You can edit your original post and add version numbers and updates to the end of that. I will check that every day. Thanks

A: Does this work?
sol = Solve[{Max[{a, b, c, d, e, f, g, h}] == 14, Min[{a, b, c, d, e, f, g, h}] == 1,
    Total[{a, b, c, d, e, f, g, h} - Sort[{a, b, c, d, e, f, g, h}]] == 0, a == 11, h == 4,
    a + h == 15, b + g == 15, c + f == 15, d + e == 15,
    a + b + c + d + e + f + g + h == 60}, {a, b, c, d, e, f, g, h}, Integers];

sol2 = sol[[Flatten[Position[Mod[a, 2] > 0 && Mod[b, 2] == 0 && Mod[c, 3] > 0 /. sol, True]]]];

Dimensions[sol2]
(* {404, 8} *)


text:
Q: Reading Jetty Server Request body without making it null I have a Jetty.Server.Request object, which is an HTTP request whose body I need to use in multiple methods.
I access the body's contents like so -
String contents = baseRequest.getReader().readLine();

However, this seems to remove the body from the HTTP request. If I then try to access it again like so -
String contents2 = baseRequest.getReader().readLine();

contents2 will be null.
How can I read the body of the request object without affecting the request?

A: Per the Servlet spec, the stream is only available once.
Make a copy of it yourself (either to memory, or to disk for later reading)
This is by design, as many request bodies can by quite large and there simply wouldn't be enough memory to handle rereads in a sane way.
Be sure you check out the prior answers for this:
Http Servlet request lose params from POST body after read it once
As those answer demonstrate a few ways to accomplish multiple reads of the same request body.


text:
Q: BelongsTo called with something that's not a subclass of Sequelize.Model I just upgrade version of "sequelize": "6.21.4" (from 6.5.0)
after migration finish successfully getting  error on this line:
User.belongsTo(Role, {foreignKey: "role_id"});

Error log:
"error":"Error: user.belongsTo called with something that's not a subclass of Sequelize.Model

on User class determine extends from sequelize.Model:
import {Model} from "sequelize";
export class User extends Model implements IUser {...
I am already try:

*

*Adding user.hasMany before the belongsTo

*Determine export class User extends Model (without implement IUser)

*user.associate = (models) => doenst exist on TypeScript

*var User = this.sequelize.define("user",{ .. and then User.belongsTo(Role, {foreignKey: "role_id"});


text:
Q: Sum of certain elements in an array in Fortran I have an array like this :
1717.531
1717.364
1716.725
1716.723
1716.536
1716.304
1716.221
1715.998
1715.799
1715.702
1715.648
1715.254
1715.186
1714.733
1714.532
1714.266
1714.223
1714.094
1713.943
1713.873
1713.803
1713.578

I want to SUM each 5 elements separately, which function to use and how?

A: You could use a loop with a step size:
do i=1, N, 5

Then the intrinsic function sum applied to slices of the array:
sum (a(i: i+4))

A: One possible solution would be this:
do i=1,20,5
    x=0.0
    x=(sum(a(i:i+4)))
    write(*,*) x
end do


text:
Q: what is difference between '../js/vue' and 'test/data/js/vue.js'? I'm not sure about this error.
I use require.js to require file in js folder , like this:
require(['../js/vue'],function(){});

But i add baseUrl , it have error
require([baseUrl+'/js/vue'],function(){});

it is similar to
require(['test/data/js/vue'],function(){});
//Failed to load resource: the server responded with a status of 404 (Not Found)
//Uncaught Error: Script error for

If i add extension .js:
require(['test/data/js/vue.js'], function(){}); //It work fine

what is difference between '../js/vue' and 'test/data/js/vue.js'?

A: the .. stands for one directory up. Let's say you created a src folder and within the source folder you have 3 folders, html, css, js. For example when you want to go from your html directory to your js dir. You can do that by typing ../js/FILE.js but you could also do /src/js/FILE.js. But there is something called path traversal exploits which can be caused by going up directories with ../, so for that reason, I recommend you to just never use ../ . And aside from having security issues, in my opinion it is way easier to read the full directory with parent directories then just the ../.
So in short the difference is that with the .. you first go up one directory and then down to where you want to go. Without the .. you only go down in the file system. That makes it safer to use than using the ...


text:
Q: android application only run when sdcard is avaiable My application need data on sdcard strongly. So i am getting stuck when android phone unmount sdcard, my application will be force close. If my app starts after sdcard is unmounted, i can check and notice out. But when my app is running in background, so user unmount sdcard and back to my app, it's very difficult to check this case. My app has many activity... Any ideal?

A: Simple register two BroadcastReceiver for android.intent.action.MEDIA_MOUNTED, android.intent.action.MEDIA_UNMOUNTED. Just detect it and then stop your any function of your program properly. Anyway (Mr. Nguyen Dinh Chien) somehow?


text:
Q: Should rollback data be applied on primary? - MongoDB Assume we have a replica set with 3 nodes(2 data and one arbiter)
A->primary, priority=2
B->secondary, priority=1, 10 seconds behind A
C->arbiter

Now A fails and B becomes primary. After some time A becomes online, does a rollback and after syncing it becomes primary again. Now we can apply roll backed data.
My question is what happen if priority of A is 1. after becoming online and doing a roll back, it will syncs with B. Now on which server we should apply roll backed data? since A is not primary anymore. Should we transfer roll backed data to B and do the operation?

A: Because you can only do writes to a primary, the rolled back data should always be applied on the primary. Which in your case means you need to either move the data to server B, or just use mongorestore to talk to the new primary (with the -h argument). The mongorestore utility will most likely not allow the data to be applied to a secondary.


text:
Q: MultiTenancy with ReactiveCrudRepository I have a Spring boot webflux application. Its a SAAS application and there will be multiple organization and multiple users from each organization.
So, I store org_id in each table and apply

where org_id=?

in each select, update and delete query.
For Ex:-
Table:-  organization
Fields :- org_id, name, ...

Table:- user
Fields :- usr_id, org_id, ...

Table:- schedule
Fields :- schedule_id, usr_id, org_id, ...

Here, I write custom query like below.
@Query("select * from schedule where schedule_id = $1 and org_id = $2")
Flux<Schedule> findById(int scheduleId, int orgId);

Is there any built in support for this use case?

A: There is no such kind of support out of box.


text:
Q: Collating multiple knockout subscriptions into a single notification? In knockout you can do the following:
myObservable.subscribe(function(newValue){ doSomething(); });
Now if I have multiple observables I want to subscribe on I could do:

myObservable1.subscribe(function(){ doSomething(); });
myObservable2.subscribe(function(){ doSomething(); });

However this can get a bit unsightly when I have lots of subscribes and also if you wanted to throttle the update mechanism currently you would have to do it per subscription.
So is there a way for me to wrap them all in some way? i.e.

ko.subscribeToMany(myObservable1, myObservable2)
   .throttle(500)
   .subscribe(function(){ doSomething() });

I have a scenario where I basically want to refresh a chart based upon changes, and its quite resource intensive, so I was hoping that rather than having to subscribe to each dynamic bit of data I could collate them into a single computed style subscription and then from there throttle that individual subscription as other subscriptions may want to be notified straight away without a delay/throttle.
So is the above possible with Knockout?

A: A quick implemenation could be the following:
ko.obsgroup = function() {

    var groupManager = {};
    var observables = [];

    var throttle = 0;
    var throttleTimeout;

    for(var i = 0; i < arguments.length; i++) {
        observables.push(arguments[i]);
    }

    groupManager.throttle = function(duration) {
        throttle = duration;
        return groupManager;
    };

    groupManager.subscribe = function(handler) {

        function throttledHandler(val) {
            if(throttle > 0) {
                if(!throttleTimeout) {
                    throttleTimeout = setTimeout(function() {
                        throttleTimeout = undefined;
                        handler(val);
                    }, throttle);
                }
            } else {
                handler(val);
            }
        }

        for(var i = 0; i < arguments.length; i++) {
            observables[i].subscribe(throttledHandler);
        }
        return groupManager;
    };

    return groupManager;
};

Usage:
var vm = {
    v1: ko.observable(0),
    v2: ko.observable(0),
    v3: ko.observable(0),
    log: ko.observable(0)
};

ko.obsgroup(vm.v1, vm.v2, vm.v3)
  .throttle(1000)
  .subscribe(function(val) {
      vm.log('changed: ' + Date.now());
  });

ko.applyBindings(vm);

#
Demo: JSFiddle


text:
Q: Split a list of strings between two points c("1x Tomatoes 1kg R 16", "1x Oyster Mushroom R 20", "1x Potatoes 1 kg R 15")
I have a long list like this and I need to split the strings between the x and the R in each string so i can have an equal amount of columns when i make a data frame and i cant just split by spaces because not every item on this list are two word products some of them are 2-4 word long so splitting by spaces isn't gonna work.
EDIT:
This is the actual file ive tried to filter a bit down getting rid of useless words so i can make a data frame
1x Tomatoes 1kg for R 16 each
1x Oyster Mushroom for R 20 each
1x Potatoes 1 kg for R 15 each
1x Stirfry 400g for R 20 each
2x Red apples 4 medium for R 10 each
1x beef Fillet Steak 300g for R 54 each
1x Beef Rump Steak 300g for R 45 each
1x Back Bacon 200g for R 30 each
1x Gouda 1kg for R 130 each
1x Chicken flattie lemon and herb for R 85 each
2x Lean Beef Mince for R 54 each

i know the pattern list is useless and this is a big mess but thanks for helping.
I'm thinking now that splitting between the x and the R isn't the best because of other products having capital R's in them

A: Try this
chr <- c("1x Tomatoes 1kg R 16", "1x Oyster Mushroom R 20", "1x Potatoes 1 kg R 15")
strsplit(chr, "(?<=x) | (?=R)", perl = TRUE)

If you need to convert the results into a dataframe, then
as.data.frame(do.call(rbind, strsplit(chr, "(?<=x) | (?=R)", perl = TRUE)))

Should be case sensitive if you are using R v 4.0.2

Update
How about this?
as.data.frame(do.call(rbind, strsplit(sub(" each$", "", vec), "(?<=\\dx) | for ", perl = TRUE)))

Input
> vec
 [1] "1x Tomatoes 1kg for R 16 each"                   "1x Oyster Mushroom for R 20 each"                "1x Potatoes 1 kg for R 15 each"
 [4] "1x Stirfry 400g for R 20 each"                   "2x Red apples 4 medium for R 10 each"            "1x beef Fillet Steak 300g for R 54 each"
 [7] "1x Beef Rump Steak 300g for R 45 each"           "1x Back Bacon 200g for R 30 each"                "1x Gouda 1kg for R 130 each"
[10] "1x Chicken flattie lemon and herb for R 85 each" "2x Lean Beef Mince for R 54 each"

Output
   V1                             V2    V3
1  1x                   Tomatoes 1kg  R 16
2  1x                Oyster Mushroom  R 20
3  1x                  Potatoes 1 kg  R 15
4  1x                   Stirfry 400g  R 20
5  2x            Red apples 4 medium  R 10
6  1x         beef Fillet Steak 300g  R 54
7  1x           Beef Rump Steak 300g  R 45
8  1x                Back Bacon 200g  R 30
9  1x                      Gouda 1kg R 130
10 1x Chicken flattie lemon and herb  R 85
11 2x                Lean Beef Mince  R 54

A: UPDATE: If you always have "for R ..." then change the approach below as
matches <- stringr::str_match(string, "x\\s*(.*?)\\s*for R")[,2]
You can try str_match from the {stringr} package like this:
string <- c("1x Tomatoes 1kg R 16", "1x Oyster Mushroom R 20", "1x Potatoes 1 kg R 15")
matches <- stringr::str_match(string, "x\\s*(.*?)\\s*R")[,2]
matches
#> [1] "Tomatoes 1kg"    "Oyster Mushroom" "Potatoes 1 kg"

Created on 2020-10-19 by the reprex package (v0.3.0)

A: This should work (all with base R):
x <- c("1x Tomatoes 1kg R 16", "1x Oyster Mushroom R 20", "1x Potatoes 1 kg R 15")

x <- t(matrix(unlist(x = strsplit(x = unlist(strsplit(x,
                                             split = ' R ')),
                                split = 'x ')),
            ncol = 3))

x <- as.data.frame(x)


text:
Q: Weights and Neural Networks Is it possible to know the weight matrix of a fully trained Neural Network with multiple hidden layers. More specifically, Can we check and store these values for every training iteration.

A: The tf.train.Saver class provides methods to save and restore models. The tf.saved_model.simple_save function is an easy way to build a saved model suitable for serving.
See Official Documentation Here.

A: On each iteration you are passing a train_op to sess.run asking it to compute that right? Something like this:
sess.run([train_op], feed_dict={...})

You could also ask it to return other values, such as the cost and accuracy tensors using something like this:
_, result_cost, result_accuracy = sess.run([train_op, cost, accuracy], feed_dict={...})

If that all makes sense, then accessing the weight matrix is no more complicated. You just need a reference to the weight matrix tensor (keep it around when you create it or look up the tensor by name):
weight_matrix, _ = sess.run([weight_tensor, train_op], feed_dict={...})

Notice that you can request the value of any tensor (variable, or operation) along with your training. You can also just call sess.run and ask for that particular value:
weight_matrix = sess.run([weight_tensor])


text:
Q: Total area is zero in defuzzification my following code is getting the error: "AssertionError: Total area is zero in defuzzification!", followed by ValueError: Crisp output cannot be calculated, likely because the system is too sparse. Check to make sure this set of input values will activate at least one connected Term in each Antecedent via the current set of Rules.
I'm trying to understand what is wrong but I can't figure it out
its works when I give it a single input but when I use a loop its ends up with this error
import numpy as np
import skfuzzy as fuzz
from skfuzzy import control as ctrl

# range input and output
text = ctrl.Antecedent(np.arange(-1, 1.1, 0.1), 'text')
hashtag = ctrl.Antecedent(np.arange(-1, 1.1, 0.1), 'hashtag')
emoji = ctrl.Antecedent(np.arange(-1, 1.1, 0.1), 'emoji')

sentiment = ctrl.Consequent(np.arange(-1, 1.1, 0.1), 'sentiment')

# status input and output

text['negative'] = fuzz.trapmf(text.universe, [-1,-1, -0.5, -0.1])
text['neutral'] = fuzz.trimf(text.universe, [ -0.2,0, 0.2])
text['positive'] = fuzz.trapmf(text.universe, [0.1, 0.5,1, 1])

hashtag['negative'] = fuzz.trapmf(hashtag.universe, [-1,-1, -0.5, -0.1])
hashtag['neutral'] = fuzz.trimf(hashtag.universe, [ -0.2,0, 0.2])
hashtag['positive'] = fuzz.trapmf(hashtag.universe, [0.1, 0.5,1, 1])

emoji['negative'] = fuzz.trapmf(emoji.universe, [-1,-1, -0.5, -0.1])
emoji['neutral'] = fuzz.trimf(emoji.universe, [ -0.2,0, 0.2])
emoji['positive'] = fuzz.trapmf(emoji.universe, [0.1, 0.5,1, 1])

sentiment['strongly negative'] = fuzz.trimf(sentiment.universe, [-1,-1, -0.6])
sentiment['negative'] = fuzz.trimf(sentiment.universe, [-0.7,-0.5,-0.2])
sentiment['neutral'] = fuzz.trimf(sentiment.universe, [-0.3,0,0.3])
sentiment['positive'] = fuzz.trimf(sentiment.universe, [0.2,0.5,0.7])
sentiment['strongly positive'] = fuzz.trimf(sentiment.universe, [0.6,1,1])

rule1 = ctrl.Rule( text['positive'] & emoji['positive'] & hashtag['positive']| text['positive'] & emoji['positive'] & hashtag['neutral']
                  |text['positive'] & emoji['neutral'] & hashtag['positive'],
                  sentiment['strongly positive'])

rule2 = ctrl.Rule(text['positive'] & emoji['negative']& hashtag['positive'] |text['positive']& emoji['neutral']& hashtag['neutral'] |text['positive']& emoji['positive'] & hashtag['negative']
                  |text['neutral'] & emoji['positive']& hashtag['positive']|text['negative'] & emoji['positive']& hashtag['positive']|
                  text['neutral'] & emoji['positive']& hashtag['neutral']| text['neutral'] & emoji['neutral']&hashtag['positive'],
                  sentiment['positive'])

rule3 = ctrl.Rule( text['neutral'] & emoji['neutral']& hashtag['neutral']|text['positive']& emoji['negative'] & hashtag['negative'],
                  sentiment['neutral'])

rule4 = ctrl.Rule(text['negative'] & emoji['positive']& hashtag['negative']| text['negative'] & emoji['neutral']& hashtag['neutral'] | text['neutral'] & emoji['neutral']& hashtag['negative']
                  |text['negative'] & emoji['negative']& hashtag['positive']|text['neutral'] & emoji['negative']& hashtag['negative']
                  |text['neutral'] & emoji['negative']& hashtag['neutral'],
                  sentiment['negative'])

rule5 = ctrl.Rule( text['negative'] & emoji['negative']& hashtag['negative'] |
                  text['negative'] & emoji['neutral'] & hashtag['negative']|
                  text['negative'] & emoji['negative']&  hashtag['neutral'],
                  sentiment['strongly negative'])

liste is a life of dictionary
for dic_tweets in liste:
    for key in dic_tweets:
        bot.input['text'] = dic_tweets['text']
        bot.input['hashtag'] = dic_tweets['hashtag']
        bot.input['emoji'] = dic_tweets['emoji']
        bot.compute()
        l.append(bot.output['sentiment'])

l
sentiment.view(sim=bot)

errors are :
 AssertionError                            Traceback (most recent call last)
~\anaconda3\lib\site-packages\skfuzzy\control\controlsystem.py in defuzz(self)
    585             try:
--> 586                 return defuzz(ups_universe, output_mf,
    587                               self.var.defuzzify_method)

~\anaconda3\lib\site-packages\skfuzzy\defuzzify\defuzz.py in defuzz(x, mfx, mode)
    247         zero_truth_degree = mfx.sum() == 0  # Approximation of total area
--> 248         assert not zero_truth_degree, 'Total area is zero in defuzzification!'
    249

AssertionError: Total area is zero in defuzzification!

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-72-62f88feea746> in <module>
      6         bot.input['hashtag'] = dic_tweets['hashtag']
      7         bot.input['emoji'] = dic_tweets['emoji']
----> 8         bot.compute()
      9         l.append(bot.output['sentiment'])
     10

~\anaconda3\lib\site-packages\skfuzzy\control\controlsystem.py in compute(self)
    371         for consequent in self.ctrl.consequents:
    372             consequent.output[self] = \
--> 373                 CrispValueCalculator(consequent, self).defuzz()
    374             self.output[consequent.label] = consequent.output[self]
    375

~\anaconda3\lib\site-packages\skfuzzy\control\controlsystem.py in defuzz(self)
    587                               self.var.defuzzify_method)
    588             except AssertionError:
--> 589                 raise ValueError("Crisp output cannot be calculated, likely "
    590                                  "because the system is too sparse. Check to "
    591                                  "make sure this set of input values will "

ValueError: Crisp output cannot be calculated, likely because the system is too sparse. Check to make sure this set of input values will activate at least one connected Term in each Antecedent via the current set of Rules.


text:
Q: ValidationAttribute working partially or not working on Blazor? I'm trying to resolve a problem I found while trying to do a custom validation attribute on my daughter's dog store using blazor.
Basically I have a property as follow:
[Test]
public int? PetAge { get; set; }

As you can see, I'm going to create a custom attribute called "Test", so I created a new class as follow:
public class Test : ValidationAttribute
{

    protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
    {
        return new ValidationResult("niet! niet!");
    }
}

and my understanding is that I can return a new ValidationResult with a string message or if everything goes fine, I can return ValidationResult.Success. In my example, it should always return a problem, as we did not provide any other logic than always returning a validationresult.
When running this code, it simply does not return anything, no error displayed on the form. Now what I did notice is that if I use the other version of the IsValid method, it works, the only problem is that I would like to send a custom message back and not just a true/false result.  The one working is as follow:
public override bool IsValid(object? value)
    {
        return false;
    }

But in that case, I have to provide the error message in the parameter like this:
[Test(ErrorMessage("this is not ok!")]
    public int? PetAge { get; set; }

As these parameters must be constants, it was an awesome idea not only to be able to display a custom-built message as an error and/or have access to the context, etc...
am I doing something wrong on my Blazor app? any help will be appreciated!

A: I noticed this too, try the following
public class Test : ValidationAttribute
{
    protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
    {
        return new ValidationResult("niet! niet!", new[] { validationContext.MemberName });
    }
}


text:
Q: How to select default EFI boot entry from within Ubuntu (MacPro) I have a Mac with Ubuntu, OSX and Windows (booting with rEFIt). I need a way to select which OS to boot on the next reboot. I can do that from within OSX and Windows (through Bootcamp) but I also need a way to tell my machine to boot OSX on the next reboot.
I can't hold ALT on boot to select the OS in the visual EFI screen, because my video card doesn't support that (upgraded my Mac).
PS: I tried efibootmgr but that doesn't show me the actual EFI boot options, only the options available in Grub (e.g. rEFIt does not appear as an option).

A: You are wrong, efibootmgr does not show grub entries only.  List what's in nvram of your machine with
sudo efibootmgr -v

and then use the
sudo efibootmgr  -n xxxx

to select the next boot item.
If you have a bootloader not listed in the nvram list, then it is probably in the device default location, e.g. /EFI/Boot/bootx64.efi.  In that case, you can make an nvram entry, and then refer to that entry with the bootnext flag.


text:
Q: Is the following sintax rfc 3261 compatible? could you please tell me if the following syntax is compatible with rfc3261? Thanks.
401 Unauthorized:
Digest realm="movistar.tel",\r\n   nonce="35e21fba60422a1f2D6a1fde23235c885d287d50e45fd49d56a354",\r\n   algorithm=MD5,\r\n   qop="auth"

or should be
Digest realm="movistar.tel",nonce="35e21fba60422a1f2D6a1fde23235c885d287d50e45fd49d56a354",algorithm=MD5,qop="auth"

I'm trying to analyze using "https://github.com/nygge/abnfc/blob/master/samples/sip/rfc3261.abnf" without success.
Please, can  you help me to understand this?. Sorry my bad english.
Thanks.

A: The rule is defined in section 25.1 of rfc3261
In most place CRLF can be added for readability. Make sur at least a WSP is located right after this CRLF. This helps to differentiate new headers from LWS when parsing.
SIP header field values can be folded onto multiple lines if the
continuation line begins with a space or horizontal tab.  All linear
white space, including folding, has the same semantics as SP.  A
recipient MAY replace any linear white space with a single SP before
interpreting the field value or forwarding the message downstream.
This is intended to behave exactly as HTTP/1.1 as described in RFC
2616 [8].  The SWS construct is used when linear white space is
optional, generally between tokens and separators.

   LWS  =  [*WSP CRLF] 1*WSP ; linear whitespace
   SWS  =  [LWS] ; sep whitespace

CONCLUSION: both lines seems to be valid.


text:
Q: How can I hide keyboard jsut once in Flutter I'm creating a "barcoder" text field on flutter. After the page opened which is the barcoder belong,
I need to autofocus on TextField. But on the first opening, I want to hide the keyboard. And then if the user focuses on TextField The keyboard can appear.
How can I achieve this? I already try
class FirstDisabledFocusNode extends FocusNode {
  @override
  bool consumeKeyboardToken() {
    return false;
  }
}

and it didn't work.
Here is my code
Card(
    elevation: 1,
    child: TextField(
      autofocus: true,
      focusNode: textFieldFocusNode,
      onEditingComplete: () {
        print('Barcode: ${textController.text}');
        buttonFocusNode.requestFocus();
        events!(context);
        if (textController.text.isNotEmpty) {
          _audioCache.play('success.mp3');
        }
      },
      controller: textController,
      decoration: const InputDecoration(
          fillColor: Colors.white,
          prefixIcon: Icon(Icons.qr_code),
          hintText: 'Barcode',
          focusColor: Palette.asBlue,
          border: InputBorder.none,
          focusedBorder: InputBorder.none),
    ),
  );

A: When it goes to the next screen, you can use this in the initState of that widget.
 void initState() {
 super.initState();
 Future.delayed(
   Duration(),
   () => SystemChannels.textInput.invokeMethod('TextInput.hide'),
  );
 }

if it didn't work click the link that i provided in the comments.