text:
Q: How to delete row for group avg() lower than x?   user_id     canon_id           score
| 28772984 | 28772984 |             .1 |
| 28773001 | 28772088 |             .1 |
| 28773011 | 28773011 |              1 |
| 28773046 | 28773011 |             .4 |
| 28773069 | 28773011 |             .1 |
| 28773077 | 28773077 |              1 |
| 28773072 | 28773077 |             .1 |

In this case how do I delete canon_id's whose average(score) is smaller than 0.50?

A: You could try using a delete with join
    delete m
    from my_table m
    inner join  (
        select canon_id
        from my_table
        group by canon_id
        having avg(score)<0.5
    ) t on t.canon_id = m.canon_id


text:
Q: Using fetch to read and write files In my code i've a file called "orca.txt" it is just a number writen in this.
it looks like:

2300

I use fetch to read this number, i get it with:

fetch('orca.txt')
.then(response => response.text())
.then(textString => { contador=textString; });

It works very well, but then after i need to increase the value from the var contador,
so I use contador++; after i wanna to save this new value into the file "orca.txt"
i've tried this:

contador++;
var ct=contador.toString();
fetch("orca.txt",{method:'POST', body:ct})
.then (response => response.text());

but when i refresh the page or open in server the file orca.txt the value is same.
Can anyone help me how to write a value into a file (server file, no user file) using POST method?

A: Using PHP and file_put_contents and JS's Fetch API with FormData API

Create an index.html file:
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DEMO</title>
</head>
<body>
    <button id="increment" type="button">INCREMENT</button>
    <input id="counter" type="text" readonly>

    <script>
        const EL_increment = document.querySelector("#increment");
        const EL_counter = document.querySelector("#counter");
        let counter = 0;

        const incrementCounter = () => {
            counter = parseInt(counter) + 1;
            const FD = new FormData();
            FD.append("counter", counter);
            fetch("saveCounter.php", {
                method: 'post',
                body: FD
            }).then(data => data.json()).then((res) => {
                EL_counter.value = res.counter;
            });
        };

        const init = async () => {
            EL_increment.addEventListener("click", incrementCounter);
            counter = await fetch('counter.txt').then(response => response.text());
            EL_counter.value = counter;
        };

        init();
    </script>
</body>
</html>

create counter.txt file:
2300

Create a saveCounter.php file:
<?php

$response = ["status" => "error"];

if (isset($_POST["counter"]) && file_put_contents("counter.txt", $_POST["counter"])) {
    $response = ["status" => "success", "counter" => $_POST["counter"]];
}

echo json_encode($response);

exit;

Spin up your localhost server or for a quick test using cli-server run from terminal:
php -S localhost:8081

and head to http://localhost:8081 to try it out

redpajama_set_name: RedPajamaStackExchange


text:
Q: Table cell widths - fixing width, wrapping/truncating long words I have a table containing cells with text of various lengths. It is essential that all of the table cells are of the same width. If this means truncating long words or forcing a break in long words then that's OK.
I cannot figure out any way of getting this to work.
This is for an internal client application so needs to work in IE6 and IE7 only.
An example page is below. The cell containing onereallylongword is the offending one.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            word
            two words
            onereallylongword

A: As long as you fix the width of the table itself and set the table-layout property, this is pretty simple :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            word
            two words
            onereallylongword

I've tested this in IE6 and 7 and it seems to work fine.

A:

A: If you want to the long text wrapped properly in new lines then in your table id call use a css property table-layout:fixed; otherwise simply css can't break the long text in new lines.

A: I realize you needed a solution for IE6/7 but I'm just throwing this out for anyone else.
If you can't use table-layout: fixed and you don't care about IE < 9 this works for all browsers.
td {
    overflow-x: hidden;
    overflow-y: hidden;
    white-space: nowrap;
    max-width: 30px;
}

A: Stack Overflow has solved a similar problem with long lines of code by using a DIV and having overflow-x:auto. CSS can't break up words for you.

A: Try this:
text-overflow: ellipsis;
overflow: hidden;
white-space:nowrap;

A: try td {background-color:white}
It just worked for a column I didn't want to get trampled by a previous column's long text.


text:
Q: How to dismiss view when Tab bar item is pressed? I have a view that has a navigation bar on the top, 4 buttons in the middle for the menu, and a tab bar navigation on the bottom.
When only the tab bar items are used everything works, but when I load one of the views via the button the view remains when the tab bar item is pressed.
I'm new to ios so I may not be explaining it that well.  I'm attaching a couple pictures to show what I mean.

I'm assuming that what I have to do to resolve is to intercept the Home button being pressed on the tab bar and tell it to dismiss the previously loaded view.   I could be out to lunch on this.
Please let me know how to make the home button on the tab bar load the initial view even if one of the buttons were pressed to load another view.
Here's what my storyboard looks like.  I used the Editor->Embed TabbarController.

** Update:  Still working on trying to resolve this.  I attempted to set the tab bar controller delegate via the app delegate as per some Q/A on stackoverflow but it didn't seem to make a difference.   There is another approach I should be taking if I want to have a main home screen with buttons to various sections and those sections have a navigation and Tab bar controllers?

A: You need to add a line of code in tab bar item tapped event
Use popToRootViewController method here on the navigation controller of tab bar item.
You can find navigation controller object from tab Bar  like this
UINavigationController *navcon = (UINavigationController*)myTabBarController.selectedViewController;

the use popToRootViewController

[navcon popToRootViewControllerAnimated:NO];

You can use this delegate for this code
-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController

A: Try this
[self.tabBarController setSelectedIndex:1];

A: I can see that you are using UINavigationController for going to next view (Video) instead of using UITabBarController.
You should use TABBarController method.

A: If showing the video page on push .Then in ths selector action of the back button
add
[self.navigationController popViewControllerAnimated:YES];

A: I managed to esolve the issue but I had to start over. I used the tab bar application template to start.  Then on each view in the storyboard I selected "Editor->Embed->Navigation Controller". to add a navigation controller to each of the tab bar's views.    On the initial view I created buttons and control dragged from them to each of the views to link them.
I then updated the following files:
AppDelegate.h
@interface NRMAppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>

@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;

AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.

    UITabBarController *tabController = (UITabBarController *)self.window.rootViewController;
    tabController.delegate = self;
    return YES;
}

MyViewController.m
-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
    UINavigationController *navcon = (UINavigationController*)tabBarController.selectedViewController;

    [navcon popToRootViewControllerAnimated:NO];
}

Also added an IBAction to the buttons to change the tab selected when the button is pressed.
- (IBAction)firstButtonPressed:(id)sender {
    [self.tabBarController setSelectedIndex:1];
}

I tested it on the simulator, iPhone 5, and iPod touch 3rd generation.


text:
Q: Testing for div creation I'm using drupal, with a chat module that creates divs for each chat. Because it's an external module, I don't want to modify the code. My question is this:
Is there a way for jquery to trigger an event if another script creates a div? Would I have to test every X seconds, or something like that?

A: Maybe something like this:
$('#myDiv').bind('DOMNodeInserted DOMNodeRemoved', function(event) {
    if (event.type == 'DOMNodeInserted') {
        alert('Content added! Current content:' + '\n\n' + this.innerHTML);
    } else {
        alert('Content removed! Current content:' + '\n\n' + this.innerHTML);
    }
});

With that you could check if something has been added to a certain div. So if something has been inserted in myDiv it would trigger an event which you listen to, and then take certain actions.

A: This is what the new mutation event spec is for.  Even though it's still in the early stages, you might be able to use it depending on what browsers you need to support.
Feature-detect: mutation-event availability in JavaScript?

A: If the clients browser supports it you can do like in this fiddle:

    <input type="button" onclick="javascript: create_div();" value="create"/>

According to your comment you need to register to the onclick. This is what live() is for:

    <input type="button" onclick="javascript: create_div();" value="create"/>

jsfiddle.


text:
Q: Rebuild columns excel Im a excel beginner and cant find any solution for this fast on the web. Don't know exactly what to search for.
Here is how my excel look like:

And here is what im trying to achieve:

Can someone explain in a simple way how i can do this?  Thanks!
***> !!Tried the solution on my real data and now i have a new problem :(

!!
I dont have all values for every person in the Type Column. It looks
  like this.***

A: Edited to account for re-worded problem
If you have O365 with Dynamic arrays and the UNIQUE and FILTER functions, you can do the following:

*

*Create a Table from your data

Then, for formulas for your results table:
G1: ID
G2:  =UNIQUE(Table1[ID])

H1: Name
H2: =@FILTER(Table1[Name], Table1[[ID]:[ID]]=$G2)

I1:    =TRANSPOSE(UNIQUE(Table1[Type]))
I2 :   =@IFERROR(FILTER(Table1[[Value]:[Value]], (Table1[[ID]:[ID]]=$G2)*(Table1[[Type]:[Type]]=I$1)),"")

*

*Select I2 and fill right to xxx2  (where xxx is at least as far to the right as you have, or might have columns

*Select H2:xxx2 and fill down at least as many rows as you have unique ID's

----------
Another option, if you have Excel 2010+, would be to use Power Query (aka Get & Transform).

*

*Get & Transform from Table/Range

*Select the Type column

*Values Column -- Value

*Advanced Options -- `Don't Aggregate

*

*Close and Load

A: This can be done using several formulas.
To find the distinct Id
=INDEX($A$2:$A$10,AGGREGATE(15,6,(1/(COUNTIF($A$14:A14,$A$2:$A$10)=0))*ROW($A$2:$A$10)-1,1))

Copy formula down.
To find names
=VLOOKUP(A15,$A$2:$B$10,2,0)

Copy formula down
To find type values
=INDEX($A$2:$D$10,AGGREGATE(15,6,(1/(($B15=$B$2:$B$10)*(C$14=$C$2:$C$10)))*ROW($D$2:$D$10)-1,1),4)

Copy formula down and right as needed.
If you do not want to see errors, you can include each formula in the IFERROR function - IFERROR(...,"")


text:
Q: Type Word With Just Click Button I don't know if that possible in android or what
but how to type word by just click on button
example
Button 1 = "Hello"
 but i want it typed on keyboard
it's like hot key
ii have tried  Key Event but i didn't recognized how does it work like if i want Button  To Type Hello automatically on keyboard even keyboard is hidden
    dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_BACK));

A: If I understand you correctly, you want to type a word in an EditText when you press a button? If so you can just append your text to the EditText in your onClick method:
public void onClickHello(View view) {
    mEditText.append(mHelloButton.getText().toString());
}


text:
Q: Streaming an mpeg2-ts video over RTP using gstreamer I am trying to stream an mpeg2-ts video over RTP using gstreamer. I am using the following pipeline for the server:
gst-launch-0.10 -v filesrc location=/home/…/miracast_sample.mpeg ! rtpmp2tpay ! udpsink host=localhost port=5000 sync=false

The problem that I am facing is that I get directly an EOS event like described below:
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstRTPMP2TPay:rtpmp2tpay0: timestamp = 3878456990
/GstPipeline:pipeline0/GstRTPMP2TPay:rtpmp2tpay0: seqnum = 50764
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 126835285 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

I can understand that it is running very fast but how to fix it?

A: You have set sync=FALSE, and that translates to "do not sync on timestamps, but process the buffer as fast as possible." Try and change it to TRUE, like so:
gst-launch-0.10 -v filesrc location=/home/…/miracast_sample.mpeg ! rtpmp2tpay ! udpsink host=localhost port=5000 sync=1

A: I had the same problem as you and my coworker suggested I insert a tsparse set-timestamps=true between the filesrc and rtpmp2tpay.  It worked for me, so try changing your pipeline to
gst-launch-0.10 -v filesrc location=/home/…/miracast_sample.mpeg ! \
  tsparse set-timestamps=true ! rtpmp2tpay ! udpsink host=localhost port=5000 sync=false

A: Have you tried to demux it and then mux it ...
such as:
server:
gst-launch-0.10 -v filesrc location=file_to_stream.ts ! tsdemux program-number=811 ! mpegtsmux ! rtpmp2tpay ! udpsink host=localhost port=5000 sync=1

client:
gst-launch-0.10 udpsrc port=5000 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)MP2T-ES" ! gstrtpbin ! rtpmp2tdepay ! tsdemux ! mpeg2dec ! ffmpegcolorspace ! autovideosink


text:
Q: como puedo hacer que acepte decimales en mi divicion todo funciona bien pero cuando ingreso a un decimal no funciona el codigo ¿como puedo hacer que funcione?
    System.out.println("¿Cual es tu nombre?");
    String edaparcialdd = sc.nextLine();
    System.out.println("Bienvenido de nuevo " + edaparcialdd);

    System.out.print("Introduce la Cal. del parcial 1\n");
    double num1 = sc.nextDouble();

    System.out.print("Introduce la Cal. del parcial 2\n");
    double num2 = sc.nextDouble();

    System.out.print("Introduce la Cal. del parcial 3\n");
    double num3 = sc.nextDouble();

    double sum = num1 + num2 + num3;
    double div = sum / 3;

    if (div >= 6) {
        System.out.println("El Alumno " + edaparcialdd);
        System.out.println("FUE APROBADO CON: " + div);
    } else {
        System.out.println("El Alumno " + edaparcialdd );
        System.out.println("NO FUE APROBADO CON: " + div);
    }

}}

A: Al utilizar sc.nextDouble() por defecto tienes que usar la coma (,) para separar la parte entera de la decimal, es decir, poner "7,5" y no "7.5"


text:
Q: Connect to localhost from mobile phone using express, nodejs I would like to access my server that I host on my computer (Node.js & Express) from my phone. The computer is on the same network as the phone.
As soon as I type localhost:3000 in the address bar of the browser on the desktop PC, everything works without problems.
If I now try to open my site with the cell phone under the following address 192.168.0.100:3000, I get no error message but nothing is displayed... The IP address was retrieved with ipconfig.
I have tried several solutions that I have found here on Stack Overflow such as port sharing in the firewall settings. Unfortunately without success.
Here is my code when creating at the server:
var express = require('express');

var app = express();

var server = app.listen(process.env.PORT || 3000, listen);

function listen() {
  var host = server.address().address;
  var port = server.address().port;
  console.log('Example app listening at http://' + host + ':' + port);
}

When I try to check my IP address via the console.log, I get the following:

If someone has an idea what this could be I would be very happy!
#1 Update:
I have now replaced my line of code with

var server = app.listen(3000, "127.0.0.1", listen);

and I get the following back from my console:

I can access my server from my computer through
127.0.0.1:3000
localhost:3000
If I try to access (on computer) through 192.168.0.100:3000 nothing happens. I also get no error message. Only a white screen.
#2 Update:
Typing "ipconfig" in cmd

After changing the IP to

var server = app.listen(3000, "192.168.0.100", listen);

I could not access my server anymore. Not even using localhost:3000. However, when examining the item I found an error that does not show up when I set

var server = app.listen(3000, "127.0.0.1:3000", listen);

I do not understand why the error shows up when changing the IP address, since the code is the same.
Heres a picture of the error

Error fixing
Apparently one way to work around the error is to use a tunneling service (ngrok). I will try it
#3 Update
In my last attempt, i was trying to tunnel my server via ngrok. At first, everything looked like it was finally going to work. From my own PC I could access my websocket server via ngrok forwarding link. However, when I tried to click on the link with my phone/second pc, I got the error that the connection is refused...

If someone has an idea or an approach to what this could be, I would be very happy.
SOLUTION IS POSTED IN THE COMMENTS

A: Sorry I can't comment:
Have you tried 192.168.0.100:3000 into the browser, on the computer?
As for the http://:::3000 you can check this

A: If you want to access your localhost over the internet...
There are some softwares / Chrome Extensions that let's you access your local host over the internet...

*

*https://ngrok.com

*http://localtunnel.me

*http://localhost.run
You can do Google search for more softwares like these ones and choose accordingly to your work.

A: I give up because new errors keep appearing. I thought I'd post my solution (or my new approach) here in case anyone else is in the same situation as me. In the end I used the following github repository as a base for my project. If I set up a server with this there are no problems at all. I have also tunneled it with ngrok in the end.
Link to Github
It also uses p5.js, node.js and socket.io


text:
Q: Postgres determine size of all blobs hi i'm trying to find the size of all blobs. I always used this
SELECT sum(pg_column_size(pg_largeobject)) lob_size FROM pg_largeobject

but while my database is growing ~40GB this takes several hours and loads the cpu too much.
is there any more efficent way?

A: Some of the functions mentioned in Database Object Management Functions give an immediate result for the entire table.
I'd suggest pg_table_size(regclass) which is defined as:

Disk space used by the specified table, excluding indexes (but
  including TOAST, free space map, and visibility map)

It differs from sum(pg_column_size(tablename)) FROM tablename because it counts entire pages, so that includes the padding between the rows, the dead rows (updated or deleted and not reused), and the row headers.


text:
Q: ADFC-10001: cannot instantiate class view.Addition I am new to ADF, I am doing adding of two numbers. Created two files:

*

*AdditionNumbers.jspx

*Addition

When I run the Application, am getting below error:

Root cause of ServletException.

oracle.adf.controller.ControllerException: ADFC-10001: cannot instantiate class 'view.Addition'
    at oracle.adfinternal.controller.util.Utils.createAndLogFacesException(Utils.java:184)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:192)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.instantiateBean(ManagedBeanFactory.java:873)
    at oracle.adfinternal.controller.application.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:111)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:173)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:200)
    at com.sun.el.parser.AstIdentifier.getValue(Unknown Source)
    at com.sun.el.parser.AstValue.getTarget(Unknown Source)
    at com.sun.el.parser.AstValue.isReadOnly(Unknown Source)
    at com.sun.el.ValueExpressionImpl.isReadOnly(Unknown Source)
    at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.getUncachedReadOnly(EditableValueRenderer.java:502)
    at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.getReadOnly(EditableValueRenderer.java:409)
    at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.isReadOnly(LabeledInputRenderer.java:294)
    at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.getClientComponentType(LabeledInputRenderer.java:86)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1300)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:358)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:840)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:422)
    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2788)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:438)
    at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:220)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1432)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:358)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:840)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:422)
    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2788)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:438)
    at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1341)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1432)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:358)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:840)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
    at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
    at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:979)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:408)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:237)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused By: java.lang.ClassNotFoundException: Class bytes found but defineClass()failed for: 'view.Addition'
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:276)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:186)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.instantiateBean(ManagedBeanFactory.java:873)
    at oracle.adfinternal.controller.application.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:111)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:173)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:200)
    at com.sun.el.parser.AstIdentifier.getValue(Unknown Source)
    at com.sun.el.parser.AstValue.getTarget(Unknown Source)
    at com.sun.el.parser.AstValue.isReadOnly(Unknown Source)
    at com.sun.el.ValueExpressionImpl.isReadOnly(Unknown Source)
    at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.getUncachedReadOnly(EditableValueRenderer.java:502)
    at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.getReadOnly(EditableValueRenderer.java:409)
    at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.isReadOnly(LabeledInputRenderer.java:294)
    at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.getClientComponentType(LabeledInputRenderer.java:86)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1300)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:358)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:840)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:422)
    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2788)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:438)
    at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:220)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1432)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:358)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:840)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:422)
    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2788)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:438)
    at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1341)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1432)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:358)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:840)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
    at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
    at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:979)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:408)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:237)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused By: java.lang.UnsupportedClassVersionError: view/Addition : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:630)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:186)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.instantiateBean(ManagedBeanFactory.java:873)
    at oracle.adfinternal.controller.application.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:111)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:173)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:200)
    at com.sun.el.parser.AstIdentifier.getValue(Unknown Source)
    at com.sun.el.parser.AstValue.getTarget(Unknown Source)
    at com.sun.el.parser.AstValue.isReadOnly(Unknown Source)
    at com.sun.el.ValueExpressionImpl.isReadOnly(Unknown Source)
    at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.getUncachedReadOnly(EditableValueRenderer.java:502)
    at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.getReadOnly(EditableValueRenderer.java:409)
    at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.isReadOnly(LabeledInputRenderer.java:294)
    at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.getClientComponentType(LabeledInputRenderer.java:86)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1300)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:358)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:840)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:422)
    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2788)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:438)
    at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:220)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1432)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:358)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:840)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:422)
    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2788)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:438)
    at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1341)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1432)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:358)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:840)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
    at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
    at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:979)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:408)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:237)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
 SUBSYSTEM = HTTP USERID = <WLS Kernel> SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)' MSGID = BEA-101017 MACHINE = BNGW8-MJOGAR TXID =  CONTEXTID = 7a896e0ea900a80f:-4f901b37:15aec18d3a5:-8000-0000000000000024 TIMESTAMP = 1490019933124
WatchAlarmType: AutomaticReset
WatchAlarmResetPeriod: 30000
>
<20 Mar, 2017 7:55:35 PM IST> <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it on 127.0.0.1:59,246 during the configured idle timeout of 5 secs>
<20 Mar, 2017 7:55:35 PM IST> <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it on 127.0.0.1:59,247 during the configured idle timeout of 5 secs>
<20 Mar, 2017 7:55:35 PM IST> <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it on 127.0.0.1:59,249 during the configured idle timeout of 5 secs>
<20 Mar, 2017 7:55:35 PM IST> <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it on 127.0.0.1:59,248 during the configured idle timeout of 5 secs>
<20 Mar, 2017 7:55:35 PM IST> <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it on 127.0.0.1:59,245 during the configured idle timeout of 5 secs>
<DiagnosticsDataExtractorImpl> <createADR`enter code here`Incident> incident 2 created with problem key "DFW-99998 [java.lang.UnsupportedClassVersionError][oracle.adfinternal.controller.beans.ManagedBeanFactory.newInstance][AddingTwoNumbers]"

A: i think you may have done the binding of method made in impl class in page defination of jsf page.
can you say more specifically what you have used exactly including taskflows and backing bean. post your code here.


text:
Q: Running a PHP file using AJAX and sending parameters I am trying to edit a file on my server when a user clicks a button on my web page. I generate a table of buttons using php. STRING1, STRING2 and BOOL are variables I pass to my function. The editPlist() function I made is called and the test alert() shows. The problem is that the php file is to run. I am not getting any errors either. I can't seem to figure out what is wrong.
Sample HTML button:
1 : Round 1

The button click runs this script: (the PHP in the url line generates the address of the file I want to run.)


text:
Q: What's wrong with this implementation of Awaiter in Unity3D? So I was trying to make a simple awaitable struct that allow my to return a bool:
// define a special container for returning results
public struct BoolResult {
    public bool Value;
    public BoolAwaiter GetAwaiter () {
        return new BoolAwaiter(Value);
    }
}

// make the interface task-like
public readonly struct BoolAwaiter : INotifyCompletion {
    private readonly bool _Input;

    // wrap the async operation
    public BoolAwaiter (bool value) {
        _Input = value;
    }

    // is task already done (yes)
    public bool IsCompleted {
        get { return true; }
    }

    // wait until task is done (never called)
    public void OnCompleted (Action continuation) => continuation?.Invoke();

    // return the result
    public bool GetResult () {
        return _Input;
    }
}

And I was using it like:
private async BoolResult LoadAssets (string label) {
    //
    // some await asyncFunction here
    //

    // then at the end
    return new BoolResult { Value = true };
}

But I still get this compile error:

error CS1983: The return type of an async method must be void, Task or Task<T>

I thought my BoolResult was already Task-like? What's the issue here?


text:
Q: object references an unsaved transient instance in Hibernate 4.3 This is not the usual situation, but I'm hoping someone can shed some light. This used to work in Hibernate 3, but I have recently upgraded which broke things.
I am using Hibernate 4.3.5 with an Oracle 11g database.
Assume a set of entity classes that looks like this (some code omitted for brevity):
@Entity
@Table("MY_FILES")
public class MyFileInfo {

  private String fileId;
  private String name;
  private MyFileData myFileData;

  @Id
  @GeneratedValue(strategy = GenerationType.SEQUENCE,
                  generator = "fidSeq")
  @SequenceGenerator(name = "fidSeq",
                     sequenceName = "SQ_FILE_ID",
                     allocationSize = 10,
                     initialValue = 1)
  @Column(name="FILE_ID")
  public String getFileId() {
    return fileId;
  }

  @Column(name = "NAME")
  public String getName() {
    return name;
  }

  @OneToOne(mappedBy = "myFileInfo",
            fetch = FetchType.LAZY,
            optional = false,
            cascade = CascadeType.REFRESH)
  public MyFileData getMyFileData() {
    if (myFileData == null) {
      myFileData = new MyFileData(this);
    }
    return myFileData;
  }

  // ... setters ... //
}

-
@Entity
@Table("MY_FILES")
public class MyFileData {

  private String fileId;
  private MyFileInfo myFileInfo;
  private byte[] content;

  public MyFileData() {}
  public MyFileData(MyFileInfo myFileInfo) {
    setMyFileInfo(myFileInfo);
  }

  @Id
  @Column(name = "FILE_ID",
          insertable = false,
          updatable = false)
  public String getFileId() {
    return fileId;
  }

  @OneToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "FILE_ID",
              referencedColumnName = "FILE_ID",
              insertable = false,
              updatable = false)
  public MyFileInfo getMyFileInfo()
  {
    return myFileInfo;
  }

  @Column(name = "FILE_CONTENTS",
          insertable = false)
  public byte[] getContent()
  {
    return content;
  }

  public setMyFileInfo(MyFileInfo myFileInfo) {
    this.myFileInfo = myFileInfo;
    fileId(myFileInfo.getId());
  }

  // ... other setters ... //
}

Note that the code here was written outside an IDE and was not tested or compiled. See flaws, let me know.
Alright, now I know that's strange since I'm mapping two entities to the same table. The whole purpose here is the ability to load MyFileInfo objects without getting the FILE_CONTENTS column, allowing a list of files without downloading potentially large files from the database. "Why not just use a native query or something like that," you ask? Well, the use of Hibernate is quite extensive and tightly coupled in this application, and catching all the places we load file contents unnecessarily would be nearly impossible.
With all that being said, I used to be able to write to the database in Hibernate 3.6.10 using a series of calls that looked like this:
final MyFileInfo info = new MyFileInfo();
Session session = sessionFactory.getCurrentSession();
info.setMyFileData(new MyFileData(info));
session.saveOrUpdate(info);
session.flush();
session.refresh(info);
info.getMyFileData().setFileId(info.getId());
session.saveOrUpdate(info.getMyFileData());

It's all very complicated and kludgey-feeling, but it worked. Now I get the infamous object references an unsaved transient instance - save the transient instance before flushing error, but I can't save the MyFileInfo object first--the flush/refresh would get the generated ID I need to set on the MyFileData object in order to be able to save it.
Any help here is greatly appreciated. Drop it in the comments if I need to supply more information! Thanks!

A: The answer was much simpler than I expected. I was able to fix it by moving the persistence logic around and not touching the @Entity classes:
final MyFileInfo info = new MyFileInfo();
Session session = sessionFactory.getCurrentSession();

// saveOrUpdate actually gets the id from Hibernate's sequence cache,
// which doesn't need a flush
session.saveOrUpdate(info);

// then I can set the ID where appropriate and save (update) the "new" entity
info.setMyFileData(new MyFileData(info));
info.getMyFileData().setFileId(info.getId());
session.saveOrUpdate(info.getMyFileData());

// the flush will save the MyFileInfo object and perform a no-
// consequence update on the MyFileData object.
session.flush();
session.refresh(info);


text:
Q: Streamplot of an ODE I'm trying to make a streamplot of
$\qquad \frac{dy}{dx}=|y(x)|$
together with a couple of streamlines. I got stuck in the syntax. Can anyone help me out of it?
This what I've done:
sp = StreamPlot[{1, Abs[y[x]]}, {x, 0, 4}, {y[x], -4, 4}];
sol = y /. ParametricNDSolve[{y'[x] == Abs[y[x]], y[0] == a}, y, {x, 0, 4}, a];
Manipulate[
  Show[
    sp,
    Plot[Evaluate[sol[a][x]], {x, 0, 4},
      PlotStyle -> Red,
      PlotRange -> Full],
    Epilog -> {Black, PointSize[0.02], Point[{0, a}]}],
  {a, 0, 4}]

A: Use StreamPlot
sp = StreamPlot[{1, Abs[y]}, {x, 0, 2 Pi}, {y, 0, 2 Pi}]

sol[y0_?NumericQ] :=
 NDSolve[{D[y[x], x] == Abs[y[x]], y[0] == y0}, y, {x, -5, 5}]

scp = Plot[Evaluate[{y[x]} /. sol[#] & /@ Range[0, 20, 0.3]], {x, -3, 3},
      PlotRange -> All, MaxRecursion -> 8, AxesLabel -> {"x", "y"}, PlotStyle -> Red]

Show[sp,scp ]


text:
Q: What is the difference between a moment and a couple? In mechanical engineering, the torque due to a couple is given by $\tau = P\times d$, where $\tau$ is the resulting couple, $P~$ is one of the force vectors in the couple and $d$ is the arm of the couple. A couple is made up of two forces of the same magnitude.
On the other hand, a moment is also given by $M = P\times d$. However, there is only one force involved! How can the resulting torque be of the same magnitude if in one case two, in the other case only one force is involved?

A: Ingo, when you consider the couple, you may put one of the "spouses" at the origin, so his torque is $P\times d_0$ for $d_0=0$, so his torque vanishes. Meanwhile, she is located at a nonzero $d$ so her contribution is $P\times d$ and nonzero. Because his torque is zero, it doesn't matter whether you add him or not.
The only difference between the whole couple (including the husband at the origin) and the separate wife at nonzero $d$ is that the total force (not moment) of the whole couple is zero, while the wife separately acts both by torque and by a nonzero ordinary force as well.

A: The reason for the distinction is that a couple has no net force in some direction.
If you had a rod floating in space and applied a couple, it would spin in place. This is because you applied the same force in opposite directions, so the overall force in any direction is 0. However, since you didn't apply the force directly in the center, you impart some spin on it
If you applied a moment to a floating rod, it would start spinning because you didn't apply the force in its center, but also move off in some direction, because you applied an unbalanced force, and there was some net force in the direction you applied it.

A: Moment and couple are quite similar terms; but whereas, when we consider two equal but unlike forces acting on a body, that is coupled, whereas moment involves only one force.

A: Couple is have to require two forces definitely while torque has requires a single force only both are rotating effects only


text:
Q: which part of the code is using memory? and how do I use 'del' to reset the memory? for one epoch for this image process using more than 80 ram memory
I know the 'del' command to delete the memory usage

del dataframe

I want to use 'del' command to free the memory after one epoch
but not sure which one is actually using the memory for this code
here is the code
for train_index, valid_index in zip(train_indexes,valid_indexes):

    print("cleanup memory")
    traindf = df_train.iloc[train_index, :].reset_index()
    validdf = df_train.iloc[valid_index, :].reset_index()

        if(j >= 1 and j <= 1):

        train_generator = train_datagen.flow_from_dataframe(
            dataframe=traindf,
            directory=TRAIN_CROPPED_PATH,
            x_col='img_file',
            y_col='class',
            target_size= (IMAGE_SIZE, IMAGE_SIZE),
            color_mode='rgb',
            class_mode='categorical',
            batch_size=BATCH_SIZE,
            seed=SEED,
            shuffle=True
            )

        valid_generator = valid_datagen.flow_from_dataframe(
            dataframe=validdf,
            directory=TRAIN_CROPPED_PATH,
            x_col='img_file',
            y_col='class',
            color_mode='rgb',
            class_mode='categorical',
            batch_size=BATCH_SIZE,
            seed=SEED,
            shuffle=True
            )

        model_name = model_path + str(j) + '_'+ modelName+"_Aug"+'.hdf5'
        model_names.append(model_name)

        print("TRAIN_CROPPED_PATH:",TRAIN_CROPPED_PATH)
        print("model_name:",model_name)

        model = get_model()

        try:
            model.load_weights(model_name)
        except:
            pass

        print("model_path:",model_path)

        patient = 2
        callbacks = [
        EarlyStopping(monitor='val_loss', patience=patient, mode='min', verbose=1),
        ReduceLROnPlateau(monitor = 'val_loss', factor = 0.5, patience = patient / 2, min_lr=0.00001, verbose=1, mode='min'),
        ModelCheckpoint(filepath=model_name, monitor='val_loss', verbose=1, save_best_only=True, mode='min'),
        ]

        history = model.fit_generator(
            train_generator,
            steps_per_epoch=len(traindf.index) / BATCH_SIZE,
            epochs=epochs,
            validation_data=valid_generator,
            validation_steps=len(validdf.index) / BATCH_SIZE,
            verbose=1,
            shuffle=False,
           callbacks = callbacks
            )

    j+=1


text:
Q: Error in file(description = xlsxFile) : invalid 'description' argument This is my first time to use R on a cloud server. I've downloaded the data to my online working directory. These are some details about my working directory:
getwd()
[1] "/home/fategh"

list.files()
[1] "nearline"        "projects"        "R"               "rawdata.xlsx.gz"
[5] "scratch"

Now, when I try to read the data, I get the following error:
data=read.xlsx((gzfile("rawdata.xlsx.gz")))
Error in file(description = xlsxFile) : invalid 'description' argument

data=read.xlsx((gzfile("home/fategh/rawdata.xlsx.gz")))
Error in file(description = xlsxFile) : invalid 'description' argument

I tried whatever path I could think of:
 > data=read.xlsx((gzfile(file.choose())))
 Enter file name: rawdata
 Error in file(description = xlsxFile) : invalid 'description' argument

 > data=read.xlsx((gzfile(file.choose())))
 Enter file name: rawdata.xlsx
 Error in file(description = xlsxFile) : invalid 'description' argument

 > data=read.xlsx((gzfile(file.choose())))
 Enter file name: rawdata.xlsx.gz
 Error in file(description = xlsxFile) : invalid 'description' argument

I don't know what to do about it. It's my first time working on a cloud shell.
Thank you.


text:
Q: pygame character jumping not working in school project I am working on a terreria knock off game for a school project and the code I have for jumping does not work. when I run the code the character is constantly jumping unless I am moving to the side but when I hit the space bar (the actual jump button the character stops jumping for good.
elif man.isJump != False:
    if keys[pygame.K_SPACE]:
        man.isJump = True
        man.right = False
        man.left = False
        man.walkCount = 0
    else:
        if man.jumpCount >= -10:
            # neg variable determines which way our character is moving positive 1 up, negative 1 down
            neg = 1
            if man.jumpCount < 0:
                neg = -1
            # move our character by the number of pixels
            # using the product (**) of 10 which is count and halfing the value
            # if positive then moving up, negative moving down
            man.y -= (man.jumpCount ** 2) * 0.5 * neg
            man.jumpCount -= 1
        else:
            man.isJump = False
            man.jumpCount = 10

A:
[...] when I run the code the character is constantly jumping [...]

You have to evaluate if the man is not jumping and then if the SPACE was pressed, to start a jump. In else case the jump can be performed:
if man.isJump == False:

    if keys[pygame.K_SPACE]:
        man.isJump = True # <------ start jump
        man.right = False
        man.left = False
        man.walkCount = 0

else

    if man.jumpCount >= -10 and : # <----- is jumping?
        # neg variable determines which way our character is moving positive 1 up,
        # negative 1 down
        neg = 1
        if man.jumpCount < 0:
            neg = -1
        # move our character by the number of pixels
        # using the product (**) of 10 which is count and halfing the value
        # if positive then moving up, negative moving down
        man.y -= (man.jumpCount ** 2) * 0.5 * neg
        man.jumpCount -= 1

    else:
        man.isJump = False # <------ end jump
        man.jumpCount = 10


text:
Q: Finding which one is a larger expression How to find which expression is larger: $$e^{\pi\cdot \int_0^1\sqrt {\tan(x)}dx}$$ $$or$$ $$ \pi^{e\cdot \int_0^1\sin^2(x)dx}$$
This question seems bit complicated. What is the best way to start off analytically without using a calculator?

A: Since on the interval $(0,1)$ we have $\sin(x)\leq x\leq\tan(x)$ and $2<e<3<\pi<4$,
$$ e^{\pi\int_{0}^{1}\sqrt{\tan x}\,dx} \geq e^{\pi \int_{0}^{1}\sqrt{x}\,dx} = e^{2\pi/3} \geq e^2 >4 $$
while
$$ \pi^{e\int_{0}^{1}\sin(x)^2\,dx} \leq \pi^{e/3} \leq \pi < 4.$$
The comparison is not difficult, since the difference between such numbers is pretty large.


text:
Q: Kivy display image at full resolution I am using Kivy 1.9 and Python 3.4.
I have an image that is 5400x2700. I have a screen with 1920x1200 resolution.
How can I display the image at its full/native resolution and add scroll features to my main window to view areas of the image not initially displayed?
I have tried to use allow_stretch=True and keep_ratio=False to display the image at its native, but the picture still condenses to fit on my monitor. Additionally, I have tried to set the size=(5400, 2700) for the Image, but the it still fits inside my existing window.
Any help or ideas would be appreciated. Thanks!

A: You probably didn't actually set the image size; if its parent is a layout, your manual setting is ignored. Try seting its size and also set its size_hint to None, None.

A: You can also set the allow_stretch = False, keep_ratio = True, to allow the image to resize to its original size


text:
Q: Every 2-vector is decomposable in $a_1\wedge a_2 + \cdots + a_{r-1}\wedge a_r$ I want to show that every $\omega  \in \Lambda^2(V^*)$ on a finite dimensional vector space $V$ can be written as $\omega = \alpha_1 \wedge \alpha_2 + ... + \alpha_{2r-1} \wedge \alpha_{2r}$ where $B=\alpha_1,...,\alpha_n$ is a basis of $V^*$.
Moreover $r$ is independet of $B$ and $\omega \wedge ...$ (r times)$... \wedge \omega \not= 0$ but $\omega \wedge ...$ (r+1 times)$... \wedge \omega = 0$
I know that $\omega$ can be expressed as $\sum_{i,j}(\lambda_{i,j}\alpha_i \wedge \alpha_j)$. I wonder why the coefficients $\lambda_{i,j}$ "disappear".
From Wikipedia it says that $\lambda_{ij}=-\lambda_{ji}$ which makes sense, the rank of the matrix $\lambda_{ij}$ is even which is also understandable. It goes on that the matrix has twice the rank of $\omega$. Why is that so?
At the end it states that a 2-vector $\omega$ has rank $r$ if and only if:
$\omega \wedge ...$ (r times)$... \wedge \omega \not= 0$ but $\omega \wedge ...$ (r+1 times)$... \wedge \omega = 0$
I'm failing to proof this. Can someone help me out?

A: Assume that $\alpha_1,...,\alpha_n$ is a basis for $V^*$ and write $\omega = \sum\limits_{i<j} c_{i,j}\cdot \alpha_i\wedge\alpha_j$. It is not necessarily true that all the coefficients $c_{i,j}$ have to be $1$. But we can do some trick :
For example, consider $\omega = 2\cdot v_1\wedge v_2+v_1\wedge v_3+v_2\wedge v_3$ where $v_1,v_2,v_3$ is a basis for $V$. You can first write $\omega = v_1\wedge (2\cdot v_2+v_3)+ v_2\wedge v_3$. And then since $v_2\wedge v_2=0$, you have $\omega = v_1\wedge(2\cdot v_2+v_3)+v_2\wedge(2\cdot v_2+v_3)=(v_1+v_2)\wedge(2\cdot v_2+v_3)$. Note that $v_1+v_2$ and $2\cdot v_2+v_3$ are linearly independent. There is a rigorous way to do this trick to write any $\omega$ in the form $\alpha_1\wedge\alpha_2+...+\alpha_{2r-1}\wedge\alpha_{2r}$ where $\alpha_i$ are linearly independent.
First note that $r$ is the rank of $\omega$ since the vectors appearing above are all linearly independent.
Therefore $w\in\bigwedge^2 W$ where $W$ is the subspace spanned by $\alpha_1,...,\alpha_{2r}$. If you take the wedge of $w$ with itself $r+1$ times, then the result is necessarily $0$ since the result is a $2r+2$-form in the $2r$ dimensional vector space $W$. But if you take the wedge of $\omega$ with itself $r$ times the resulting vector is $n!\cdot\alpha_1\wedge\alpha_2\wedge...\wedge\alpha_{2r}$ which is nonzero.
I believe that many of the arguments above were not really rigorous, in any case you can comment and I can edit to try to clarify.


text:
Q: gridview update with dynamically created textboxes I have a gridview that is bound to a sql data source.
In the RowBound method I have this code in order to format the editable textboxes:
protected void gridview_RowDataBound(Object sender, GridViewRowEventArgs e)
{
    //Format the Edit row.
        if (e.Row.RowIndex == gridview.EditIndex && e.Row.RowIndex >= 0)
        {
           //Add Ajax Calendar to Date fields
            TextBox startDate= ((TextBox)e.Row.Cells[7].Controls[0]);
            startDate.ID = "txtStartDate";
            TextBox endDate= ((TextBox)e.Row.Cells[8].Controls[0]);
            endDate.ID = "txtEndDate";
            startDate.Attributes.Add("onchange", "javascript:GridviewAutoCalculateEndDate(this, " + endDate.ClientID + ");");

            AjaxControlToolkit.CalendarExtender startDateCalendar = new AjaxControlToolkit.CalendarExtender();
            startDateCalendar .ID = "startDateCalendar ";
            startDateCalendar .TargetControlID = "txtStartDate";
            startDateCalendar .Format = "dd/MM/yyyy";
            AjaxControlToolkit.CalendarExtender endDateCalendar = new AjaxControlToolkit.CalendarExtender();
            endDateCalendar.ID = "endDateCalendar";
            endDateCalendar .TargetControlID = "txtEndDate";
            endDateCalendar .Format = "dd/MM/yyyy";

            e.Row.Cells[7].Controls.Add(startDate);
            e.Row.Cells[8].Controls.Add(endDate);
            e.Row.Cells[7].Controls.Add(startDateCalendar );
            e.Row.Cells[8].Controls.Add(endDateCalendar );
        }
}

The above just adds a dynamic AjaxCalendarExtender to two textboxes and the javascript, takes the date entered in the startDate textbox, adds one year to it and updates it in the endDate textbox (so you do not have to change it manually).
The problem I am having is that when I click the Update command field, I get a null reference to those two textboxes and the text inside them also clears (something to do with postback?)
Here is the update code:
protected void gridview_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
    DateTime startDate= new DateTime();
    DateTime.TryParseExact(e.NewValues[6].ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out startDate);
    DateTime endDate= new DateTime();
    DateTime.TryParseExact(e.NewValues[7].ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out endDate);

    dataContext.UpdateDates(startDate, endDate);
    PerformDataBind();
}

Basically startDate and endDate seem to clear and become null right after clicking Update. The e.NewValues don't seem to pull the date fields.
If I am to remove the dynamic data they update just fine.
What am I missing?

A: The variable names "startDate" and "endDate" only exist within your if statement, if you want to adress them with that name define them in a higher scope

A: What's happening:
Dynamically created controls must be created each and every time the Page loads. When you press the Update button, a PostBack occurs, and in that PostBack you'd have to recreate the dynamic controls to be able to access them.
Meaning, if RowUpdating is happening, and you didn't go through RowDataBound before, the controls are not there.
I also presume that during an Updating PostBack, gridview.EditIndex will have a different value, so your controls won't be there in any case.
What you should be doing instead:
You should design your edit mode template in your markup, and let ASP.NET handle control creation. Take advantage of the data binding capabilities, let them do the work for you.


text:
Q: Regex match if a substring is NOT found I am trying to make a regex match only when the substring 'password' is not contained in the string.
The only solution that I have come across that claims to solve this is:
((?!password).)
however this matched 'password123'
Is this possible with regex? I have a feeling I might have to fall back on coding the logic.
EDIT: I am using Javascripts pattern.test(string)

A: You really don't need a regex here...
if (str.indexOf("password") === -1) {
    // use str
}

A: Simple: you need to anchor the regex, and maybe add a quantifier...
^((?!password).)+$

The $ is not entirely necessary, but better have it than not.
Your regex might be looking for matches anywhere in the string, which won't work if the part it's checking is after the p in password.


text:
Q: Properties of stopping time for continuous stochastic process and partial proof verification I'm attempting to solve the following problem, am struggling with part (a) and would like to verify my solution for part (b):

My attempt:
Part (a): We have $$E(a(T_r)) = E\left(E\left(\sup_{0 \le s \le T_r} X_s\right)\right) \ge E\left(E\left(\sup_{0 \le s \le T_r} X_s\right) \mathbf{1}(T_r < \infty)\right) \\
= E\left(E\left(X_{T_r}\right) \mathbf{1}(T_r < \infty) \right) = r P(T_r < \infty)$$
where the inequality follows since the $X_t$ are non-negative and the latter two equalities follow since $X_s < r$ on $s < T_r$ and $X_{T_r} = r$ whenever $T_r$ is finite.  Thus it suffices to show that $P(T_r < \infty) \ge 1/2$, although there might be an easier way to approach the problem (or it may be impossible to show this).
Part (b): This I can do (I think).  Since $a$ is concave and strictly increasing, $a^{-1}$ is well defined for input on $[0, \infty)$ (not so sure about $\infty$ because I can't prove that $a$ is not bounded yet), increasing and convex.  Thus we may apply Jensen's inequality: $$E(T_r) = E(a^{-1}(a(T_r))) \ge a^{-1}(E(a(T_r)) \ge a^{-1}(1/2)$$ where the last inequality uses the (yet to be proven) part (a).


text:
Q: golang: convert IPv4 and IPv6 addresses from text to binary form looking to send an ipv4 address across in 4 bytes, and ipv6 address in 16 bytes - What's similar to inet_pton() in go?
struct sockaddr_in sa;
char str[INET_ADDRSTRLEN];
inet_pton(AF_INET, "192.0.2.33", &(sa.sin_addr));

struct sockaddr_in6 sa;
char str[INET6_ADDRSTRLEN];
inet_pton(AF_INET6, "2001:db8:8714:3a90::12", &(sa.sin6_addr));

I know of https://play.golang.org/p/jn8t7zJzT5v - that is looking complicated for IPV6 addresses though.
Thanks!

A: net.ParseIP() will take an IPv4 or IPv6 formatted string and return a net.IP containing the IP address.
The net.IP is what you'll need to feed to most other Go functions, such as to make a connection to the host.
Note that unlike most Go functions which return an error, net.ParseIP() simply returns nil if the string could not be parsed into an IP address.
https://play.golang.org/p/Cgsrgth7JKY

A: Either you can use the net package:
`
a := net.ParseIP("127.0.0.1")
fmt.Printf("%b %s", net.IP.To4(a))

`
https://play.golang.org/p/KzqYpk9OBh8
Or, you can split the IP and convert each value into an integer using strconv.Atoi(), and thereafter convert each integer into byte()
`
ipString := "127.0.0.1"

octets := strings.Split(ipString, ".")

octet0, _ := strconv.Atoi(octets[0])
octet1, _ := strconv.Atoi(octets[1])
octet2, _ := strconv.Atoi(octets[2])
octet3, _ := strconv.Atoi(octets[3])

b := [4]byte{byte(octet0),byte(octet1),byte(octet2),byte(octet3)}

fmt.Printf("%s has 4-byte representation of %b\n", ipString, b)

`
https://play.golang.org/p/2F3bC0df9wB


text:
Q: \hrulefill and \dotfill The LaTeX2e sources defines \dotfill and \hrulefill as follows:

Interestingly, I noticed that in the multicolrule package, the author makes use of TeX primitives defined in L3 syntax as follows:

Of course, this caught my attention, and I found several similar TeX primitives like \mode_leave_vertical:, \tex_leaders:D, \tex_hrule:D, \tex_hfill:D, etc. Unfortunately, I couldn't find the \hrulefill nor \dotfill defined in the sources3.pdf nor interface3.pdf.
How can these well-defined commands, \hrulefill nor \dotfill, be rewritten using L3 syntax? I am asking just in the scope of learning.


text: Q: Comparing Mann-Whitney U Statistics as the title states, I am wondering whether there are common ways to compare Mann-Whitney U Statistics. I have a unique dataset in which each sample has been acquired via two different methods. I have $H_{0} : X_{1,i} = X_{2,i}$, $H_a : X_{1,i} < X_{2,i}$ as in the natural Mann-Whitney U Test, $i \in \{1, 2\}$, and will be quantified with the Mann-Whitney U Statistic. What I am then interested is whether this effect is more, or less, substantial in $i=1$ vs $i=2$. Any ideas how to test whether one mann-whitney statistic exceeds another?


text:
Q: Python - How to make a class method that receives any number of args and returns a list of all args? I created a Class called Manager as a sub-class of Employee and am trying to create a regular method for addind employees to the manager's supervision. However I want this method to receive any number of arguments (number of employees) so I added the * when defining the method:
class Employee:

    def __init__(self, first, last, pay):
        self.first = first
        self.last = last
        self.pay = pay

    # Returns employees fullname
    def fullname(self):
        return '{} {}'.format(self.first, self.last)

class Manager(Employee):

    def __init__(self, first, last, pay, employees=None):
        super().__init__(first, last, pay)
        if employees is None:
            self.employees = []
        else:
            self.employees = employees

    def add_emp(self, *emp):           # Accept any no. of args
        if emp not in self.employees:
            self.employees.append(emp)

    def print_emps(self):              # Prints all employees' names
        for emp in self.employees:
            print('-->', emp.fullname())

When I run the code addind emps like (emp_1, emp_2, emp_3) they're added, but when it comes to print their name an error occurs:
emp_1 = Employee('Corey', 'Schafer', 50000)
emp_2 = Employee('Test', 'User', 60000)
mng_1 = Manager('Roger', 'Smith', 100000)

mng_1.add_emp(emp_1, emp_2)
mng_1.print_emps()

AttributeError: 'tuple' object has no attribute 'fullname'

How could input as many args as I want as a list so the attributes and methods of the class remain working for each item?

A: Change your add_emp method like this:
def add_emp(self, *emps):           # Accept any no. of args
    for emp in emps:
        if emp not in self.employees:
            self.employees.append(emp)


text:
Q: Can a Sharepoint 2010 WebPart property be configured as user-specific only? Background: I have developed a couple of SharePoint 2010 web parts using Visual Studio with custom properties.  I have also been able to set these properties with code so that they persist.  I also know that SharePoint users can personalize pages & web parts with their own property values etc.
Question: Is it possible to set up a property that is always only user-specific?
In other words, I want my web part to have a property that starts out blank and is assigned a value once a user performs an action within the web part, but that value is specific to that user.  Other users viewing the page would need to perform that action to get their own value.  I would like for this to happen without the users having to manually personalize the page.
I tried setting attributes:
Personalizable( PersonalizationScope.User )

and later added
WebPartStorage( Storage.Personal )

and did some testing, but the value set by the first user always persisted to the second.
We haven't done a lot with personalization, so I'm really just curious if this is even possible.

A: You should be able to add an attribute [Personalizable(true)].
The WebPartStorage property (with Storage.Shared and Storage.Personal) is a holdover from the older API for SharePoint 2003, as documented here.
Take a look at Microsoft's walkthrough article here: Creating a Custom Web Part Editor in SharePoint 2010

The Web Part declares a private variable _tabList as a collection of TabData objects. This collection is wrapped through the TabList property. The property returns an empty collection if _tabList is null. The property is also marked Personalizable, to enable users to customize the tabs.
[...]
// Collection of tabs.
private List<TabData> _tabList;
// Property to hold the collection of tabs.
// Set the Personalizable attribute to true,
// to allow for personalization of tabs by users.
[Personalizable(true)]
public List<TabData> TabList {
    get
    {
        if (this._tabList == null)
        {
            // Return an empty collection if null.
            this._tabList = new List<TabData>();
        }
        return this._tabList;
    }
    set
    {
        this._tabList = value;
    }
}

For more reading, check out Microsoft's documentation here: About Web Part Page personal and shared views
Notably, consider the following excerpt:

When a Web Part page is in personal page view, you:

*

*Can usually view and modify the Layout and Appearance common Web Part properties, but not the Advanced ones. In some cases, the developer of a Web Part may decide not to display some or all common properties or you may not have permission to see them.

*Can view and modify custom Web Part properties. In some cases, the developer of a Web Part may decide not to display some or all custom properties or you may not have permission to see them.

*Can view and modify, but not delete, shared Web Parts with appropriate permission. Once you modify a shared Web Part, however, it becomes a personalized Web Part.

*Can view and modify, but not delete, personalized Web Parts. The modified property values of these Web Parts apply only to you.

*Can view, modify, and delete private Web Parts. These Web Parts only apply to you, no other users can see them, even in shared view.

By default, only Layout and Appearance properties are customized to the current user when editing a page in personal view. Custom properties are shared unless you explicitly make them personalizable.


text:
Q: ODP.Net - OracleDataReader.Read very slow I'm having a lot of trouble with the OracleDataReader in ODP.Net.  Basically, I have a parameterized query that takes anywhere from 1-5 seconds to run (returning around 450 records) and then takes 60-90 seconds to loop over (with no code even running in the loop, literally iterating over the recordset and doing nothing).
When I run it from Aqua Data Studio it takes 1-5 seconds.
When I run it from .Net it takes 1-5 seconds for cmd.ExecuteReader() to return.
When I loop over the 450 records with OracleDataReader.Read it takes 60-90 seconds to finish.
I even took out all of the code in the loop and just had a blank "While dr.Read" and it still took 60 to 90 seconds to loop over those 450 records (I used a Stopwatch to get the time for the cmd.ExecuteReader and then around the empty dr.Read loop).
I have tried setting the FetchSize, it didn't help (and, it's only 450 records in my test case).
I have tried turning auto tuning off with the connection string, it degraded performance even more.
Why is the OracleDataReader.Read taking so long when it's a small amount of data being returned (and other tools return the same data for the same query in a fraction of the time)?
    Using conn As New Oracle.DataAccess.Client.OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings("oracle_dss").ConnectionString)
    conn.Open()
    Using cmd As OracleCommand = conn.CreateCommand
        cmd.BindByName = True
        cmd.CommandText = ""  ' removed SQL to make this more readable

        ' Month end
        Dim paramMonthEndDate As OracleParameter = cmd.CreateParameter
        paramMonthEndDate.ParameterName = ":month_end_date"
        paramMonthEndDate.DbType = DbType.Date
        paramMonthEndDate.Value = monthEnd
        cmd.Parameters.Add(paramMonthEndDate)

        Dim sw As New System.Diagnostics.Stopwatch
        sw.Start()

        cmd.FetchSize = 1000
        Dim dr As OracleDataReader = cmd.ExecuteReader
        dr.FetchSize = dr.RowSize * 1000

        sw.Stop()
        Me.Log(String.Format("Month End Query: {0}s", sw.ElapsedMilliseconds / 1000))

        sw.Reset()
        sw.Start()

        While dr.Read

        End While

        sw.Stop()

        Me.Log(String.Format("Month End Query through recordset: {0}s", sw.ElapsedMilliseconds / 1000))

        dr.Close()
            End Using
    conn.Close()
End Using

A: Work with your DBAs and ask them to capture an explain plan for both the stand alone run (aqua data studio) and your odp.net call and confirm they are in fact the same.  If they are not, then that will probably explain your problem.  You can then try adding "enlist=false" to your connection string but better yet have the DBA's update the statistics on the related tables, hopefully fixing the slow plan.  See https://stackoverflow.com/a/14712992/852208 for more info.
I have had this same issue and it came down to oracle being less optimistic about the execution plan when a distributed transaction could be involved.

A: May be I am wrong, but you actually fetch the data in this row:  While dr.Read, and not when you are executing the reader. So this can explain why even without doing nothing, dr.Read take all your time.
I'd try to change your command to
1). Run plain sql (without parameters)
2). Run using regular (not binding variable) parameter
3). Move the sql code to Stored Procedure if possible


text:
Q: How do you convert a text file to CSV file while keeping text file format using JS? I am reading in a text file with some data that looks like this:
This is my file
showing some data
data1 = 12
data2 = 156

I want to convert this data into a CSV file while keeping the same format of the text file, like this:
This,is,my,file
showing,some,data
data1,=,12
data2,=,156

My first attempt was to read the text file into a string. The split that string into an array, splitting it at every ' ' (space) char. However, that doesn't seem to work.
I also attempted to split the string into an array at every 'newline' char but it doesn't seem to work.
Can anyone guide me in the right direction? Or how should I go about doing this?
Thanks

A: You should be able to:

*

*split on line breaks

*split on white space

*join with commas

*join with new lines:

let s = `This is my file
showing some data
data1 = 12
data2 = 156`

let text = s.split('\n')                               // split lines
            .map(line => line.split(/\s+/).join(','))  // split spaces then join with ,
            .join('\n')                                // rejoin lines

console.log(text)

You could also just replace all non-linebreak whitespace with commas:

let s = `This is my file
showing some data
data1 = 12
data2 = 156`

console.log(s.replace(/[^\S\n]+/g, ','))

A: Try str.replace(/ /g, ',');
Code

str = "This is my file\n\
showing some data\n\
data = 12\n\
data2 = 156";

document.write((str.replace(/ /g, ',')).replace(/\n/g,"<br />"));


text:
Q: convert tf.dense Tensor to tf.one_hot Tensor on Graph execution Tensorflow TF version: 2.11
I try to train a simple 2input classifier with TFRecords tf.data pipeline
I do not manage to convert the tf.dense Tensor with containing only a scalar to a tf.onehot vector
    # get all recorddatasets abspath
    training_names= [record_path+'/'+rec for rec in os.listdir(record_path) if rec.startswith('train')]

    # load in tf dataset
    train_dataset = tf.data.TFRecordDataset(training_names[1])
    train_dataset = train_dataset.map(return_xy)

mapping function:
def return_xy(example_proto):

    #parse example
    sample= parse_function(example_proto)

    #decode image 1
    encoded_image1 = sample['image/encoded_1']
    decoded_image1 = decode_image(encoded_image1)

    #decode image 2
    encoded_image2 = sample['image/encoded_2']
    decoded_image2 = decode_image(encoded_image2)

    #decode label
    print(f'image/object/class/'+level: {sample['image/object/class/'+level]}')

    class_label = tf.sparse.to_dense(sample['image/object/class/'+level])
    print(f'type of class label :{type(class_label)}')
    print(class_label)

    # conversion to onehot with depth 26 :: -> how can i extract only the value or convert directly to tf.onehot??
    label_onehot=tf.one_hot(class_label,26)

    #resizing image
    input_left=tf.image.resize(decoded_image1,[416, 416])
    input_right=tf.image.resize(decoded_image2,[416, 416])
    return {'input_3res1':input_left, 'input_5res2':input_right} ,  label_onehot

output:
image/object/class/'+level: SparseTensor(indices=Tensor("ParseSingleExample/ParseExample/ParseExampleV2:14", shape=(None, 1), dtype=int64), values=Tensor("ParseSingleExample/ParseExample/ParseExampleV2:31", shape=(None,), dtype=int64), dense_shape=Tensor("ParseSingleExample/ParseExample/ParseExampleV2:48", shape=(1,), dtype=int64))

type of class label :<class 'tensorflow.python.framework.ops.Tensor'>
Tensor("SparseToDense:0", shape=(None,), dtype=int64)

However I am sure that the label is in this Tensor because when run it eagerly
raw_dataset = tf.data.TFRecordDataset([rec_file])
parsed_dataset = raw_dataset.map(parse_function) # only parsing

for sample in parsed_dataset:
    class_label=tf.sparse.to_dense(sample['image/object/class/label_level3'])[0]
    print(f'type of class label :{type(class_label)}')
    print(f'labels  from labelmap :{class_label}')

I get output:
type of class label :<class 'tensorflow.python.framework.ops.EagerTensor'>
labels  from labelmap :7

If I just chose a random number for the label and pass it to tf_one_hot(randint, 26) then the model begins to train (obviously nonsensical).
So the question is how can i convert the:
Tensor("SparseToDense:0", shape=(None,), dtype=int64)
to a
Tensor("one_hot:0", shape=(26,), dtype=float32)
What  I tried so far
in the call data.map(parse_xy)
i tried to just call .numpy() on the tf tensors but didnt work , this only works for eager tensors.
In my understanding i cannot use eager execution because everthing in the parse_xy function gets excecuted on the whole graph:
ive already tried to enable eager execution -> failed
https://www.tensorflow.org/api_docs/python/tf/config/run_functions_eagerly
Note: This flag has no effect on functions passed into tf.data transformations as arguments.
 tf.data functions are never executed eagerly and are always executed as a compiled Tensorflow Graph.

ive also tried to use the tf_pyfunc but this only returns another tf.Tensor with an unknown shape
def get_onehot(tensor):
    class_label=tensor[0]
    return tf.one_hot(class_label,26)

and add the line in parse_xy:
    label_onehot=tf.py_function(func=get_onehot, inp=[class_label], Tout=tf.int64)

but there i always get an unknown shape which a cannot just alter with .set_shape()

A: I was able to solve the issue by only using TensorFlow functions.
tf.gather allows to index a TensorFlow tensor:
class_label_gather = tf.sparse.to_dense(sample['image/object/class/'+level])
class_indices = tf.gather(tf.cast(class_label_gather,dtype=tf.int32),0)
label_onehot=tf.one_hot(class_indices,26)


text:
Q: LinkedLIst indexOf recursive implementation I'm having a hard time understanding how the recursion in following implementation of indexOf() of LinkedList works:
/**
 * Returns the position of the first occurrence of the
 * given character in this list, or -1 if there is no
 * such occurrence.
 */
public int indexOf(char c)
{
    if (this.head == null)
    {
        return -1;
    }
    else
    {
        return LinkedList.indexOf(c, this.head);
    }
}
private static int indexOf(char c, Node node)
{
    if (node.data == c)
    {
        return 0;
    }
    if (node.next == null)
    {
        return -1;
    }
    int index = LinkedList.indexOf(c, node.next);
    if (index == -1)
    {
        return -1;
    }
    else
    {
        return 1 + index;
    }
}

where head is the initial node ("link") in the list.
The static indexOf() method checks whether there's a data match in the head, and then whether there exists a next node. Assume both conditions are false (there's no data match and there exists a next node). Then indexOf() is called recursively on the next (second) node to perform the same checks. However, if both conditions are still false, what does it return to int index given that there's no else clause before index is declared? That doesn't seem legal.
When I stepped through it in the debugger, rather than returning anything it actually seems to do more recursive calls until one of the if conditions is met (either there's a data match or the end of the list is reached). But why would it do that? And then how is 1 being added to the index each time?

A:
However, if both conditions are still false, what does it return to int index given that there's no else clause before index is declared?

It will return nothing yet, it will enter another level of recursion:
indexOf(node) -> indexOf(node.next) -> indexOf(node.next.next) -> ...

Then when the conditions are met it finally returns a value and you start to come back from each recursion call you made before:
indexOf(node) <- indexOf(node.next) <- indexOf(node.next.next) <- ...

but doing so it will also add 1 to the index it is returning, therefore basically counting the recursion levels you reached which equal to the node number you reached which is the index you are looking for.
This diagram shows how the algorithm works when there is a match on the fourth node. The blue color indicates that we are entering recursion, the red color indicates that we are coming back from recursion (click the image to open it in its original size):

This other diagram shows the order of execution of the instructions in case of a match on the third node (click the image to open it in its original size):


text:
Q: Office.context.mailbox.diagnostics.hostName returns incorrect value for Outlook on a Mac When using OfficeJS to determine what office client is being used, I am calling  Office.context.mailbox.diagnostics.hostName but am given Outlook for users on Outlook for Mac when I expect to get Mac Outlook
According to https://github.com/OfficeDev/office-js-docs/blob/master/reference/outlook/Office.context.mailbox.diagnostics.md, the possible values for the hostname can be Outlook, Mac Outlook, OutlookIOS, or OutlookWebApp
I am using the latest OfficeJs from https://appsforoffice.microsoft.com/lib/1/hosted/office.js

A: We are working to fix this issue. Meanwhile, as a workaround you can use useragent in your add in to identify the browser. We will let you know as soon as this issue is fixed.

A: The documentation has been changed to remove any mention of Mac Outlook. It now suggests that the output will be Outlook when on a Mac client.

A: Currently, you can use Browser UserAngent to detect add-in is running on Outlook App for Mac.

Office.initialize = function () {
    //if Add-in is opening in Outlook App for MAC.
    var OutlookHost = Office.context.mailbox.diagnostics.hostName;
    var platform = navigator.platform;
    if (OutlookHost !== null && OutlookHost !== undefined && OutlookHost === "Outlook" && platform != null && platform.toLowerCase().indexOf("mac") >= 0) {
        return true;
    }
 }

navigator.platform will return:
"MacIntel"


text:
Q: Delete data table with left join I do not understand MySQL delete when I need to delete data in a table with data from another table that depend on it.
For example if I want to delete a data in table 'factory', all data at table 'room' that depends on data at table 'factory is also deleted'.
Fac_ID is the primary key in 'factory' and foreign key in 'room'
below is my SQL code.
DELETE * FROM factory
LEFT JOIN room ON room.Fac_ID = factory.Fac_ID
WHERE factory.Fac_ID = :Fac_ID

Can any one help me?

A: I think you need a separate delete for this.
First is to delete foreign data
delete from room where Fac_ID = :Fac_ID

Then delete primary data
delete from factory where Fac_ID = :Fac_ID

Unless your table design is ON DELETE CASCADE (supported only in INNODB), you only need to delete the primary data

A: There is a small mistake in your query because of which I think you are facing problem.
As per my understanding you have some records in Main table and some records in refrenced table. There are some case for which main table has some id but there is not entry in refrence table for that id. And for handling that case you applied left join.
But in your query you wrote reference table on left so basically it is taking all of the record from reference table which is kind of inner join in this case.
So for correcting this you need to interchange the key id pass in your query or you may use right join to select all records from main table.
DELETE * FROM factory
LEFT JOIN room ON factory.Fac_ID = room.Fac_ID    --- here you applied left join
WHERE factory.Fac_ID = :Fac_ID

A: MySQL allows you to delete rows from multiple tables at the same time.  The syntax is:
DELETE f, r
    FROM factory f LEFT JOIN
         room r
         ON r.Fac_ID = f.Fac_ID
    WHERE f.Fac_ID = :Fac_ID;

However, this is better set up as a cascading delete foreign key relationship between the two tables.


text:
Q: How to add nested object instead of replacing an existing one in ElasticSearch with PHP I have a "list" of users with an "addresses" property. A user can have multiple addresses. I used the nested type for addresses. Inside my addresses, I have a "rooms" property for which I also used the nested type.
In my frontend, I have a form allowing users to add new rooms. When doing so, the can add a room to an existing address or create a new one.
When I create a new address, the existing address is replaced by the new one. I need the new address to be added so that I have an array of addresses. If I use an existing address, I need the new room to be added to that address.
My index
$params = [
    'index' => 'users',
    'body' => [
        'settings' => [
            'number_of_shards' => 3,
            'number_of_replicas' => 2
        ],
        'mappings' => [
            'properties' => [
                'firstname' => [
                    'type' => 'text'
                ],
                'surname' => [
                    'type' => 'text'
                ],
                'email' => [
                    'type' => 'text'
                ],
                "addresses" => [
                    'type' => 'nested',
                   'properties' => [
                       "id" => [
                           'type' => 'integer'
                       ],
                       "address" => [
                           'type' => 'text'
                       ],
                       "zipcode" => [
                           'type' => 'text'
                       ],
                       "city" => [
                           'type' => 'text'
                       ],
                       "country" => [
                           'type' => 'text'
                       ],
                       "rooms" => [
                           'type' => 'nested',
                           'properties' => [
                               "id" => [
                                   'type' => 'integer'
                               ],
                               "name" => [
                                   'type' => 'text'
                               ],
                           ]
                       ]
                   ]
               ]
            ]
        ]
    ]
];
$response = $client->indices()->create($params);

The update function
$params = [
    'index' => 'users',
    'id'    => $user_id,
    'body' => [
        'doc' => [
            'addresses' => [
                "id" => $address->id,
                "address" => $address->address,
                "zipcode" => $address->zipcode,
                "city" => $address->locality,
                "country" => $address->country,
                "rooms" => [
                    "id" => $room->id,
                    "name" => $room->room_name,
                ]
            ]
        ]
    ]
];
$client->update($params);

How can I add a new address ?

A: You can use the add method in a painless script :
$params = [
 'index' => 'users',
  'id'    => $user_id,
  'body' => [
        'script' => [
        'lang' => "painless",
        'inline' => "ctx._source.addresses.add(params.data)",
        'params' => [
            'data' => [
                "id" => $address->id,
                "address" => $address->address,
                "zipcode" => $address->zipcode,
                "city" => $address->locality,
                "country" => $address->country,
                "rooms" => [
                    "id" => $room->id,
                    "name" => $room->room_name,
            ]
        ]
    ]
  ]
];

$result = $client->update($params);

As a side note :
Object field type let to do searches like:
"Property A and/or B on any of the addresses"
Nested field type searches like:
"Property A and/or B on the same address"
Not all nested fields needs to be of nested type. Only if you need to keep the relation between properties of the same children to do queries.

A: I found the solution using a painless script as suggested by llermaly. I had to adapt some things and I added a condition to be able to add rooms to an existing address.
Note: In the form I use to add new rooms, the user can select an existing address on create a new one. I have to check if the address is a new one or not and adapt my code...
if($request->existing_id === 0) {  // if 0 -> the address is a new one
  $params = [
   'index' => 'users',
    'id'    => $user_id,
    'body' => [
        'script' => [
        'lang' => "painless",
        'inline' => "if (!(ctx._source.addresses instanceof Collection)) {ctx._source.addresses = new ArrayList(); ctx._source.addresses.add(params.data)} else {ctx._source.addresses.add(params.data)}",
        'params' => [
            'data' => [
                "id" => $address->id,
                "address" => $address->address,
                "zipcode" => $address->zipcode,
                "city" => $address->locality,
                "country" => $address->country,
                "rooms" => [
                    "id" => $room->id,
                    "name" => $room->room_name,
            ]
        ]
      ]
    ]
  ];
} else {
  // first I need to know the index of the selected address
  $params = [
    'index' => 'users',
    'id'    => $request->user
  ];
  $response = $client->get($params);
  $addresses = $response["_source"]["addresses"];
  $targetAddress = array_search($address->id, array_column($addresses, 'id'));

  // Then, I can add a room to it
  $params = [
    'index' => 'users',
    'id'    => $request->user,
    'body' => [
      'script' => [
        'lang' => "painless",
        "source" => "if (!(ctx._source.addresses[".$targetAddress."].rooms instanceof Collection)) {ctx._source.addresses[".$targetAddress."].rooms = new ArrayList(); ctx._source.addresses[".$targetAddress."].rooms.add(params.data)} else {ctx._source.addresses[".$targetAddress."].rooms.add(params.data)}",
        'params' => [
          'data' => [
            "id" => $room->id,
            "name" => $room->room_name,

          ]
        ]
      ]
    ]
  ];
  $client->update($params);
}

$result = $client->update($params);