OBIEE 11g not working : not entering to analytics? - weblogic11g

i'm using OBIEE 11g, and i have a problem with logging into the analytics, i post my username and password, but it tells me invalid username !!
here follows the entire stacktrace of the problem ( WebLogic ) :
at com.google.inject.Scopes$1$1.get(Scopes.java:53)
at com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactor
yToProviderAdapter.java:41)
at com.google.inject.BindingBuilderImpl$FactoryProxy.get(BindingBuilderI
mpl.java:299)
at com.google.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToI
nternalFactoryAdapter.java:37)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:756)
at com.google.inject.ProviderToInternalFactoryAdapter.get(ProviderToInte
rnalFactoryAdapter.java:35)
at com.google.inject.Scopes$1$1.get(Scopes.java:53)
at com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactor
yToProviderAdapter.java:41)
at com.google.inject.InjectorImpl$SingleParameterInjector.inject(Injecto
rImpl.java:640)
... 66 more
Caused by: com.google.inject.ProvisionException: Error while locating instance
bound to com.sigmadynamics.server.SDClusterInterface
for member at com.sigmadynamics.cluster.RpcLocalExecutor.<init>(RpcLocalExecut
or.java:21)
at com.google.inject.InjectorImpl$SingleParameterInjector.inject(Injecto
rImpl.java:646)
at com.google.inject.InjectorImpl.getParameters(InjectorImpl.java:666)
at com.google.inject.ConstructorInjector.construct(ConstructorInjector.j
ava:140)
at com.google.inject.InjectorImpl$ImplicitBinding.get(InjectorImpl.java:
1006)
at com.google.inject.InjectorImpl$SingleParameterInjector.inject(Injecto
rImpl.java:640)
... 81 more
Caused by: com.google.inject.ProvisionException: Error while locating instance
bound to com.sigmadynamics.sdo.util.StringCatalogInterface
for member at com.sigmadynamics.server.SDCluster.<init>(SDCluster.java:93)
at com.google.inject.InjectorImpl$SingleParameterInjector.inject(Injecto
rImpl.java:646)
at com.google.inject.InjectorImpl.getParameters(InjectorImpl.java:666)
at com.google.inject.ConstructorInjector.construct(ConstructorInjector.j
ava:140)
at com.google.inject.InjectorImpl$ImplicitBinding.get(InjectorImpl.java:
1006)
at com.google.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToI
nternalFactoryAdapter.java:37)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:756)
at com.google.inject.ProviderToInternalFactoryAdapter.get(ProviderToInte
rnalFactoryAdapter.java:35)
at com.google.inject.Scopes$1$1.get(Scopes.java:53)
at com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactor
yToProviderAdapter.java:41)
at com.google.inject.InjectorImpl$SingleParameterInjector.inject(Injecto
rImpl.java:640)
... 85 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExcepti
on
at com.google.inject.ConstructorInjector.construct(ConstructorInjector.j
ava:161)
at com.google.inject.InjectorImpl$ImplicitBinding.get(InjectorImpl.java:
1006)
at com.google.inject.BindingBuilderImpl$FactoryProxy.get(BindingBuilderI
mpl.java:299)
at com.google.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToI
nternalFactoryAdapter.java:37)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:756)
at com.google.inject.ProviderToInternalFactoryAdapter.get(ProviderToInte
rnalFactoryAdapter.java:35)
at com.google.inject.Scopes$1$1.get(Scopes.java:53)
at com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactor
yToProviderAdapter.java:41)
at com.google.inject.InjectorImpl$SingleParameterInjector.inject(Injecto
rImpl.java:640)
... 94 more
Caused by: java.lang.reflect.InvocationTargetException
at com.sigmadynamics.sdo.util.StringCatalog$$FastClassByGuice$$c75b3a0e.
newInstance(<generated>)
at com.google.inject.cglib.reflect.FastConstructor.newInstance(FastConst
ructor.java:40)
at com.google.inject.DefaultConstructionProxyFactory$2.newInstance(Defau
ltConstructionProxyFactory.java:67)
at com.google.inject.ConstructorInjector.construct(ConstructorInjector.j
ava:142)
... 102 more
Caused by: com.sigmadynamics.server.DataServices.DatabaseProvider.DatabaseProvid
erException: weblogic.common.resourcepool.ResourceDeadException: 0:weblogic.comm
on.ResourceException: Could not create pool connection. The DBMS driver exceptio
n was: Erreur d'E/S: The Network Adapter could not establish the connection
at weblogic.jdbc.common.internal.JDBCUtil.wrapAndThrowResourceException(
JDBCUtil.java:250)
at weblogic.jdbc.common.internal.RmiDataSource.getPoolConnection(RmiData
Source.java:352)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
ce.java:369)
at com.sigmadynamics.server.SDDataSource.getConnection(SDDataSource.java
:85)
at com.sigmadynamics.server.DataServices.DatabaseProvider.DatabaseInfo.c
reateNewInstance(DatabaseInfo.java:145)
at com.sigmadynamics.server.DataServices.DatabaseProvider.DatabaseInfo.g
etInstance(DatabaseInfo.java:134)
at com.sigmadynamics.server.DataServices.DatabaseProvider.DatabaseProvid
er.<init>(DatabaseProvider.java:126)
at com.sigmadynamics.server.DataServices.DatabaseProvider.DatabaseProvid
er.<init>(DatabaseProvider.java:110)
at com.sigmadynamics.server.SDDatabase.getDefaultDatabase(SDDatabase.jav
a:37)
at com.sigmadynamics.sdo.util.StringCatalog.<init>(StringCatalog.java:31
)
... 106 more
Caused by: weblogic.jdbc.extensions.ConnectionDeadSQLException: weblogic.common.
resourcepool.ResourceDeadException: 0:weblogic.common.ResourceException: Could n
ot create pool connection. The DBMS driver exception was: Erreur d'E/S: The Netw
ork Adapter could not establish the connection
... 116 more
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.jav
a:1510)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:119)
Truncated. see log file for complete stacktrace
Caused By: weblogic.jdbc.extensions.ConnectionDeadSQLException: weblogic.common.
resourcepool.ResourceDeadException: 0:weblogic.common.ResourceException: Could n
ot create pool connection. The DBMS driver exception was: Erreur d'E/S: The Netw
ork Adapter could not establish the connection
at weblogic.jdbc.common.internal.JDBCUtil.wrapAndThrowResourceException(
JDBCUtil.java:250)
at weblogic.jdbc.common.internal.RmiDataSource.getPoolConnection(RmiData
Source.java:352)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
ce.java:369)
at com.sigmadynamics.server.SDDataSource.getConnection(SDDataSource.java
:85)
at com.sigmadynamics.server.DataServices.DatabaseProvider.DatabaseInfo.c
reateNewInstance(DatabaseInfo.java:145)
Truncated. see log file for complete stacktrace
>
PostInstallConfigIntegration:oracle_ias_farm target auth registration is done.
<4 mai 2013 14 h 50 WET> <Warning> <org.apache.myfaces.trinidadinternal.config.G
lobalConfiguratorImpl> <BEA-000000> <Services de configuration d├®j├á initialis├
®s.>
<4 mai 2013 14 h 50 WET> <Notice> <Log Management> <BEA-170027> <The Server has
established connection with the Domain level Diagnostic Service successfully.>
<4 mai 2013 14 h 50 WET> <Notice> <WebLogicServer> <BEA-000365> <Server state ch
anged to ADMIN>
<4 mai 2013 14 h 50 WET> <Notice> <WebLogicServer> <BEA-000365> <Server state ch
anged to RESUMING>
<4 mai 2013 14 h 50 WET> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is
now listening on fe80:0:0:0:0:5efe:c0a8:10c:7001 for protocols iiop, t3, ldap,
snmp, http.>
<4 mai 2013 14 h 50 WET> <Notice> <Server> <BEA-002613> <Channel "Default" is no
w listening on 2001:0:9d38:6ab8:28fe:14bc:3f57:fef3:7001 for protocols iiop, t3,
ldap, snmp, http.>
<4 mai 2013 14 h 50 WET> <Notice> <Server> <BEA-002613> <Channel "Default[3]" is
now listening on fe80:0:0:0:28fe:14bc:3f57:fef3:7001 for protocols iiop, t3, ld
ap, snmp, http.>
<4 mai 2013 14 h 50 WET> <Warning> <Server> <BEA-002611> <Hostname "mehdi-PC", m
aps to multiple IP addresses: 192.168.1.12, fe80:0:0:0:2d02:7435:4101:c003%11, f
e80:0:0:0:28fe:14bc:3f57:fef3%15, 2001:0:9d38:6ab8:28fe:14bc:3f57:fef3>
<4 mai 2013 14 h 50 WET> <Notice> <Server> <BEA-002613> <Channel "Default[4]" is
now listening on fe80:0:0:0:9474:8ca9:1784:bd10:7001 for protocols iiop, t3, ld
ap, snmp, http.>
<4 mai 2013 14 h 50 WET> <Notice> <Server> <BEA-002613> <Channel "Default[8]" is
now listening on 0:0:0:0:0:0:0:1:7001 for protocols iiop, t3, ldap, snmp, http.
>
<4 mai 2013 14 h 50 WET> <Notice> <Server> <BEA-002613> <Channel "Default[5]" is
now listening on fe80:0:0:0:2c50:85e6:e9d8:158f:7001 for protocols iiop, t3, ld
ap, snmp, http.>
<4 mai 2013 14 h 50 WET> <Notice> <Server> <BEA-002613> <Channel "Default[6]" is
now listening on fe80:0:0:0:2d02:7435:4101:c003:7001 for protocols iiop, t3, ld
ap, snmp, http.>
<4 mai 2013 14 h 50 WET> <Notice> <Server> <BEA-002613> <Channel "Default[7]" is
now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>
<4 mai 2013 14 h 50 WET> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is
now listening on 192.168.1.12:7001 for protocols iiop, t3, ldap, snmp, http.>
<4 mai 2013 14 h 50 WET> <Notice> <WebLogicServer> <BEA-000329> <Started WebLogi
c Admin Server "AdminServer" for domain "bifoundation_domain" running in Product
ion Mode>
<4 mai 2013 14 h 50 WET> <Notice> <WebLogicServer> <BEA-000365> <Server state ch
anged to RUNNING>
<4 mai 2013 14 h 50 WET> <Notice> <WebLogicServer> <BEA-000360> <Server started
in RUNNING mode>
<4 mai 2013 14 h 50 WET> <Warning> <Socket> <BEA-000449> <Closing socket as no d
ata read from it on fe80:0:0:0:2d02:7435:4101:c003:50 435 during the configured
idle timeout of 5 secs>
<4 mai 2013 14 h 50 WET> <Warning> <Socket> <BEA-000449> <Closing socket as no d
ata read from it on fe80:0:0:0:2d02:7435:4101:c003:50 431 during the configured
idle timeout of 5 secs>
<4 mai 2013 14 h 50 WET> <Warning> <Socket> <BEA-000449> <Closing socket as no d
ata read from it on fe80:0:0:0:2d02:7435:4101:c003:50 433 during the configured
idle timeout of 5 secs>
<4 mai 2013 14 h 50 WET> <Warning> <Socket> <BEA-000449> <Closing socket as no d
ata read from it on fe80:0:0:0:2d02:7435:4101:c003:50 434 during the configured
idle timeout of 5 secs>
<4 mai 2013 14 h 50 WET> <Warning> <Socket> <BEA-000449> <Closing socket as no d
ata read from it on fe80:0:0:0:2d02:7435:4101:c003:50 432 during the configured
idle timeout of 5 secs>
<4 mai 2013 14 h 50 WET> <Warning> <oracle.wsm.resources.policyaccess> <WSM-0621
0> <Une instance du bean interface oracle.wsm.policymanager.IUsageTracker pour l
e r├®f├®rentiel local sur le chemin "" n'├®tait pas disponible pour la configura
tion de la m├®thode d'acc├¿s de r├®f├®rentiel oracle.wsm.policymanager.accessor.
BeanAccessor dans le contexte "ResourcePattern [pattern=DOMAIN/weblogic/bifounda
tion_domain, subjectType=MANAGED_DOMAIN, terms={PLATFORM=weblogic, SUBJECT_TYPE=
MANAGED_DOMAIN, DOMAIN=bifoundation_domain}]".>
<4 mai 2013 14 h 50 WET> <Warning> <oracle.wsm.resources.policyaccess> <WSM-0621
0> <Une instance du bean interface oracle.wsm.policymanager.IDocumentManager pou
r le r├®f├®rentiel local sur le chemin "" n'├®tait pas disponible pour la config
uration de la m├®thode d'acc├¿s de r├®f├®rentiel oracle.wsm.policymanager.access
or.BeanAccessor dans le contexte "ResourcePattern [pattern=DOMAIN/weblogic/bifou
ndation_domain, subjectType=MANAGED_DOMAIN, terms={PLATFORM=weblogic, SUBJECT_TY
PE=MANAGED_DOMAIN, DOMAIN=bifoundation_domain}]".>
<4 mai 2013 14 h 50 WET> <Warning> <oracle.wsm.resources.policyaccess> <WSM-0621
0> <Une instance du bean interface oracle.wsm.policymanager.IUsageTracker pour l
e r├®f├®rentiel local sur le chemin "" n'├®tait pas disponible pour la configura
tion de la m├®thode d'acc├¿s de r├®f├®rentiel oracle.wsm.policymanager.accessor.
BeanAccessor dans le contexte "ResourcePattern [pattern=DOMAIN/weblogic/bifounda
tion_domain, subjectType=MANAGED_DOMAIN, terms={PLATFORM=weblogic, SUBJECT_TYPE=
MANAGED_DOMAIN, DOMAIN=bifoundation_domain}]".>
<4 mai 2013 14 h 50 WET> <Warning> <oracle.wsm.resources.policyaccess> <WSM-0621
0> <Une instance du bean interface oracle.wsm.policymanager.IDocumentManager pou
r le r├®f├®rentiel local sur le chemin "" n'├®tait pas disponible pour la config
uration de la m├®thode d'acc├¿s de r├®f├®rentiel oracle.wsm.policymanager.access
or.BeanAccessor dans le contexte "ResourcePattern [pattern=DOMAIN/weblogic/bifou
ndation_domain, subjectType=MANAGED_DOMAIN, terms={PLATFORM=weblogic, SUBJECT_TY
PE=MANAGED_DOMAIN, DOMAIN=bifoundation_domain}]".>
<4 mai 2013 14 h 50 WET> <Error> <oracle.webservices.service> <OWS-04086> <oracl
e.fabric.common.PolicyEnforcementException: PolicySet Invalid: WSM-06102 PolicyR
eference L'URI de r├®f├®rence de strat├®gie "oracle/wss_username_token_service_p
olicy" n'est pas valide.
at oracle.integration.platform.common.InterceptorChainImpl.createPolicyE
nforcementException(InterceptorChainImpl.java:305)
at oracle.integration.platform.common.InterceptorChainImpl.processReques
t(InterceptorChainImpl.java:151)
at oracle.integration.platform.common.mgmt.InterceptorChainManager.proce
ssRequest(InterceptorChainManager.java:276)
at oracle.j2ee.ws.server.mgmt.runtime.SuperServerInterceptorPipeline.han
dleRequest(SuperServerInterceptorPipeline.java:165)
at oracle.j2ee.ws.server.provider.management.AbstractProviderInterceptor
Pipeline.executeRequestInterceptorChain(AbstractProviderInterceptorPipeline.java
:576)
at oracle.j2ee.ws.server.provider.ProviderProcessor.executeInterceptorRe
questChain(ProviderProcessor.java:921)
at oracle.j2ee.ws.server.WebServiceProcessor.processRequest(WebServicePr
ocessor.java:231)
at oracle.j2ee.ws.server.WebServiceProcessor.doService(WebServiceProcess
or.java:193)
at oracle.j2ee.ws.server.WebServiceServlet.doPost(WebServiceServlet.java
:485)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
tyHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:31
5)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUt
il.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.jav
a:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:1
71)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:13
9)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
ervletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
ontext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
ava:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
>
<4 mai 2013 14 h 50 WET> <Error> <oracle.webservices.service> <OWS-04115> <Une e
rreur s'est produite pour le port : {http://oracle/bi/security/}SecurityServiceP
ort : oracle.fabric.common.PolicyEnforcementException: PolicySet Invalid: WSM-06
102 PolicyReference L'URI de r├®f├®rence de strat├®gie "oracle/wss_username_toke
n_service_policy" n'est pas valide. .>

Are you able to connect to EM and console with weblogic account? If yes then do the following....
The BISystemUser account has become locked.
You have to create a new user with the same privileges and permissions
1.Log in to the WebLogic Server Administration Console.
2.Create a new user and assign it to the Administrators Group.
3.Log in to Enterprise Manager to Add this new user to 'BISystem' Role.
4.Navigate to 'Weblogic Domain > bifoundation_domain'
5.Right click on bifoundation_domain.
6.From the resulting menu, click on Security/Credentials menu item
In the Credentials Screen expand oracle.bi.system.
Choose 'system.user' and click 'Edit'
In the resulting pop-up window, enter the new user name and password
7.Re-start the OBIEE components, Managed Server and Admin Server.
After ten minutes log in to Answers as the new user.
If issue still persist change the Password for RPD file which you have deployed ,
(Same old password you can reenter here )
1) Open RPD in BI Administration Tool - Offline Mode
2) Go to File - > Change Password - >
3) if there is weblogic user exist in RPD , delete the weblogic user in RPD ( In Manage -> Identity )
4) Save the RPD
5) Restart the service and try to login again

Related

how to implement timer and delay in within any loop in mongoose os?

I am trying to use Timer as a delay function. as I tried to delete the previous set time with Timer.de() but still somehow it triggered something and I got the error below the code.
how to achieve the delay functionality in while loop.
I tried the delay white while as follow. I am using esp32.
let i = 0;
let sensorData = 0;
while(i<100){
let Tid=Timer.set(500,0,function(){
sensorData = sensorData + this.CalculateResistance();
},null);
Timer.del(Tid);
sensorData = sensorData/100;
sensorData = sensorData/MQ_GasSensor.SensorParameters.ClearAirRatio;
}
return sensorData;
},```
somehow it triggers watchdog.
here is the error.
[Jul 19 01:44:42.683] E (30764) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[Jul 19 01:44:42.694] - mgos (CPU 0/1), backtrace: 0x4000c3f8 0x400f7f35 0x400f7ff4 0x400fb73a 0x400fca1b 0x400fca73 0x400f31e3 0x400f3214 0x400e28a5 0x400e2c08 0x400e67eb 0x40083b04
[Jul 19 01:44:42.708]
[Jul 19 01:44:42.708] E (30764) task_wdt: Tasks currently running:
[Jul 19 01:44:42.713] E (30764) task_wdt: CPU 0: mgos
[Jul 19 01:44:42.717] E (30764) task_wdt: Aborting.
[Jul 19 01:44:42.720] abort() was called at PC 0x400d1350 on core 0
[Jul 19 01:44:42.724]
[Jul 19 01:44:42.725] Backtrace: 0x4008f0db 0x4008f25d 0x400d1350 0x40081686 0x4000c3f5 0x400f7f35 0x400f7ff4 0x400fb73a 0x400fca1b 0x400fca73 0x400f31e3 0x400f3214 0x400e28a5 0x400e2c08 0x400e67eb 0x40083b04
[Jul 19 01:44:42.741]
[Jul 19 01:44:42.741] --- BEGIN CORE DUMP ---
[Jul 19 01:44:42.743] mos: catching core dump
[Jul 19 01:44:45.599] .............[Jul 19 01:45:22.289] mos: core dump aborted
[Jul 19 01:45:22.289]
[Jul 19 01:45:22.289] rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[Jul 19 01:45:22.294] configsip: 0, SPIWP:0xee
[Jul 19 01:45:22.296] clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[Jul 19 01:45:22.302] mode:DIO, clock div:1
[Jul 19 01:45:22.304] load:0x3fff0018,len:4
[Jul 19 01:45:22.306] load:0x3fff001c,len:6188
[Jul 19 01:45:22.309] load:0x40078000,len:9588
[Jul 19 01:45:22.311] load:0x40080400,len:6968
[Jul 19 01:45:22.313] entry 0x40080740

I'm not able to change the following code into if-else condition in Neo4j

I'm new in Neo4j and trying to compare the ScoreFT[0] with ScoreFT[1] and get that value which is greater in Neo4j.I have tried once but it has not worked.I don't have idea to use order by and Limit in the last code(Return case).Please help me.
Round,Date,Team1,FT,HT,Team2
1,(Fri) 11 Aug 2017 (32),Arsenal FC,4-3,2-2,Leicester City FC
1,(Sat) 12 Aug 2017 (32),Brighton & Hove Albion FC,0-2,0-0,Manchester City FC
1,(Sat) 12 Aug 2017 (32),Chelsea FC,2-3,0-3,Burnley FC
1,(Sat) 12 Aug 2017 (32),Crystal Palace FC,0-3,0-2,Huddersfield Town AFC
1,(Sat) 12 Aug 2017 (32),Everton FC,1-0,1-0,Stoke City FC
1,(Sat) 12 Aug 2017 (32),Southampton FC,0-0,0-0,Swansea City AFC
1,(Sat) 12 Aug 2017 (32),Watford FC,3-3,2-1,Liverpool FC
1,(Sat) 12 Aug 2017 (32),West Bromwich Albion FC,1-0,1-0,AFC Bournemouth
1,(Sun) 13 Aug 2017 (32),Manchester United FC,4-0,1-0,West Ham United FC
1,(Sun) 13 Aug 2017 (32),Newcastle United FC,0-2,0-0,Tottenham Hotspur FC
Import query
Attempt with if/else
CASE will only work with a single value, but you're trying to use multiple values here based upon the comparison, and worse you're trying to get a single CASE to output multiple variables, which won't work.
It would be better to first get the values you want in a composite structure (either in 2-element lists or a map), and then use two CASEs to get the right value for each variable. Something like this, replacing your RETURN:
...
WITH [t1.key, ScoreFT[0]] as t1Score, [t2.key, ScoreFT[1]] as t2Score, ScoreFT[0] > ScoreFT[1] as t1Won
RETURN CASE WHEN t1Won THEN t1Score ELSE t2Score END as s,
CASE WHEN t1Won THEN t2Score ELSE t1Score END as p
If you want a map instead, you can create it explicitly instead of using the lists:
WITH t1 {.key, score:ScoreFT[0]} as t1Score, t2 {.key, score:ScoreFT[1]} as t2Score, ...

how to open /dev/console in C

I was reading wayland/weston code, the setting up tty part. I found it tries to acquire an available tty for doing KMS and start windows.
This is how it does:
if (!wl->new_user) {
wl->tty = STDIN_FILENO;
} else if (tty) {
t = ttyname(STDIN_FILENO);
if (t && strcmp(t, tty) == 0)
wl->tty = STDIN_FILENO;
else
wl->tty = open(tty, O_RDWR | O_NOCTTY);
} else {
int tty0 = open("/dev/tty0", O_WRONLY | O_CLOEXEC);
char filename[16];
if (tty0 < 0)
error(1, errno, "could not open tty0");
if (ioctl(tty0, VT_OPENQRY, &wl->ttynr) < 0 || wl->ttynr == -1)
error(1, errno, "failed to find non-opened console");
snprintf(filename, sizeof filename, "/dev/tty%d", wl->ttynr);
wl->tty = open(filename, O_RDWR | O_NOCTTY);
close(tty0);
}
in src/weston-launch.c.
It tries to open('/dev/tty0') and find a tty that available if no tty is specified.
But you can't do that, neither /dev/tty0 nor 'available tty' belongs to you. I tested with my simpler version. And of course I couldn't open /dev/tty0.
Do you guys know how this magic is done?
The actual available devices for a tty depend on the system. On most interactive Unix/Unix-like systems you will have a "tty" whose name can be found from the command-line program tty. For example:
$ tty
/dev/pts/2
Likely, you also have a device named "tty", e.g.,
$ ls -l /dev/tty
lrwxrwxrwx 1 root other 26 Feb 9 2014 /dev/tty -> ../devices/pseudo/sy#0:tty
$ ls -lL /dev/tty
crw-rw-rw- 1 root tty 22, 0 Feb 9 2014 /dev/tty
You cannot open just any tty device, because most of them are owned by root (or other users to which they have been assigned).
For further discussion about the differences between /dev/console, /dev/tty and other tty-devices, see Cannot open /dev/console.
According to the console_codes(4) manual page:
VT_OPENQRY
Returns the first available (non-opened) console. argp points to an int which is set to the number of the vt (1 <= *argp <= MAX_NR_CONSOLES).
and for example on a Linux system I see this in /dev:
crw-rw-rw- 1 root 5, 0 Mon 04:20:13 tty
crw------- 1 root 4, 0 Mon 03:58:52 tty0
crw------- 1 root 4, 1 Mon 04:00:41 tty1
crw------- 1 tom 4, 2 Mon 04:30:31 tty2
crw------- 1 root 4, 3 Mon 04:00:41 tty3
crw------- 1 root 4, 4 Mon 04:00:41 tty4
crw------- 1 root 4, 5 Mon 04:00:41 tty5
crw------- 1 root 4, 6 Mon 04:00:41 tty6
crw------- 1 root 4, 7 Mon 03:58:52 tty7
crw------- 1 root 4, 8 Mon 03:58:52 tty8
crw------- 1 root 4, 9 Mon 03:58:52 tty9
crw------- 1 root 4, 10 Mon 03:58:52 tty10
crw------- 1 root 4, 11 Mon 03:58:52 tty11
All of those tty devices except one for which I have opened a console session are owned by root. To be able to log into one, a program such as getty acts to temporarily change its ownership. Doing a ps on my machine shows for example
root 2977 1 0 04:00 tty1 00:00:00 /sbin/getty 38400 tty1
root 2978 1 0 04:00 tty2 00:00:00 /bin/login --
root 2979 1 0 04:00 tty3 00:00:00 /sbin/getty 38400 tty3
root 2980 1 0 04:00 tty4 00:00:00 /sbin/getty 38400 tty4
root 2981 1 0 04:00 tty5 00:00:00 /sbin/getty 38400 tty5
root 2982 1 0 04:00 tty6 00:00:00 /sbin/getty 38400 tty6
Note that getty is running as root. That gives it the privilege to change the ownership of the tty device as needed. That is, while the ioctl may identify an unused tty, you need elevated privileges to actually open it. Linux (like any other Unix-like system) does not have a way to provide ensure that one process has truly exclusive access to a terminal. So it uses the device ownership and permissions to ensure this access.
If you're not the superuser then you should only try to access /dev/tty. That is a special device synonym for whichever tty is controlling the current process.

system command rm not working in expect program

I have a code (1) that is supposed to execute test in another code (its a pseudo-bash). This code (1) is wrote using the "expect" for the 'user simulation'.
The problem is when this code (1) execute a system ( on this case, system "rm totoExpect.txt titiExpect.txt") when its just doesnt find the titiExpected.txt, but is there!
There is nothing different between the two files, even the permissions are the same, i cant think in a reason that doesnt work.
Here is the part of the code (1) where the problem raises:
# test 5
proc t5 {} {
send "ls > totoExpect.txt\r"
send "cat < totoExpect.txt | wc -l > titiExpect.txt\r"
send "cat titiExpect.txt\r"
expect -re "(0|1|2|3|4|5|6|7|8|9)+.*>" { ok 5; } default { abort 5 }
system "rm totoExpect.txt titiExpect.txt"
}
And the Error message:
ls > totoExpect.txt
out: totoExpect.txt
seq[0]: 'ls'
-----3
ensishell>c
***** TEST 5 ok
rm: não foi possível remover "titiExpect.txt": Arquivo ou diretório não encontrado
child process exited abnormally
while executing
"system "rm totoExpect.txt titiExpect.txt""
(procedure "t5" line 6)
invoked from within
"t5"
("eval" body line 1)
invoked from within
"eval "t$t;" "
("foreach" body line 1)
invoked from within
"foreach t {0 1 2 3 4 5 6 7} { eval "t$t;" } "
invoked from within
"expect_user {
-timeout 30 "auto\n" {
puts "AUTO:\n";
foreach t {0 1 2 3 4 5 6 7} { eval "t$t;" }
}
-timeout 30 -re "(\[0123456789 \]+)\..."
(file "./testshell.expect" line 99)
make: ** [test] Erro 1
Where "rm: não foi possível remover "titiExpect.txt": Arquivo ou diretório não encontrado"
means "rm: it was not possible to remove "titiExpect.txt": file or directory not found" (sorry about that...)
and this is the ls -l just after the error message (so titiExpect.txt shouldnt be there):
-rwxrwxr-x 1 fernando fernando 273 Out 23 17:53 #Makefile#
-rwxrwxr-x 1 fernando fernando 6238 Nov 5 21:18 #ensishell.c#
-rwxrwxr-x 1 fernando fernando 1271 Out 24 20:30 #readcmd.h#
-rwxrwxr-x 1 fernando fernando 3250 Nov 5 21:07 #testshell.expect#
-rwxrwxrwx 1 fernando fernando 303 Out 24 20:21 Makefile
drwxrwxr-x 2 fernando fernando 4096 Nov 4 19:06 SEPC shell
-rw-rw-r-- 1 fernando fernando 193453 Out 18 18:25 Sujet_shell.pdf
-rwxrwxr-x 1 fernando fernando 25451 Nov 5 21:17 ensishell
-rwxrwxrwx 1 fernando fernando 6238 Nov 5 20:32 ensishell.c
-rw-rw-r-- 1 fernando fernando 10664 Nov 5 21:17 ensishell.o
-rwxrwxr-x 1 fernando fernando 7251 Nov 4 00:33 foo
-rw-rw-r-- 1 fernando fernando 173 Nov 4 00:33 foo.c
-rw-rw-r-- 1 fernando fernando 16 Nov 4 01:15 in.txt~
-rwxrwxrwx 1 fernando fernando 6603 Out 23 00:37 readcmd.c
-rwxrwxrwx 1 fernando fernando 1271 Out 23 01:24 readcmd.h
-rwxrwxrwx 1 fernando fernando 1271 Out 23 00:37 readcmd.h~
-rw-rw-r-- 1 fernando fernando 11216 Nov 5 21:17 readcmd.o
-rwxrwxrwx 1 fernando fernando 3250 Nov 5 20:41 testshell.expect
-rwx------ 1 fernando fernando 1263 Nov 5 12:43 toto.txt
The worst problem is this code is not supposed to be modified, but its seems to me that is the programs fault this fail. (in fact, commenting the line solve the problem..)
Any ideas?
Look.
# test 5
proc t5 {} {
send "ls > totoExpect.txt\r"
send "cat < totoExpect.txt | wc -l > titiExpect.txt\r"
send "cat titiExpect.txt\r"
expect -re "(0|1|2|3|4|5|6|7|8|9)+.*>" { ok 5; } default { abort 5 }
system "rm totoExpect.txt titiExpect.txt"
}
The first send crates a file named totoExpect.txt\r.
The second send generates a file named titiExpect.txt\r. The cat part actually fails, because there is no file totoExpect.txt, but since the command is part of a pipe, and not the last command in said pipe, expect will not catch that as an error. (All you'll see is that the titiExpect.txt\r file will be empty.)
The \r above is the CR character, and probably the reason you have missed it. In Linux, it is perfectly allowed character in file names (as only / and \0 are forbidden). Just remove it from your test and you'll find it works fine.
Or, if you insist on keeping it, then keep it consistently:
# test 5
proc t5 {} {
send "ls > totoExpect.txt\r"
send "cat < totoExpect.txt\r | wc -l > titiExpect.txt\r"
send "cat titiExpect.txt\r"
expect -re "(0|1|2|3|4|5|6|7|8|9)+.*>" { ok 5; } default { abort 5 }
system "rm totoExpect.txt\r titiExpect.txt\r"
}
Finally, when removing files, it is recommended to use the -f flag, so rm does not complain if one of the files happens to not exist.
My suggestion is to rewrite that test as
# test 5
proc t5 {} {
send "ls > totoExpect.txt"
send "cat < totoExpect.txt | wc -l > titiExpect.txt"
send "cat titiExpect.txt"
expect -re "(0|1|2|3|4|5|6|7|8|9)+.*>" { ok 5; } default { abort 5 }
system "rm -f totoExpect.txt titiExpect.txt"
}
eradicating those erratic \rs.

How to map /proc/bus/usb/devices entry to a /dev/sdX device?

I need to know how I can figure out to which entry in /proc/bus/usb/devices a /dev/sdX device maps to. Basically, I need to know the vendor id and product id of a given USB stick (which may not have a serial number).
In my case, I have this entry for my flash drive in /proc/bus/usb/devices:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0781 ProdID=5530 Rev= 2.00
S: Manufacturer=SanDisk
S: Product=Cruzer
S: SerialNumber=0765400A1BD05BEE
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=200mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I happen to know that in my case it is /dev/sda, but I'm not sure how I can figure this out in code. My first approach was to loop through all /dev/sdXX devices and issue a SCSI_IOCTL_GET_BUS_NUMBER and/or SCSI_IOCTL_GET_IDLUN request, but the information returned doesn't help me match it up:
/tmp # ./getscsiinfo /dev/sda
SCSI bus number: 8
ID: 00
LUN: 00
Channel: 00
Host#: 08
four_in_one: 08000000
host_unique_id: 0
I'm not sure how I can use the SCSI bus number or the ID, LUN, Channel, Host to map it to the entry in /proc/bus/usb/devices. Or how I could get the SCSI bus number from the /proc/bus/usb/001/006 device, which is a usbfs device and doesn't appear to like the same ioctl's:
/tmp # ./getscsiinfo /proc/bus/usb/001/006
Could not get bus number: Inappropriate ioctl for device
Here's the test code for my little getscsiinfo test tool:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <scsi/scsi.h>
#include <scsi/sg.h>
#include <sys/ioctl.h>
struct scsi_idlun
{
int four_in_one;
int host_unique_id;
};
int main(int argc, char** argv) {
if (argc != 2)
return 1;
int fd = open(argv[1], O_RDONLY | O_NONBLOCK);
if (fd < 0)
{
printf("Error opening device: %m\n");
return 1;
}
int busNumber = -1;
if (ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, &busNumber) < 0)
{
printf("Could not get bus number: %m\n");
close(fd);
return 1;
}
printf("SCSI bus number: %d\n", busNumber);
struct scsi_idlun argid;
if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, &argid) < 0)
{
printf("Could not get id: %m\n");
close(fd);
return 1;
}
printf("ID: %02x\n", argid.four_in_one & 0xFF);
printf("LUN: %02x\n", (argid.four_in_one >> 8) & 0xFF);
printf("Channel: %02x\n", (argid.four_in_one >> 16) & 0xFF);
printf("Host#: %02x\n", (argid.four_in_one >> 24) & 0xFF);
printf("four_in_one: %08x\n", (unsigned int)argid.four_in_one);
printf("host_unique_id: %d\n", argid.host_unique_id);
close(fd);
return 0;
}
Does anyone have any idea?
udevadm is capable of what your are trying to achieve.
udevadm info -a -p $(udevadm info -q path -n /dev/sda)
udevadm's sources will tell you how it is done.
I believe you can collect such information using libudev library.
Here are some details about it: http://www.signal11.us/oss/udev/
I found something like this on above site:
.. Using libudev, we'll be able to inspect the devices, including their Vendor ID (VID), Product ID (PID), serial number, and device strings, without ever opening the device. Further, libudev will tell us exactly where inside /dev the device's node is located, giving the application a robust and distribution-independent way of accessing the device. ...
This isn't all that easy, nor very well documented (at least from a high-level perspective). The following should work in Kernel's from version 3.1 upward (at least).
I have found the easiest (probably not the only way) is to navigate from the block device entry and test each block device until you find the one that matches your USB entry.
For example, given a block device in /sys/block, such as sdb, you can find the hardware device descriptor entry like this:
# cd /sys/block
# cd $(readlink sdb); cd ../../../../../..
# ls -l
total 0
drwxr-xr-x 6 root root 0 Aug 14 10:47 1-1:1.0
-rw-r--r-- 1 root root 4096 Aug 14 10:52 authorized
-rw-r--r-- 1 root root 4096 Aug 14 10:52 avoid_reset_quirk
-r--r--r-- 1 root root 4096 Aug 14 10:47 bcdDevice
-rw-r--r-- 1 root root 4096 Aug 14 10:49 bConfigurationValue
-r--r--r-- 1 root root 4096 Aug 14 10:47 bDeviceClass
-r--r--r-- 1 root root 4096 Aug 14 10:49 bDeviceProtocol
-r--r--r-- 1 root root 4096 Aug 14 10:49 bDeviceSubClass
-r--r--r-- 1 root root 4096 Aug 14 10:49 bmAttributes
-r--r--r-- 1 root root 4096 Aug 14 10:49 bMaxPacketSize0
-r--r--r-- 1 root root 4096 Aug 14 10:49 bMaxPower
-r--r--r-- 1 root root 4096 Aug 14 10:49 bNumConfigurations
-r--r--r-- 1 root root 4096 Aug 14 10:49 bNumInterfaces
-r--r--r-- 1 root root 4096 Aug 14 10:49 busnum
-r--r--r-- 1 root root 4096 Aug 14 10:52 configuration
-r--r--r-- 1 root root 65553 Aug 14 10:47 descriptors
-r--r--r-- 1 root root 4096 Aug 14 10:52 dev
-r--r--r-- 1 root root 4096 Aug 14 10:49 devnum
-r--r--r-- 1 root root 4096 Aug 14 10:52 devpath
lrwxrwxrwx 1 root root 0 Aug 14 10:47 driver -> ../../../../../../bus/usb/drivers/usb
drwxr-xr-x 3 root root 0 Aug 14 10:52 ep_00
-r--r--r-- 1 root root 4096 Aug 14 10:47 idProduct
-r--r--r-- 1 root root 4096 Aug 14 10:47 idVendor
-r--r--r-- 1 root root 4096 Aug 14 10:52 ltm_capable
-r--r--r-- 1 root root 4096 Aug 14 10:47 manufacturer
-r--r--r-- 1 root root 4096 Aug 14 10:49 maxchild
lrwxrwxrwx 1 root root 0 Aug 14 10:52 port -> ../1-0:1.0/port1
drwxr-xr-x 2 root root 0 Aug 14 10:52 power
-r--r--r-- 1 root root 4096 Aug 14 10:47 product
-r--r--r-- 1 root root 4096 Aug 14 10:52 quirks
-r--r--r-- 1 root root 4096 Aug 14 10:47 removable
--w------- 1 root root 4096 Aug 14 10:52 remove
-r--r--r-- 1 root root 4096 Aug 14 10:47 serial
-r--r--r-- 1 root root 4096 Aug 14 10:49 speed
lrwxrwxrwx 1 root root 0 Aug 14 10:47 subsystem -> ../../../../../../bus/usb
-rw-r--r-- 1 root root 4096 Aug 14 10:47 uevent
-r--r--r-- 1 root root 4096 Aug 14 10:52 urbnum
-r--r--r-- 1 root root 4096 Aug 14 10:49 version
(You can find excellent documentation for the contents of the USB Descriptor here on the BeyondLogic site.)
Given the above, you should be able to map one or more of the USB device fields to the contents of /proc/bus/usb/devices. I find that the serial number is the easiest to match on, so that if you were to cat serial above, you would get the same serial number as listed:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0781 ProdID=5575 Rev=01.26
S: Manufacturer=SanDisk
S: Product=Cruzer Glide
S: SerialNumber=4C530100801115115112
C: #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=200mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
If you go to /sys/block, you can list the full path to the host device entry in the storage driver sysfs entry for each device. Typically, I do this using some programmatic means instead of at the shell prompt, but here you can see the links themselves:
# ls -l sd*
lrwxrwxrwx 1 root root 0 Aug 14 10:45 sda -> ../devices/pci0000:00/0000:00:10.0/host32/target32:0:0/32:0:0:0/block/sda
lrwxrwxrwx 1 root root 0 Aug 14 10:47 sdb -> ../devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-1/1-1:1.0/host33/target33:0:0/33:0:0:0/block/sdb
Note that you mustn't make any assumptions about the numbers you see in the links. Depending upon the bus subsystem, the mappings could be quite different. For example, on a Raspberry Pi, it looks like this:
# ls -l sd*
lrwxrwxrwx 1 root root 0 Aug 13 23:54 sda -> ../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/host3/target3:0:0/3:0:0:0/block/sda
lrwxrwxrwx 1 root root 0 Aug 13 23:54 sdb -> ../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/host4/target4:0:0/4:0:0:0/block/sdb
So, the best approach is to take the approach listed at the top and navigate relative to the storage driver to find the USB device descriptor.
I'd be curious about more authoritative answers to this. The method above was arrived at by trial-and-error but has been working on several different devices and Kernels with no problem.
Instead of using proc/bus/usb which is for usbfs you can use /proc/scsi/scsi. In there you can find the Vendor and Serial number with specific channel ID and LUN number.

Resources