问:
CSS Dropdown Menu, Visible not working
EDIT: Just incase anyone in the future finds this i found the solution was to change from using visibility: to display: , so in the code

visibiliy:hidden; becomes display:none;
visibiliy:visible; becomes display:block;

Have not ever found out exactly why it visibility doesn't work on the 4th nesting but atleast this appears to fix it

Hi Guys,

I am currently working with a dropdown menu that is created using some CSS and lists. It is working fine but for some reason the 4th level of this menu is not listening to the visibility:hidden; command. According to element inspector The element is listed as being enabled but it is not actually doing it.

An example is here: http://dev.hutchup.com/test/css-dropdown.htm

I wont past code as it is too log and can be see at the link above

As you can see the first level 2 link when hovered over displays level's 3 and 4 when it should only display 3, and then when an li in 3 is rolled over it will display 4th level.

I know there are many easier ways to do this/ prebuilt thing but i need to do it this way so that i can use the ACL component for joomla and have menu items not display .

Ive spent hours and cant get it fixed so thank you in advance!

答:
Not sure, but this many levels of nesting is scary business and in this day and age probably better handled by some simple JavaScript with fallback (especially if it's tons of nested levels), although I did notice two things ;

It looks to me that you're not specifying any styles for the fourth level. You may want to add a few to see if that is your problem.

You've got some CSS that looks
like this ;

```<code>   .moduletable_topmenu ul.menu li.item69 a {
    height: 2.5em;
   }
   */

   /*
   .moduletable_topmenu ul.menu li.item89 {
    height: 3.7em;
   }

   .moduletable_topmenu ul.menu li.item89 a {
    height: 2.5em;
   }
</code>```

These li.item[n] items are either leftover from something else or some future ideas not implemented, but they certainly do not apply to the menu in question.

Title: CSS Dropdown Menu, Visible not working

Body:
Not sure, but this many levels of nesting is scary business and in this day and age probably better handled by some simple JavaScript with fallback (especially if it's tons of nested levels), although I did notice two things ;

It looks to me that you're not specifying any styles for the fourth level. You may want to add a few to see if that is your problem.

You've got some CSS that looks
like this ;

   .moduletable_topmenu ul.menu li.item69 a {
    height: 2.5em;
   }
   */

   /*
   .moduletable_topmenu ul.menu li.item89 {
    height: 3.7em;
   }

   .moduletable_topmenu ul.menu li.item89 a {
    height: 2.5em;
   }

These li.item[n] items are either leftover from something else or some future ideas not implemented, but they certainly do not apply to the menu in question.


来源: stackexchange

问:
Pandas - Groupby and aggregate over multiple columns
I am trying to aggregate values in a groupby over multiple columns. I come from the R/dplyr world and what I want is usually achievable in a single line using group_by/summarize. I am trying to find an equivalently elegant way of achieving this using pandas.

Consider the below Input Dataset. I would like to aggregate by state and calculate the column v1 as v1 = sum(n1)/sum(d1) by state.

The r-code for this using dplyr is as follows:

input %>% group_by(state) %>%
  summarise(v1=sum(n1)/sum(d1),
            v2=sum(n2)/sum(d2))
```

<p>Is there an elegant way of doing this in Python? I found a slightly verbose way of getting what I want in on a stack overflow answer here.
Copying over modified <strong>python-code</strong> from the link</p>

<pre class="lang-py prettyprint-override"><code>In [14]: s = mn.groupby('state', as_index=False).sum()

In [15]: s['v1'] = s['n1'] / s['d1']

In [16]: s['v2'] = s['n2'] / s['d2']
In [17]: s[['state', 'v1', 'v2']]
</code>```

INPUT DATASET

```<code>state n1    n2     d1  d2
CA   100   1000    1   2
FL   200   2000    2   4
CA   300   3000    3   6
AL   400   4000    4   8
FL   500   5000    5   2
NY   600   6000    6   4
CA   700   7000    7   6
</code>```

OUTPUT

```<code>state   v1           v2
AL      100   500.000000
CA      100   500.000000
NY      100  1500.000000
CA      100  1166.666667
FL      100  1166.666667
</code>```

答:
One possible solution with DataFrame.assign and DataFrame.reindex:

```<code>df = (mn.groupby('state', as_index=False)
        .sum()
        .assign(v1 = lambda x: x['n1'] / x['d1'], v2 = lambda x: x['n2'] / x['d2'])
        .reindex(['state', 'v1', 'v2'], axis=1))

print (df)
  state     v1           v2
0    AL  100.0   500.000000
1    CA  100.0   785.714286
2    FL  100.0  1166.666667
3    NY  100.0  1500.000000
</code>```

And another with GroupBy.apply and custom lambda function:

```<code>df = (mn.groupby('state')
        .apply(lambda x: x[['n1','n2']].sum() / x[['d1','d2']].sum().values)
        .reset_index()
        .rename(columns={'n1':'v1', 'n2':'v2'})
      )
print (df)
  state     v1           v2
0    AL  100.0   500.000000
1    CA  100.0   785.714286
2    FL  100.0  1166.666667
3    NY  100.0  1500.000000
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am trying to aggregate values in a groupby over multiple columns. I come from the R/dplyr world and what I want is usually achievable in a single line using group_by/summarize. I am trying to find an equivalently elegant way of achieving this using pandas.

Consider the below Input Dataset. I would like to aggregate by state and calculate the column v1 as v1 = sum(n1)/sum(d1) by state.

The r-code for this using dplyr is as follows:

input %>% group_by(state) %>%
  summarise(v1=sum(n1)/sum(d1),
            v2=sum(n2)/sum(d2))

Is there an elegant way of doing this in Python? I found a slightly verbose way of getting what I want in on a stack overflow answer here.
Copying over modified python-code from the link

In [14]: s = mn.groupby('state', as_index=False).sum()

In [15]: s['v1'] = s['n1'] / s['d1']

In [16]: s['v2'] = s['n2'] / s['d2']
In [17]: s[['state', 'v1', 'v2']]

INPUT DATASET

state n1    n2     d1  d2
CA   100   1000    1   2
FL   200   2000    2   4
CA   300   3000    3   6
AL   400   4000    4   8
FL   500   5000    5   2
NY   600   6000    6   4
CA   700   7000    7   6

OUTPUT

state   v1           v2
AL      100   500.000000
CA      100   500.000000
NY      100  1500.000000
CA      100  1166.666667
FL      100  1166.666667

Body:
One possible solution with DataFrame.assign and DataFrame.reindex:

df = (mn.groupby('state', as_index=False)
        .sum()
        .assign(v1 = lambda x: x['n1'] / x['d1'], v2 = lambda x: x['n2'] / x['d2'])
        .reindex(['state', 'v1', 'v2'], axis=1))

print (df)
  state     v1           v2
0    AL  100.0   500.000000
1    CA  100.0   785.714286
2    FL  100.0  1166.666667
3    NY  100.0  1500.000000

And another with GroupBy.apply and custom lambda function:

df = (mn.groupby('state')
        .apply(lambda x: x[['n1','n2']].sum() / x[['d1','d2']].sum().values)
        .reset_index()
        .rename(columns={'n1':'v1', 'n2':'v2'})
      )
print (df)
  state     v1           v2
0    AL  100.0   500.000000
1    CA  100.0   785.714286
2    FL  100.0  1166.666667
3    NY  100.0  1500.000000


问:
Why is & needed for member function pointers, not for normal function pointers?
I understand my second statement that "why & is not needed for normal function pointers" because function name itself is address of the function.

What I do not understand is why '&' is strictly needed for member function pointers?

Examples:
Normal function pointers:

```<code>int add(int a, int b) {
  return (a + b);
}

int (*fp)(int, int);

fp = add;

(*fp)(2, 3) // This would give me addition of a and b, i.e. 5
</code>```

Member function pointers:

```<code>class ABC {
  public:
    int i;
    ABC() { i = 0; }
    int addOne(int j) {
      return j + 1;
    }
};

// Member function pointer
int (ABC::*mfp)(int);
// This is what I am talking about. '&' in below line.
mfp = &ABC::addOne;
ABC abc;
std::cout << (abc.*mfp)(2) << std::endl;
</code>```

答:
It seems to me that the address-of operator is necessary for member function pointers because the right-hand side (rhs) of the declaration is a constant rather than a variable.

We wouldn't say

```<code> int (ABC::*mfp)(int);
 mfp = ABC::addOne();
</code>```

because that would be to invoke a function.

Furthermore, the scope resolution operator :: has the highest precedence in the C++ table of operator precedence:

https://github.com/MicrosoftDocs/cpp-docs/blob/master/docs/cpp/cpp-built-in-operators-precedence-and-associativity.md

The :: operator is evaluated before any other operators are on the rhs. I suppose the complier wonders "Hmmmm...what's that? That should be a function, but..." and then sees the address-of operator and knows what the developer needs.

ContentLicense: CC BY-SA 3.0

Body:
I understand my second statement that "why & is not needed for normal function pointers" because function name itself is address of the function.

What I do not understand is why '&' is strictly needed for member function pointers?

Examples:
Normal function pointers:

int add(int a, int b) {
  return (a + b);
}

int (*fp)(int, int);

fp = add;

(*fp)(2, 3) // This would give me addition of a and b, i.e. 5

Member function pointers:

class ABC {
  public:
    int i;
    ABC() { i = 0; }
    int addOne(int j) {
      return j + 1;
    }
};

// Member function pointer
int (ABC::*mfp)(int);
// This is what I am talking about. '&' in below line.
mfp = &ABC::addOne;
ABC abc;
std::cout << (abc.*mfp)(2) << std::endl;

Body:
It seems to me that the address-of operator is necessary for member function pointers because the right-hand side (rhs) of the declaration is a constant rather than a variable.

We wouldn't say

 int (ABC::*mfp)(int);
 mfp = ABC::addOne();

because that would be to invoke a function.

Furthermore, the scope resolution operator :: has the highest precedence in the C++ table of operator precedence:

https://github.com/MicrosoftDocs/cpp-docs/blob/master/docs/cpp/cpp-built-in-operators-precedence-and-associativity.md

The :: operator is evaluated before any other operators are on the rhs. I suppose the complier wonders "Hmmmm...what's that? That should be a function, but..." and then sees the address-of operator and knows what the developer needs.


问:
How to get subcollection from firestore using react-redux-firebase
I am not able to get the sub-collection from my Firestore data.

I followed the documentation here. And also looked at many other similar question on this.

I can't seem to get the array of data that i want to get.

My code:

```<code>import "../../styles/projects/ProjectDashboard.css";
import ProjectList from "./ProjectList";
import { connect } from "react-redux";
import { firestoreConnect } from "react-redux-firebase";
import { compose } from "redux";
import { Redirect } from "react-router-dom";

export class ProjectDashboard extends Component {
  render() {
    const { projects, auth } = this.props;
    if (!auth.uid) return <Redirect to="/sigin" />;
    return (
      <div className="container">
        <h2>Projects</h2>
        <ProjectList projects={projects} />
      </div>
    );
  }
}

const mapStateToProps = state => {
  console.log(state);
  return {
    projects: state.firestore.ordered.projects,
    auth: state.firebase.auth
  };
};

export default compose(
  connect(mapStateToProps),
  firestoreConnect(props => {
    return [
      {
        collection: "users",
        doc: props.auth.uid,
        subcollection: [{ collection: "projects" }]
      }
    ];
  })
)(ProjectDashboard);
</code>```

this is what i am getting now from my console :

```<code>firestore:
|-composite: undefined
|-data: {users: {…}}
|-errors: {byQuery: {…}, allIds: Array(0)}
|-listeners: {byId: {…}, allIds: Array(1)}
|-ordered:
|--users: Array(1)
|---0: {id: "o06VEyRbGDcURTmKal3gDEDZQO73", firstName: "testing", lastName: "you", userId: "o06VEyRbGDcURTmKal3gDEDZQO73"}
|---length: 1
|---__proto__: Array(0)
|--__proto__: Object
|-queries: {}
|-status: {requesting: {…}, requested: {…}, timestamps: {…}}
|-__proto__: Object
</code>```

I was thinking that my code will change this part:

```<code>|-ordered:
|--users: Array(1)
|---0: {id: "o06VEyRbGDcURTmKal3gDEDZQO73", firstName: "testing", lastName: "you", userId: "o06VEyRbGDcURTmKal3gDEDZQO73"}
</code>```

to something like this:

```<code>|-ordered:
|--projects: Array(3)
|---0: {id: "o06VEyRbGDcURTmKal3gDEDZQO73", firstName: "testing", lastName: "you", userId: "o06VEyRbGDcURTmKal3gDEDZQO73"}
|---1: {id: "o06VEyRbGDcURTmKal3gDEDZQO73", firstName: "testing", lastName: "you", userId: "o06VEyRbGDcURTmKal3gDEDZQO73"}
|---2: {id: "o06VEyRbGDcURTmKal3gDEDZQO73", firstName: "testing", lastName: "you", userId: "o06VEyRbGDcURTmKal3gDEDZQO73"}
</code>```

so i can get the array through the key. But now i am at a lost on how to change it into my sub-collection key.

答: I realised that it should be "subcollections" and not "subcollection"</p>

Body:
I am not able to get the sub-collection from my Firestore data.

I followed the documentation here. And also looked at many other similar question on this.

I can't seem to get the array of data that i want to get.

My code:

import "../../styles/projects/ProjectDashboard.css";
import ProjectList from "./ProjectList";
import { connect } from "react-redux";
import { firestoreConnect } from "react-redux-firebase";
import { compose } from "redux";
import { Redirect } from "react-router-dom";

export class ProjectDashboard extends Component {
  render() {
    const { projects, auth } = this.props;
    if (!auth.uid) return <Redirect to="/sigin" />;
    return (

Projects

        <ProjectList projects={projects} />

    );
  }
}

const mapStateToProps = state => {
  console.log(state);
  return {
    projects: state.firestore.ordered.projects,
    auth: state.firebase.auth
  };
};

export default compose(
  connect(mapStateToProps),
  firestoreConnect(props => {
    return [
      {
        collection: "users",
        doc: props.auth.uid,
        subcollection: [{ collection: "projects" }]
      }
    ];
  })
)(ProjectDashboard);

this is what i am getting now from my console :

firestore:
|-composite: undefined
|-data: {users: {…}}
|-errors: {byQuery: {…}, allIds: Array(0)}
|-listeners: {byId: {…}, allIds: Array(1)}
|-ordered:
|--users: Array(1)
|---0: {id: "o06VEyRbGDcURTmKal3gDEDZQO73", firstName: "testing", lastName: "you", userId: "o06VEyRbGDcURTmKal3gDEDZQO73"}
|---length: 1
|---__proto__: Array(0)
|--__proto__: Object
|-queries: {}
|-status: {requesting: {…}, requested: {…}, timestamps: {…}}
|-__proto__: Object

I was thinking that my code will change this part:

|-ordered:
|--users: Array(1)
|---0: {id: "o06VEyRbGDcURTmKal3gDEDZQO73", firstName: "testing", lastName: "you", userId: "o06VEyRbGDcURTmKal3gDEDZQO73"}

to something like this:

|-ordered:
|--projects: Array(3)
|---0: {id: "o06VEyRbGDcURTmKal3gDEDZQO73", firstName: "testing", lastName: "you", userId: "o06VEyRbGDcURTmKal3gDEDZQO73"}
|---1: {id: "o06VEyRbGDcURTmKal3gDEDZQO73", firstName: "testing", lastName: "you", userId: "o06VEyRbGDcURTmKal3gDEDZQO73"}
|---2: {id: "o06VEyRbGDcURTmKal3gDEDZQO73", firstName: "testing", lastName: "you", userId: "o06VEyRbGDcURTmKal3gDEDZQO73"}

so i can get the array through the key. But now i am at a lost on how to change it into my sub-collection key.


问:
How to test a "throwing an error" in Mocha having it in asyncronous code (read from db) using only callbacks (no promises, async/await)?
I want to write some tests for a method which reads from a JSON file (simulating a db) and returns the correct name, given that exists.

This is the code I have written for my method. It does throw an error when the id is not valid.

```<code>const getOne = (id, callback) => {
    ...
    fs.readFile('db.json', (err, data) => {
      if (err) {
        throw new Error('Error reading file');
      }
      const person = JSON.parse(data)
        .filter(el => el.id === id)
        .map(el => el.name);
      if (person.length === 0) {
        throw new Error('It does not match DB entry');
      }
      callback(person);
    });
    ...
</code>```

The test I have written is:

```<code>it('Should reject an invalid id', (done) => {

    api.getOne(100, (person) => {
      try {
        personFromDB = person;
      } catch (error) {

        assert.throws(() => {
          }, new Error('It does not match DB entry'));
          //done();
      }
</code>```

But it doesn't seem to pass the test. When I have the 'done()' uncommented, it passes the test, but I don't think it is because I pass the actual test, but rather because the test gets in the catch and executes the done() callback.

Any help, guidance or recommendation is much appreciated.

答:
You won't be able to catch an Error being thrown in the fs.readFile callback.

Instead, pass any errors to the callback you pass to getOne.

Then you can check if an Error got passed to your callback in your test.

Here is a working example to get you started:

```<code>const fs = require('fs');
const assert = require('assert');

const api = {
  getOne: (id, callback) => {
    // ...
    fs.readFile('db.json', (err, data) => {
      if (err) return callback(err);  // <= pass err to your callback
      const person = JSON.parse(data)
        .filter(el => el.id === id)
        .map(el => el.name);
      if (person.length === 0) return callback(new Error('It does not match DB entry'));  // <= pass the Error to your callback
      callback(null, person);  // <= call the callback with person if everything worked
    })
  }
}

it('Should reject an invalid id', done => {
  api.getOne(100, (err, person) => {
    assert.strictEqual(err.message, 'It does not match DB entry');  // Success!
    done();
  });
});
</code>```

Body:
I want to write some tests for a method which reads from a JSON file (simulating a db) and returns the correct name, given that exists.

This is the code I have written for my method. It does throw an error when the id is not valid.

const getOne = (id, callback) => {
    ...
    fs.readFile('db.json', (err, data) => {
      if (err) {
        throw new Error('Error reading file');
      }
      const person = JSON.parse(data)
        .filter(el => el.id === id)
        .map(el => el.name);
      if (person.length === 0) {
        throw new Error('It does not match DB entry');
      }
      callback(person);
    });
    ...

The test I have written is:

it('Should reject an invalid id', (done) => {

    api.getOne(100, (person) => {
      try {
        personFromDB = person;
      } catch (error) {

        assert.throws(() => {
          }, new Error('It does not match DB entry'));
          //done();
      }

But it doesn't seem to pass the test. When I have the 'done()' uncommented, it passes the test, but I don't think it is because I pass the actual test, but rather because the test gets in the catch and executes the done() callback.

Any help, guidance or recommendation is much appreciated.

Body:
You won't be able to catch an Error being thrown in the fs.readFile callback.

Instead, pass any errors to the callback you pass to getOne.

Then you can check if an Error got passed to your callback in your test.

Here is a working example to get you started:

const fs = require('fs');
const assert = require('assert');

const api = {
  getOne: (id, callback) => {
    // ...
    fs.readFile('db.json', (err, data) => {
      if (err) return callback(err);  // <= pass err to your callback
      const person = JSON.parse(data)
        .filter(el => el.id === id)
        .map(el => el.name);
      if (person.length === 0) return callback(new Error('It does not match DB entry'));  // <= pass the Error to your callback
      callback(null, person);  // <= call the callback with person if everything worked
    })
  }
}

it('Should reject an invalid id', done => {
  api.getOne(100, (err, person) => {
    assert.strictEqual(err.message, 'It does not match DB entry');  // Success!
    done();
  });
});


问:
Exception while starting Weblogic Managed Server
I tried to start Weblogic managed server and I'm getting the exception below:

```<code>Apr 11, 2011 10:08:16 PM PDT> <Error> <oracle.bam.adc.dse.common.DataSourceFactory> <BEA-000000> <[12] Exception occurred in method DataSourceFactory.getDataSource(jdbc/oracle/bam/adc)
Exception: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.oracle.bam/adc' didn't find subcontext 'oracle'. Resolved 'jdbc'; remaining name 'oracle/bam/adc'
  at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
  at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
  at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
  at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
  at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
  at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
  at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
  at javax.naming.InitialContext.lookup(InitialContext.java:392)
  at oracle.bam.adc.dse.common.DataSourceFactory.getDataSource(DataSourceFactory.java:132)
  at oracle.bam.adc.dse.common.DataSourceFactory.getDataSource(DataSourceFactory.java:105)
  at oracle.bam.adc.dse.common.StorageEngineFactory.startup(StorageEngineFactory.java:109)
  at oracle.bam.adc.kernel.server.DataStoreServer.startup(DataStoreServer.java:234)
  at oracle.bam.adc.kernel.server.ADCService.startService(ADCService.java:83)
  at oracle.bam.server.BamServer$ServiceEntry$1.run(BamServer.java:1716)
  at java.security.AccessController.doPrivileged(Native Method)
  at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
  at oracle.security.jps.internal.jaas.AccActionExecutor.execute(AccActionExecutor.java:47)
  at oracle.security.jps.internal.jaas.CascadeActionExecutor$SubjectPrivilegedExceptionAction.run(CascadeActionExecutor.java:79)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
  at weblogic.security.Security.runAs(Security.java:61)
  at oracle.security.jps.wls.jaas.WlsActionExecutor.execute(WlsActionExecutor.java:48)
  at oracle.security.jps.internal.jaas.CascadeActionExecutor.execute(CascadeActionExecutor.java:52)
  at oracle.bam.common.security.authentication.BamPrivilegedExceptionAction.execute(BamPrivilegedExceptionAction.java:153)
  at oracle.bam.common.security.authentication.BamPrivilegedExceptionAction.execute(BamPrivilegedExceptionAction.java:121)
  at oracle.bam.server.BamServer$ServiceEntry.start(BamServer.java:1722)
  at oracle.bam.server.BamServer.init(BamServer.java:272)
  at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
  at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
  at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
  at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
  at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
  at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
  at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
  at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
  at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
  at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
  at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
  at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
  at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
  at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
  at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
  at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
  at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
  at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
  at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
  at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
  at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
  at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
  at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
  at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
  at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
  at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
  at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:261)
  at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:246)
  at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
  at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
  at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
  at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
  at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
  at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
>
<Apr 11, 2011 10:08:16 PM PDT> <Error> <HTTP> <BEA-101216> <Servlet: "BamServer" failed to preload on startup in Web application: "/oracle/bam".
java.lang.Exception: BAM data store server failed to start.
        at oracle.bam.adc.kernel.server.DataStoreServer.startup(DataStoreServer.java:323)
        at oracle.bam.adc.kernel.server.ADCService.startService(ADCService.java:83)
        at oracle.bam.server.BamServer$ServiceEntry$1.run(BamServer.java:1716)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
        Truncated. see log file for complete stacktrace
Caused By: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.oracle.bam/adc' didn't find subcontext 'oracle'. Resolved 'jdbc'; remaining name 'oracle/bam/adc'
        at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
        at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
        at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
        Truncated. see log file for complete stacktrace
>
<Apr 11, 2011 10:08:16 PM PDT> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application 'oracle-bam [Version=11.1.1]'.
weblogic.application.ModuleException: [HTTP:101216]Servlet: "BamServer" failed to preload on startup in Web application: "/oracle/bam".
java.lang.Exception: BAM data store server failed to start.
        at oracle.bam.adc.kernel.server.DataStoreServer.startup(DataStoreServer.java:323)
        at oracle.bam.adc.kernel.server.ADCService.startService(ADCService.java:83)
        at oracle.bam.server.BamServer$ServiceEntry$1.run(BamServer.java:1716)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
        at oracle.security.jps.internal.jaas.AccActionExecutor.execute(AccActionExecutor.java:47)
        at oracle.security.jps.internal.jaas.CascadeActionExecutor$SubjectPrivilegedExceptionAction.run(CascadeActionExecutor.java:79)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
        at weblogic.security.Security.runAs(Security.java:61)
        at oracle.security.jps.wls.jaas.WlsActionExecutor.execute(WlsActionExecutor.java:48)
        at oracle.security.jps.internal.jaas.CascadeActionExecutor.execute(CascadeActionExecutor.java:52)
        at oracle.bam.common.security.authentication.BamPrivilegedExceptionAction.execute(BamPrivilegedExceptionAction.java:153)
        at oracle.bam.common.security.authentication.BamPrivilegedExceptionAction.execute(BamPrivilegedExceptionAction.java:121)
        at oracle.bam.server.BamServer$ServiceEntry.start(BamServer.java:1722)
        at oracle.bam.server.BamServer.init(BamServer.java:272)
        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
        at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
        at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
        at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
        at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
        at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
        at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
        at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
        at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
        at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:261)
        at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:246)
        at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
        at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
        at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
        at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
Caused by: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.oracle.bam/adc' didn't find subcontext 'oracle'. Resolved 'jdbc'; remaining name 'oracle/bam/adc'
        at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
        at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
        at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
        at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
        at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at oracle.bam.adc.dse.common.DataSourceFactory.getDataSource(DataSourceFactory.java:132)
        at oracle.bam.adc.dse.common.DataSourceFactory.getDataSource(DataSourceFactory.java:105)
        at oracle.bam.adc.dse.common.StorageEngineFactory.startup(StorageEngineFactory.java:109)
        at oracle.bam.adc.kernel.server.DataStoreServer.startup(DataStoreServer.java:234)
        ... 57 more

        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1510)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        Truncated. see log file for complete stacktrace
Caused By: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.oracle.bam/adc' didn't find subcontext 'oracle'. Resolved 'jdbc'; remaining name 'oracle/bam/adc'
        at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
        at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
        at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
        Truncated. see log file for complete stacktrace
>
<Apr 11, 2011 10:08:16 PM PDT> <Notice> <Log Management> <BEA-170027> <The Server has established connection with the Domain level Diagnostic Service successfully.>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 127.0.0.1:9001 for protocols iiop, iiop, t3, t3, ldap, ldap, snmp, snmp, http, http.>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 0:0:0:0:0:0:0:1:9001 for protocols iiop, t3, ldap, snmp, http.>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 10.152.105.211:9001 for protocols iiop, t3, ldap, snmp, http.>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <WebLogicServer> <BEA-000332> <Started WebLogic Managed Server "ManagedServer" for domain "bpms_poc_domain" running in Development Mode>
<Apr 11, 2011 10:08:30 PM PDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<Apr 11, 2011 10:08:30 PM PDT> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
</code>```

Due to this exception, my Oracle-BAM service doesn't start. I need to start the same.

Can someone give me pointers?

Regards,
Arvind K

答:
You need to make sure you've configured DataSource under JNDI name jdbc.oracle.bam/adc. This should be described in the administration guide.

I know that answer is too broad but that's exactly what exception you got means.

Body:
I tried to start Weblogic managed server and I'm getting the exception below:

Apr 11, 2011 10:08:16 PM PDT> <Error> <oracle.bam.adc.dse.common.DataSourceFactory> <BEA-000000> <[12] Exception occurred in method DataSourceFactory.getDataSource(jdbc/oracle/bam/adc)
Exception: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.oracle.bam/adc' didn't find subcontext 'oracle'. Resolved 'jdbc'; remaining name 'oracle/bam/adc'
  at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
  at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
  at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
  at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
  at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
  at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
  at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
  at javax.naming.InitialContext.lookup(InitialContext.java:392)
  at oracle.bam.adc.dse.common.DataSourceFactory.getDataSource(DataSourceFactory.java:132)
  at oracle.bam.adc.dse.common.DataSourceFactory.getDataSource(DataSourceFactory.java:105)
  at oracle.bam.adc.dse.common.StorageEngineFactory.startup(StorageEngineFactory.java:109)
  at oracle.bam.adc.kernel.server.DataStoreServer.startup(DataStoreServer.java:234)
  at oracle.bam.adc.kernel.server.ADCService.startService(ADCService.java:83)
  at oracle.bam.server.BamServer$ServiceEntry$1.run(BamServer.java:1716)
  at java.security.AccessController.doPrivileged(Native Method)
  at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
  at oracle.security.jps.internal.jaas.AccActionExecutor.execute(AccActionExecutor.java:47)
  at oracle.security.jps.internal.jaas.CascadeActionExecutor$SubjectPrivilegedExceptionAction.run(CascadeActionExecutor.java:79)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
  at weblogic.security.Security.runAs(Security.java:61)
  at oracle.security.jps.wls.jaas.WlsActionExecutor.execute(WlsActionExecutor.java:48)
  at oracle.security.jps.internal.jaas.CascadeActionExecutor.execute(CascadeActionExecutor.java:52)
  at oracle.bam.common.security.authentication.BamPrivilegedExceptionAction.execute(BamPrivilegedExceptionAction.java:153)
  at oracle.bam.common.security.authentication.BamPrivilegedExceptionAction.execute(BamPrivilegedExceptionAction.java:121)
  at oracle.bam.server.BamServer$ServiceEntry.start(BamServer.java:1722)
  at oracle.bam.server.BamServer.init(BamServer.java:272)
  at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
  at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
  at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
  at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
  at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
  at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
  at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
  at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
  at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
  at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
  at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
  at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
  at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
  at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
  at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
  at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
  at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
  at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
  at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
  at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
  at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
  at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
  at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
  at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
  at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
  at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
  at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
  at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
  at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:261)
  at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:246)
  at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
  at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
  at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
  at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
  at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
  at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
>
<Apr 11, 2011 10:08:16 PM PDT> <Error> <HTTP> <BEA-101216> <Servlet: "BamServer" failed to preload on startup in Web application: "/oracle/bam".
java.lang.Exception: BAM data store server failed to start.
        at oracle.bam.adc.kernel.server.DataStoreServer.startup(DataStoreServer.java:323)
        at oracle.bam.adc.kernel.server.ADCService.startService(ADCService.java:83)
        at oracle.bam.server.BamServer$ServiceEntry$1.run(BamServer.java:1716)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
        Truncated. see log file for complete stacktrace
Caused By: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.oracle.bam/adc' didn't find subcontext 'oracle'. Resolved 'jdbc'; remaining name 'oracle/bam/adc'
        at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
        at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
        at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
        Truncated. see log file for complete stacktrace
>
<Apr 11, 2011 10:08:16 PM PDT> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application 'oracle-bam [Version=11.1.1]'.
weblogic.application.ModuleException: [HTTP:101216]Servlet: "BamServer" failed to preload on startup in Web application: "/oracle/bam".
java.lang.Exception: BAM data store server failed to start.
        at oracle.bam.adc.kernel.server.DataStoreServer.startup(DataStoreServer.java:323)
        at oracle.bam.adc.kernel.server.ADCService.startService(ADCService.java:83)
        at oracle.bam.server.BamServer$ServiceEntry$1.run(BamServer.java:1716)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
        at oracle.security.jps.internal.jaas.AccActionExecutor.execute(AccActionExecutor.java:47)
        at oracle.security.jps.internal.jaas.CascadeActionExecutor$SubjectPrivilegedExceptionAction.run(CascadeActionExecutor.java:79)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
        at weblogic.security.Security.runAs(Security.java:61)
        at oracle.security.jps.wls.jaas.WlsActionExecutor.execute(WlsActionExecutor.java:48)
        at oracle.security.jps.internal.jaas.CascadeActionExecutor.execute(CascadeActionExecutor.java:52)
        at oracle.bam.common.security.authentication.BamPrivilegedExceptionAction.execute(BamPrivilegedExceptionAction.java:153)
        at oracle.bam.common.security.authentication.BamPrivilegedExceptionAction.execute(BamPrivilegedExceptionAction.java:121)
        at oracle.bam.server.BamServer$ServiceEntry.start(BamServer.java:1722)
        at oracle.bam.server.BamServer.init(BamServer.java:272)
        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
        at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
        at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
        at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
        at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
        at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
        at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
        at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
        at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
        at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:261)
        at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:246)
        at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
        at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
        at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
        at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
Caused by: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.oracle.bam/adc' didn't find subcontext 'oracle'. Resolved 'jdbc'; remaining name 'oracle/bam/adc'
        at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
        at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
        at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
        at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
        at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at oracle.bam.adc.dse.common.DataSourceFactory.getDataSource(DataSourceFactory.java:132)
        at oracle.bam.adc.dse.common.DataSourceFactory.getDataSource(DataSourceFactory.java:105)
        at oracle.bam.adc.dse.common.StorageEngineFactory.startup(StorageEngineFactory.java:109)
        at oracle.bam.adc.kernel.server.DataStoreServer.startup(DataStoreServer.java:234)
        ... 57 more

        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1510)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        Truncated. see log file for complete stacktrace
Caused By: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.oracle.bam/adc' didn't find subcontext 'oracle'. Resolved 'jdbc'; remaining name 'oracle/bam/adc'
        at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
        at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
        at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
        at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
        Truncated. see log file for complete stacktrace
>
<Apr 11, 2011 10:08:16 PM PDT> <Notice> <Log Management> <BEA-170027> <The Server has established connection with the Domain level Diagnostic Service successfully.>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 127.0.0.1:9001 for protocols iiop, iiop, t3, t3, ldap, ldap, snmp, snmp, http, http.>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 0:0:0:0:0:0:0:1:9001 for protocols iiop, t3, ldap, snmp, http.>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 10.152.105.211:9001 for protocols iiop, t3, ldap, snmp, http.>
<Apr 11, 2011 10:08:17 PM PDT> <Notice> <WebLogicServer> <BEA-000332> <Started WebLogic Managed Server "ManagedServer" for domain "bpms_poc_domain" running in Development Mode>
<Apr 11, 2011 10:08:30 PM PDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<Apr 11, 2011 10:08:30 PM PDT> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>

Due to this exception, my Oracle-BAM service doesn't start. I need to start the same.

Can someone give me pointers?

Regards,
Arvind K


问:
How to fix error in error 'InvalidArgument=Value of '7' is not valid for 'index'
I'm setting the listview to a format of backcolor if ever the loop finds the string it will trigger the event.

I've already trapped the function to the if else statement but the error still there.

```<code>foreach (ListViewItem li in listView1.Items)
        {
            for (int i = 0; i < listView1.Columns.Count; i++)
            {

                if (li.SubItems[i].Text.ToString() == "Pending")
                {
                    li.BackColor = Color.Turquoise;
                    li.ForeColor = Color.White;
                }
                else if (li.SubItems[i].Text.ToString() == "Paid")
                {
                    li.BackColor = Color.Green;
                    li.ForeColor = Color.White;
                }
                else if (li.SubItems[i].Text.ToString() == "Over Due")
                {
                    li.BackColor = Color.Red;
                    li.ForeColor = Color.White;
                }

            }

        }
</code>```

This is the error I've got. 'InvalidArgument=Value of '7' is not valid for 'index'

答:
As others have pointed out, the inner for loop is looping through the columns with the index of i. Then inside the loop there is the statement…

```<code>if (li.SubItems[i].Text.ToString() == "Pending")
</code>```

This assumes that the number ListView “SubItems” is the same number of “Columns”. It certainly is possible for these two values to be different, hence the error.

Another approach would be to simply loop through the "subitems" themselves with another foreach loop like below…

```<code>foreach (ListViewItem li in listView1.Items) {
  foreach (ListViewItem.ListViewSubItem subItem in li.SubItems) {
    if (subItem.Text.ToString() == "Pending") {
      li.BackColor = Color.Turquoise;
      li.ForeColor = Color.White;
    }
    else if (subItem.Text.ToString() == "Paid") {
      li.BackColor = Color.Green;
      li.ForeColor = Color.White;
    }
    else if (subItem.Text.ToString() == "Over Due") {
      li.BackColor = Color.Red;
      li.ForeColor = Color.White;
    }
  }
}
</code>```

Body:
I'm setting the listview to a format of backcolor if ever the loop finds the string it will trigger the event.

I've already trapped the function to the if else statement but the error still there.

foreach (ListViewItem li in listView1.Items)
        {
            for (int i = 0; i < listView1.Columns.Count; i++)
            {

                if (li.SubItems[i].Text.ToString() == "Pending")
                {
                    li.BackColor = Color.Turquoise;
                    li.ForeColor = Color.White;
                }
                else if (li.SubItems[i].Text.ToString() == "Paid")
                {
                    li.BackColor = Color.Green;
                    li.ForeColor = Color.White;
                }
                else if (li.SubItems[i].Text.ToString() == "Over Due")
                {
                    li.BackColor = Color.Red;
                    li.ForeColor = Color.White;
                }

            }

        }

This is the error I've got. 'InvalidArgument=Value of '7' is not valid for 'index'

Body:
As others have pointed out, the inner for loop is looping through the columns with the index of i. Then inside the loop there is the statement…

if (li.SubItems[i].Text.ToString() == "Pending")

This assumes that the number ListView “SubItems” is the same number of “Columns”. It certainly is possible for these two values to be different, hence the error.

Another approach would be to simply loop through the "subitems" themselves with another foreach loop like below…

foreach (ListViewItem li in listView1.Items) {
  foreach (ListViewItem.ListViewSubItem subItem in li.SubItems) {
    if (subItem.Text.ToString() == "Pending") {
      li.BackColor = Color.Turquoise;
      li.ForeColor = Color.White;
    }
    else if (subItem.Text.ToString() == "Paid") {
      li.BackColor = Color.Green;
      li.ForeColor = Color.White;
    }
    else if (subItem.Text.ToString() == "Over Due") {
      li.BackColor = Color.Red;
      li.ForeColor = Color.White;
    }
  }
}


问:
Angular detect the form change
I have a template driven form with some fields. This form won't show up until some condition evaluates to true. And I would like to get notified when the value of any of those fields changes. So I have the following code:

The HTML:

```<code><form *ngIf="aCondition" #myForm="ngForm">
...
</form>
</code>```

The component:

```<code>@ViewChild('myForm') myForm: NgForm

aCondition: boolean = false;

ngOnInit() {
    this.myForm.form.valueChanges.subscribe(...);
}

changeCondition() {
    this.aCondition = true;
    this.myForm.form.valueChanges.subscribe(...);
}
</code>```

But in both event/function, this.myForm is undefined. Any ideas?

答:
When you attach *ngIf to an element and that evaluates to false, then it won't even be rendered in the DOM. That means it won't be picked up as a ViewChild, and so will remain undefined.

Another thing to remember about ViewChild is that won't pick anything up until the AfterViewInit lifecycle hook, so any time you need attach something to a ViewChild, do it inside of ngAfterViewInit to make sure it's there.

Title: Angular detect the form change

Body:
I have a template driven form with some fields. This form won't show up until some condition evaluates to true. And I would like to get notified when the value of any of those fields changes. So I have the following code:

The HTML:

<form *ngIf="aCondition" #myForm="ngForm">
...
</form>

The component:

@ViewChild('myForm') myForm: NgForm

aCondition: boolean = false;

ngOnInit() {
    this.myForm.form.valueChanges.subscribe(...);
}

changeCondition() {
    this.aCondition = true;
    this.myForm.form.valueChanges.subscribe(...);
}

But in both event/function, this.myForm is undefined. Any ideas?


问:
run two different python programs and sync they variables
I need to run two different python programs in two different places (two droplets in Digital Ocean for example), I need to share some variables between them, and I don't really know the best way to accomplish that.

Any idea or advice will be appreciated. Thanks.

答: If the rate at which you update and use them permits and if there's no overlap, I'd store each variable in an high availability database and read them from there.</p>


问:
TextAlignment is not working dynamically for checkbox
Android.Views.Textalignment is not working dynamically

I have tried the below code:

In load time:

```<code>CheckBox checkBox = new CheckBox(this);
checkBox.TextAlignment = Android.Views.TextAlignment.ViewStart;
</code>```

Dynamically change the alignment in a button click. But alignment not updated.

```<code>checkBox.TextAlignment = Android.Views.TextAlignment.Center;
</code>```

答:
I assume that you want to change the alignment of the text in the CheckBox. This can be achieved by setting the widget's gravity to center in through code.

```<code>checkBox.setGravity( Gravity.CENTER )
</code>```

Body:
Android.Views.Textalignment is not working dynamically

I have tried the below code:

In load time:

CheckBox checkBox = new CheckBox(this);
checkBox.TextAlignment = Android.Views.TextAlignment.ViewStart;

Dynamically change the alignment in a button click. But alignment not updated.

checkBox.TextAlignment = Android.Views.TextAlignment.Center;

Body:
I assume that you want to change the alignment of the text in the CheckBox. This can be achieved by setting the widget's gravity to center in through code.

checkBox.setGravity( Gravity.CENTER )


问:
Can't access data in array after mapping it from api pull
So I have pulled some data from an api using a fetch in a React app, then I have used .map to get the data I want into arrays that I am trying to present in a table sort of format.

When I log the mapped arrays it presents the data I am after, but when I try access it to present specific elements of it it's returning undefined.

If the array in the console log shows that it has elements name and age, is there something I am doing wrong to get undefined when I try and access it? Or maybe I am accessing it the wrong way. Any help would be appreciated.

```<code>function getMap(results) {
   return results.map((res) => {
       return {name: res.name, age: res.age}
}

fetch(URL)
   .then(result) {
       let x = getMap(result.result);
       console.log(x);

///// the console log shows an array [{name: 'Peter', age: 30}]

      console.log(x.name);

///// console log returns undefined
})
</code>```

答: you aren't accessing the array correctly. Remember an array is like a "list" of things, in this case, objects. Each object has two properties, name and age. The way you are trying to access it in your second console.log, you are trying to access a .name property on the array itself. This is pretty basic, but to access an item in an array, you pass an index (starting at zero), like so: myArray[0]. So to access the name property of the first item in your array, you would use x[0].name. To iterate over the entire array, you could do x.forEach(item => console.log(item.name))

Body:
So I have pulled some data from an api using a fetch in a React app, then I have used .map to get the data I want into arrays that I am trying to present in a table sort of format.

When I log the mapped arrays it presents the data I am after, but when I try access it to present specific elements of it it's returning undefined.

If the array in the console log shows that it has elements name and age, is there something I am doing wrong to get undefined when I try and access it? Or maybe I am accessing it the wrong way. Any help would be appreciated.

function getMap(results) {
   return results.map((res) => {
       return {name: res.name, age: res.age}
}

fetch(URL)
   .then(result) {
       let x = getMap(result.result);
       console.log(x);

///// the console log shows an array [{name: 'Peter', age: 30}]

      console.log(x.name);

///// console log returns undefined
})


问:
HTML select dropdown custom arrow css
I am trying to use a custom arrow for a dropdown menu as mentioned in the code. I am facing two issues here.

1.unable to place the arrow section adjacent to the dropdwon.

2.This custom arrow is not clickable.

How can I achieve these two ?

I tried to use z-index;-1 for the :after section. But its not working as expected.

.expenses_div {

 width:90% !important;
 margin:auto;
 margin-top:2%;

}

.expenses_div_left{
 height:40px;
 line-height:40px;
 background-color:black;
 float:left;
 display: inline-block;
 text-align:left;
 padding-left:12px;
 color:white;
 width:48%;
 font-size: 14px !important;
 font-family : "Montserrat",sans-serif !important;

 }

.expenses_div_right{

 height: 40px !important;
 line-height: 40px !important;
 width:48%;
 float:left;
 display: inline-block;
 cursor:pointer;
 background:transparent !important;

}

.expenses_div_right select {

 font-family : "Montserrat",sans-serif !important;
 background:transparent !important;
 appearance:none !important;
 -moz-appearance:none !important;
 -webkit-appearance:none !important;
 -webkit-box-sizing: border-box !important;
 -moz-box-sizing: border-box !important;
 box-sizing: border-box !important;
 border: 1px solid black !important;
 width:100%!important;
 color:black !important;
 height:40px;
 text-align:left !important;
 font-size: 14px !important;
 outline: none;
 background-color:none !important;
 position: relative !important;
 cursor:pointer;
 padding-left:12px;

}

.expenses_div_right:after {
 content: '< >';
 font: 16px "Consolas", monospace;
 font-weight:bold;
 color: white;
 background-color:black;
  display:inline-block;
 -webkit-transform: rotate(90deg);
 -moz-transform: rotate(90deg);
 -ms-transform: rotate(90deg);
 transform: rotate(90deg);
 position: relative;
 width:40px;
 height:40px;
 text-align:center;
 line-height:40px;
 overflow:hidden !important;
 cursor:pointer;

}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="expenses_div">
   <div class="expenses_div_left" >How to Proceed</div>
   <div class="expenses_div_right" >
    <select name="main_selection"  id="main_selection" >
     <option selected value="">Select an option</option>
     <option value="new_data">New Data</option>
     <option value="analize_data">Analyze Data</option>
     <option value="refresh_data">Refresh Data</option>
    </select>
   </div>
  </div></code>```

答:
Position And Click !

Changes commented :

Snippet :

.expenses_div {

width:90% !important;
margin:auto;
margin-top:2%;

}

.expenses_div_left{
height:40px;
line-height:40px;
background-color:black;
float:left;
display: inline-block;
text-align:left;
padding-left:12px;
color:white;
width:48%;
font-size: 14px !important;
font-family : "Montserrat",sans-serif !important;

}

.expenses_div_right{

height: 40px !important;
line-height: 40px !important;
width:48%;
float:left;
display: inline-block;
cursor:pointer;
background:transparent !important;
position:relative;/*Added (Because :after should be relative to this not whole page! )*/

}

.expenses_div_right select {

font-family : "Montserrat",sans-serif !important;
background:transparent !important;
appearance:none !important;
-moz-appearance:none !important;
-webkit-appearance:none !important;
-webkit-box-sizing: border-box !important;
-moz-box-sizing: border-box !important;
box-sizing: border-box !important;
border: 1px solid black !important;
width:100%!important;
color:black !important;
height:40px;
text-align:left !important;
font-size: 14px !important;
outline: none;
background-color:none !important;
position: relative !important;
cursor:pointer;
padding-left:12px;

}

.expenses_div_right:after {
content: '< >';
font: 16px "Consolas", monospace;
font-weight:bold;
color: white;
background-color:black;
display:inline-block;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
position: absolute;/*Changed to absolute*/
top:0;/*Added*/
right:0;/*Added*/
width:40px;
height:40px;
text-align:center;
line-height:40px;
overflow:hidden !important;
cursor:pointer;
z-index :-1 ;/*Added ( For Your 2nd Question )*/
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="expenses_div">
   <div class="expenses_div_left" >How to Proceed</div>
   <div class="expenses_div_right" >
    <select name="main_selection"  id="main_selection" >
     <option selected value="">Select an option</option>
     <option value="new_data">New Data</option>
     <option value="analize_data">Analyze Data</option>
     <option value="refresh_data">Refresh Data</option>
    </select>
   </div>
  </div></code>```

I hole this helps you !

Title: HTML select dropdown custom arrow css

Body:
I am trying to use a custom arrow for a dropdown menu as mentioned in the code. I am facing two issues here.

1.unable to place the arrow section adjacent to the dropdwon.

2.This custom arrow is not clickable.

How can I achieve these two ?

I tried to use z-index;-1 for the :after section. But its not working as expected.

.expenses_div {

 width:90% !important;
 margin:auto;
 margin-top:2%;

}

.expenses_div_left{
 height:40px;
 line-height:40px;
 background-color:black;
 float:left;
 display: inline-block;
 text-align:left;
 padding-left:12px;
 color:white;
 width:48%;
 font-size: 14px !important;
 font-family : "Montserrat",sans-serif !important;

 }

.expenses_div_right{

 height: 40px !important;
 line-height: 40px !important;
 width:48%;
 float:left;
 display: inline-block;
 cursor:pointer;
 background:transparent !important;

}

.expenses_div_right select {

 font-family : "Montserrat",sans-serif !important;
 background:transparent !important;
 appearance:none !important;
 -moz-appearance:none !important;
 -webkit-appearance:none !important;
 -webkit-box-sizing: border-box !important;
 -moz-box-sizing: border-box !important;
 box-sizing: border-box !important;
 border: 1px solid black !important;
 width:100%!important;
 color:black !important;
 height:40px;
 text-align:left !important;
 font-size: 14px !important;
 outline: none;
 background-color:none !important;
 position: relative !important;
 cursor:pointer;
 padding-left:12px;

}

.expenses_div_right:after {
 content: '< >';
 font: 16px "Consolas", monospace;
 font-weight:bold;
 color: white;
 background-color:black;
  display:inline-block;
 -webkit-transform: rotate(90deg);
 -moz-transform: rotate(90deg);
 -ms-transform: rotate(90deg);
 transform: rotate(90deg);
 position: relative;
 width:40px;
 height:40px;
 text-align:center;
 line-height:40px;
 overflow:hidden !important;
 cursor:pointer;

}

How to Proceed

    <select name="main_selection"  id="main_selection" >
     <option selected value="">Select an option</option>
     <option value="new_data">New Data</option>
     <option value="analize_data">Analyze Data</option>
     <option value="refresh_data">Refresh Data</option>
    </select>

Body:
Position And Click !

Changes commented :

Snippet :

.expenses_div {

width:90% !important;
margin:auto;
margin-top:2%;

}

.expenses_div_left{
height:40px;
line-height:40px;
background-color:black;
float:left;
display: inline-block;
text-align:left;
padding-left:12px;
color:white;
width:48%;
font-size: 14px !important;
font-family : "Montserrat",sans-serif !important;

}

.expenses_div_right{

height: 40px !important;
line-height: 40px !important;
width:48%;
float:left;
display: inline-block;
cursor:pointer;
background:transparent !important;
position:relative;/*Added (Because :after should be relative to this not whole page! )*/

}

.expenses_div_right select {

font-family : "Montserrat",sans-serif !important;
background:transparent !important;
appearance:none !important;
-moz-appearance:none !important;
-webkit-appearance:none !important;
-webkit-box-sizing: border-box !important;
-moz-box-sizing: border-box !important;
box-sizing: border-box !important;
border: 1px solid black !important;
width:100%!important;
color:black !important;
height:40px;
text-align:left !important;
font-size: 14px !important;
outline: none;
background-color:none !important;
position: relative !important;
cursor:pointer;
padding-left:12px;

}

.expenses_div_right:after {
content: '< >';
font: 16px "Consolas", monospace;
font-weight:bold;
color: white;
background-color:black;
display:inline-block;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
position: absolute;/*Changed to absolute*/
top:0;/*Added*/
right:0;/*Added*/
width:40px;
height:40px;
text-align:center;
line-height:40px;
overflow:hidden !important;
cursor:pointer;
z-index :-1 ;/*Added ( For Your 2nd Question )*/
}

<div class="expenses_div">
   <div class="expenses_div_left" >How to Proceed</div>
   <div class="expenses_div_right" >
    <select name="main_selection"  id="main_selection" >
     <option selected value="">Select an option</option>
     <option value="new_data">New Data</option>
     <option value="analize_data">Analyze Data</option>
     <option value="refresh_data">Refresh Data</option>
    </select>
   </div>
  </div>

I hole this helps you !


问:
Regex splitting strings on a character, not contained in ()
I'm trying to split a string on a , where that character is not contained in ().

Example String:

```<code>`table1`.`lname`,`table1`.`fname`,if(foo is not null,foo,if(bar is not null,bar,table3.baz)),`table3`.`shu`
</code>```

I want to split it into an array looking like

```<code>(
  0=>`table1`.`lname`
  1=>`table1`.`fname`
  2=>if(foo is not null,foo,if(bar is not null,bar,table3.baz))
  3=>`table3`.`shu`
)
</code>```

Any ideas on how to tackle this problem?

--
Dave

答:
In general, you can't do it with a regex.  You typically need a recursive descendant parser (or something similar) to match up parentheses which may be nested to arbitrary depth.

I think there have been similar questions here before, but I was having a hard time finding them.  This answer however should help to explain.

OwnerDisplayName: david walker

LastEditorDisplayName: Lawrence Johnston

ContentLicense: CC BY-SA 2.5

Body:
I'm trying to split a string on a , where that character is not contained in ().

Example String:

`table1`.`lname`,`table1`.`fname`,if(foo is not null,foo,if(bar is not null,bar,table3.baz)),`table3`.`shu`

I want to split it into an array looking like

(
  0=>`table1`.`lname`
  1=>`table1`.`fname`
  2=>if(foo is not null,foo,if(bar is not null,bar,table3.baz))
  3=>`table3`.`shu`
)

Any ideas on how to tackle this problem?

--
Dave

OwnerDisplayName: Adam Bellaire


问:
What is the point in letting my class implement Cloneable?
I came across some class code that implements Clonable, the documentation states:

A class implements the Cloneable interface to indicate to the Object.clone() method that it is legal for that method to make a field-for-field copy of instances of that class.
      Invoking Object's clone method on an instance that does not implement the Cloneable interface results in the exception CloneNotSupportedException being thrown.
      By convention, classes that implement this interface should override Object.clone (which is protected) with a public method. See Object.clone() for details on overriding this method.
      Note that this interface does not contain the clone method. Therefore, it is not possible to clone an object merely by virtue of the fact that it implements this interface. Even if the clone method is invoked reflectively, there is no guarantee that it will succeed.

I can't understand the point in implementing this class, as said in the docs the .clone method is not implemented in the interface, and I have to implement it. So why use this class? Why won't I just write a method copyClass in my class to make the object copy without the implementation of this class?

答: In addition to what others said, Cloneable is often used when implementing prototype design pattern.</p>


问:
Function within a function for iterating each rows based on a column value
I currently am trying to create a function for a dataframe and is too complex for me. I have a dataframe that looks like this:

```<code>df1

     hour    production ....
0     1          10
0     2          20
0     1          30
0     3          40
0     1          40
0     4          30
0     1          20
0     4          10
</code>```

I am trying to create a function that would do the following:

Group data by different hour

Calculate 90% confidence interval of production for each hour

If production value of a particular row falls outside the 90% confidence interval for it's respective hour, mark it as unusual by creating  a new column

Below is the current step I am taking to do the above for each individual hours:

Calculate confidence interval

```<code>confidence = 0.90
data = df1['production ']
n = len(data)
m = mean(data)
std_err = sem(data)
h = std_err * t.ppf((1 + confidence) / 2, n - 1)
lower_interval = m - h
upper_interval = m + h
</code>```

Then:

```<code>def confidence_interval(x):
if x['production'] > upper_interval  :
    return 1
if x['production'] < lower_interval :
    return 1
return 0

df1['unusual'] = df1.apply (lambda x: confidence_interval(x), axis=1)
</code>```

I am doing this for each of the values in hour, than having to merge all the result together into one original dataframe.

Can anyone help me to crate a function that can do all the above at once? I had a go but just cant get my head around it.

答:
Create custom function and use GroupBy.transform with Series.between and invert mask by ~:

```<code>from scipy.stats import sem, t
from scipy import mean

def confidence_interval(data):
    confidence = 0.90
    n = len(data)
    m = mean(data)
    std_err = sem(data)
    h = std_err * t.ppf((1 + confidence) / 2, n - 1)
    lower_interval = m - h
    upper_interval = m + h
    #print (lower_interval ,upper_interval)
    return ~data.between(lower_interval, upper_interval, inclusive=False)

df1['new'] = df1.groupby('hour')['production'].transform(confidence_interval).astype(int)
print (df1)
   hour  production  new
0     1          10    0
0     2          20    1
0     1          30    0
0     3          40    1
0     1          40    0
0     4          30    0
0     1          20    0
0     4          10    0
</code>```

Body:
I currently am trying to create a function for a dataframe and is too complex for me. I have a dataframe that looks like this:

df1

     hour    production ....
0     1          10
0     2          20
0     1          30
0     3          40
0     1          40
0     4          30
0     1          20
0     4          10

I am trying to create a function that would do the following:

Group data by different hour

Calculate 90% confidence interval of production for each hour

If production value of a particular row falls outside the 90% confidence interval for it's respective hour, mark it as unusual by creating  a new column

Below is the current step I am taking to do the above for each individual hours:

Calculate confidence interval

confidence = 0.90
data = df1['production ']
n = len(data)
m = mean(data)
std_err = sem(data)
h = std_err * t.ppf((1 + confidence) / 2, n - 1)
lower_interval = m - h
upper_interval = m + h

Then:

def confidence_interval(x):
if x['production'] > upper_interval  :
    return 1
if x['production'] < lower_interval :
    return 1
return 0

df1['unusual'] = df1.apply (lambda x: confidence_interval(x), axis=1)

I am doing this for each of the values in hour, than having to merge all the result together into one original dataframe.

Can anyone help me to crate a function that can do all the above at once? I had a go but just cant get my head around it.

Body:
Create custom function and use GroupBy.transform with Series.between and invert mask by ~:

from scipy.stats import sem, t
from scipy import mean

def confidence_interval(data):
    confidence = 0.90
    n = len(data)
    m = mean(data)
    std_err = sem(data)
    h = std_err * t.ppf((1 + confidence) / 2, n - 1)
    lower_interval = m - h
    upper_interval = m + h
    #print (lower_interval ,upper_interval)
    return ~data.between(lower_interval, upper_interval, inclusive=False)

df1['new'] = df1.groupby('hour')['production'].transform(confidence_interval).astype(int)
print (df1)
   hour  production  new
0     1          10    0
0     2          20    1
0     1          30    0
0     3          40    1
0     1          40    0
0     4          30    0
0     1          20    0
0     4          10    0


问:
Calculate difference in years of two dates in R
I have a data frame and I want to calculate the difference in years of two columns (Let's called id "Age").

I am having problems adjusting it to the date of the second column. Although, I managed to do it according to Sys.Date():

```<code>require(eeptools)
require(ggplot2)
DT$Age<-age_calc(DT$DateBirth, enddate=Sys.Date(), units="years",
precise=T)
</code>```

But, when I changed Sys.Date() to the name of the column (Which is called DateUpdated):

```<code>DT<-data.table(Id=c(1,2,3),DateBirth=c("01/01/1990
","06/05/1980","07/09/2000"),DateUpdated=c("01/01/2019","03/04/2019",
"06/05/2019"),Age=c(29,38,18))

DT[,DateBirth:=as.Date(DateBirth,format= "%d/%m/%Y")]
DT[,DateUpdated:=as.Date(DateUpdated,format= "%d/%m/%Y")]

DT$Age<-age_calc(DT$DateBirth, enddate=DateUpdated, units="years",
precise=T)
</code>```

It returns the following error:

Error in age_calc(DT$DateBirth, enddate = DateUpdated, units = "years",  : object 'DateUpdated' not found

Can someone give me some advice?

答:
You need to give reference of the data.table that you are applying the function to

```<code>library(eeptools)
library(data.table)

DT[, new := age_calc(DateBirth, DateUpdated, units="years", precise=T)]

DT
#   Id  DateBirth DateUpdated Age  new
#1:  1 1990-01-01  2019-01-01  29 29.00
#2:  2 1980-05-06  2019-04-03  38 38.91
#3:  3 2000-09-07  2019-05-06  18 18.66
</code>```

OR

```<code>age_calc(DT$DateBirth, DT$DateUpdated, units="years", precise=T)
#[1] 29.00 38.91 18.66
</code>```

Body:
I have a data frame and I want to calculate the difference in years of two columns (Let's called id "Age").

I am having problems adjusting it to the date of the second column. Although, I managed to do it according to Sys.Date():

require(eeptools)
require(ggplot2)
DT$Age<-age_calc(DT$DateBirth, enddate=Sys.Date(), units="years",
precise=T)

But, when I changed Sys.Date() to the name of the column (Which is called DateUpdated):

DT<-data.table(Id=c(1,2,3),DateBirth=c("01/01/1990
","06/05/1980","07/09/2000"),DateUpdated=c("01/01/2019","03/04/2019",
"06/05/2019"),Age=c(29,38,18))

DT[,DateBirth:=as.Date(DateBirth,format= "%d/%m/%Y")]
DT[,DateUpdated:=as.Date(DateUpdated,format= "%d/%m/%Y")]

DT$Age<-age_calc(DT$DateBirth, enddate=DateUpdated, units="years",
precise=T)

It returns the following error:

Error in age_calc(DT$DateBirth, enddate = DateUpdated, units = "years",  : object 'DateUpdated' not found

Can someone give me some advice?

Body:
You need to give reference of the data.table that you are applying the function to

library(eeptools)
library(data.table)

DT[, new := age_calc(DateBirth, DateUpdated, units="years", precise=T)]

DT
#   Id  DateBirth DateUpdated Age  new
#1:  1 1990-01-01  2019-01-01  29 29.00
#2:  2 1980-05-06  2019-04-03  38 38.91
#3:  3 2000-09-07  2019-05-06  18 18.66

OR

age_calc(DT$DateBirth, DT$DateUpdated, units="years", precise=T)
#[1] 29.00 38.91 18.66


问:
Need to get output of 2 tables in one column using joins only
I have this scenario question which needs to be solved using joins only. can't use except,intersect or union.

sample code:

```<code>--demo setup
create table t1 (id int)
insert into t1 values (1),(2),(3)

create table t2 (id int)
insert into t2 values (4),(5),(6)

--join
select t1.id,t2.id
from t1 full outer join
t2 on t1.id=t2.id
</code>```

--after join i am getting

```<code>id          id
----------- -----------
1           NULL
2           NULL
3           NULL
NULL        4
NULL        5
NULL        6
</code>```

--But i need is

```<code>id
-----------
1
2
3
4
5
6
</code>```

Can someone help me with this ? i know this can be easily done using union but this challenge needs to be solved using joins only.

any help is appreciated ....

答:
you can use this code:

```<code> SELECT case when t1.id IS NULL THEN t2.id ELSE t1.id END AS id
 FROM t1 FULL OUTER JOIN t2
 ON t1.id=t2.id
</code>```

As you said the Use From Union

```<code>select * from t1
union
select * from t2
</code>```

Body:
I have this scenario question which needs to be solved using joins only. can't use except,intersect or union.

sample code:

--demo setup
create table t1 (id int)
insert into t1 values (1),(2),(3)

create table t2 (id int)
insert into t2 values (4),(5),(6)

--join
select t1.id,t2.id
from t1 full outer join
t2 on t1.id=t2.id

--after join i am getting

id          id
----------- -----------
1           NULL
2           NULL
3           NULL
NULL        4
NULL        5
NULL        6

--But i need is

id
-----------
1
2
3
4
5
6

Can someone help me with this ? i know this can be easily done using union but this challenge needs to be solved using joins only.

any help is appreciated ....

Body:
you can use this code:

 SELECT case when t1.id IS NULL THEN t2.id ELSE t1.id END AS id
 FROM t1 FULL OUTER JOIN t2
 ON t1.id=t2.id

As you said the Use From Union

select * from t1
union
select * from t2


问:
Why we should check for the variable being defined var m = m || function(){}
Lot of libraries i have seen methods defined like this

```<code>Common.deepCopy = Common.deepCopy || function(oldObject) {
        return $.extend(true, {}, oldObject);
    };
</code>```

What is the need of defining methods are objects like this.

Because the js files will be executed only once so there is no chance of deepCopy being defined previously.

答: That's not always the case. You never know whether the JS file is included twice or whether it is initialized again. Better to check whether the object exists and assign it if it does. Otherwise create a new object</p>

Body:
Lot of libraries i have seen methods defined like this

Common.deepCopy = Common.deepCopy || function(oldObject) {
        return $.extend(true, {}, oldObject);
    };

What is the need of defining methods are objects like this.

Because the js files will be executed only once so there is no chance of deepCopy being defined previously.


问:
How to create a one-button back command in a file explorer in vb.net?
I want to know what command I should use on a button to go back to the previous folder in the file explorer I made using vb.net.
Example: The folder starts with the path in C: \ Test and if I enter a folder named test1 the path will be in C: \ Test \ test1 and when I click the back button it goes to the previous folder it would be in C: \ Test and so with whatever path I enter and click the back button it will always return to the previous folder.
Remembering that I can have larger folder paths like C: \ Test \ test2 \ documents \ images and when I click the back button it goes to C: \ Test \ test2 \ documents and when it clicks again it goes to C: \ Test \ test2, and so on.

Help me with this, it only needs this command to complete the project. Please help me?

```<code> Public Class Form1
    Dim path As String
    Dim nextPath As String
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        On Error Resume Next
        path = TextBox1.Text
        If (My.Computer.FileSystem.DirectoryExists(path)) Then

            explorer.Clear()

            For Each i In My.Computer.FileSystem.GetDirectories(path)
                explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)

            Next
            For Each i In My.Computer.FileSystem.GetFiles(path)
                explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
            Next
        Else
            MsgBox("Its A File")
            'or user
            'pocess.Start(path) // to open the file
        End If

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        On Error Resume Next
        path = "C:\Test"
        For Each i In My.Computer.FileSystem.GetDirectories(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)

        Next
        For Each i In My.Computer.FileSystem.GetFiles(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
        Next

    End Sub

    Private Sub ListView1_ItemSelectionChanged(sender As Object, e As ListViewItemSelectionChangedEventArgs) Handles explorer.ItemSelectionChanged
        nextPath = path + "\" + e.Item.Text

    End Sub

    Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles explorer.SelectedIndexChanged

    End Sub

    Private Sub ListView1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles explorer.MouseDoubleClick
        On Error Resume Next
        If (My.Computer.FileSystem.DirectoryExists(nextPath)) Then
            path = nextPath
            explorer.Clear()
            TextBox1.Text = path
            For Each i In My.Computer.FileSystem.GetDirectories(path)
                explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)

            Next
            For Each i In My.Computer.FileSystem.GetFiles(path)
                explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
            Next
        Else

            Process.Start(path & "\" & explorer.SelectedItems(0).Text)
        End If

    End Sub

    Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click

    End Sub

End Class
</code>```

Here is the part that goes back button:

```<code> Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click

End Sub
</code>```

答:
Igor my friend i see you want to finish this project so bad i will help you :) try this:

```<code>Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click
   try
        nextpath = path.substring(0, path.LastIndexOf("\"))
        path = nextpath
        explorer.Clear()
        TextBox1.Text = path
        For Each i In My.Computer.FileSystem.GetDirectories(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)

        Next
        For Each i In My.Computer.FileSystem.GetFiles(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
        Next
   catch ex as exception
        msgbox(ex.message)
   end try
End Sub
</code>```

for each time you want to visit a directory using explorer don't write this code every time just create a sub like so:

```<code>private sub go()
   try
        path = nextpath
        explorer.Clear()
        TextBox1.Text = path
        For Each i In My.Computer.FileSystem.GetDirectories(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)

        Next
        For Each i In My.Computer.FileSystem.GetFiles(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
        Next
   catch ex as exception
        msgbox(ex.message)
   end try
end sub

Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click
        nextpath = path.substring(0, path.LastIndexOf("\"))
        go()
End Sub
</code>```

here's how the new path will look like: https://dotnetfiddle.net/nv1vAP

Body:
I want to know what command I should use on a button to go back to the previous folder in the file explorer I made using vb.net.
Example: The folder starts with the path in C: \ Test and if I enter a folder named test1 the path will be in C: \ Test \ test1 and when I click the back button it goes to the previous folder it would be in C: \ Test and so with whatever path I enter and click the back button it will always return to the previous folder.
Remembering that I can have larger folder paths like C: \ Test \ test2 \ documents \ images and when I click the back button it goes to C: \ Test \ test2 \ documents and when it clicks again it goes to C: \ Test \ test2, and so on.

Help me with this, it only needs this command to complete the project. Please help me?

 Public Class Form1
    Dim path As String
    Dim nextPath As String
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        On Error Resume Next
        path = TextBox1.Text
        If (My.Computer.FileSystem.DirectoryExists(path)) Then

            explorer.Clear()

            For Each i In My.Computer.FileSystem.GetDirectories(path)
                explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)

            Next
            For Each i In My.Computer.FileSystem.GetFiles(path)
                explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
            Next
        Else
            MsgBox("Its A File")
            'or user
            'pocess.Start(path) // to open the file
        End If

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        On Error Resume Next
        path = "C:\Test"
        For Each i In My.Computer.FileSystem.GetDirectories(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)

        Next
        For Each i In My.Computer.FileSystem.GetFiles(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
        Next

    End Sub

    Private Sub ListView1_ItemSelectionChanged(sender As Object, e As ListViewItemSelectionChangedEventArgs) Handles explorer.ItemSelectionChanged
        nextPath = path + "\" + e.Item.Text

    End Sub

    Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles explorer.SelectedIndexChanged

    End Sub

    Private Sub ListView1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles explorer.MouseDoubleClick
        On Error Resume Next
        If (My.Computer.FileSystem.DirectoryExists(nextPath)) Then
            path = nextPath
            explorer.Clear()
            TextBox1.Text = path
            For Each i In My.Computer.FileSystem.GetDirectories(path)
                explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)

            Next
            For Each i In My.Computer.FileSystem.GetFiles(path)
                explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
            Next
        Else

            Process.Start(path & "\" & explorer.SelectedItems(0).Text)
        End If

    End Sub

    Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click

    End Sub

End Class

Here is the part that goes back button:

 Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click

End Sub

Body:
Igor my friend i see you want to finish this project so bad i will help you :) try this:

Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click
   try
        nextpath = path.substring(0, path.LastIndexOf("\"))
        path = nextpath
        explorer.Clear()
        TextBox1.Text = path
        For Each i In My.Computer.FileSystem.GetDirectories(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)

        Next
        For Each i In My.Computer.FileSystem.GetFiles(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
        Next
   catch ex as exception
        msgbox(ex.message)
   end try
End Sub

for each time you want to visit a directory using explorer don't write this code every time just create a sub like so:

private sub go()
   try
        path = nextpath
        explorer.Clear()
        TextBox1.Text = path
        For Each i In My.Computer.FileSystem.GetDirectories(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 2)

        Next
        For Each i In My.Computer.FileSystem.GetFiles(path)
            explorer.Items.Add(i.Substring(i.LastIndexOf("\") + 1), ImageList1.Images.Count() - 1)
        Next
   catch ex as exception
        msgbox(ex.message)
   end try
end sub

Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click
        nextpath = path.substring(0, path.LastIndexOf("\"))
        go()
End Sub

here's how the new path will look like: https://dotnetfiddle.net/nv1vAP