我正在尝试使用MySQL ODBC(libmyodbc5a)驱动程序在Asterisk 13上设置实时端点.因此观察到,一旦端点注册,Asterisk Server就会崩溃.消息日志显示:
res_odbc.c: SetConnectAttr (Txn isolation) returned an error: HY000: [MySQL][ODBC 5.3(w) Driver]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '7' at line 1
res_config_odbc.c: SQL Prepare failed![SELECT * FROM ps_domain_aliases WHERE id = ?]
res_odbc.c: Connection is down attempting to reconnect...
res_odbc.c: Connecting DE-VOICE
res_odbc: Connected to DE-VOICE [DE-VOICE-DNS]
SetConnectAttr (Txn isolation) returned an error: HY000: [MySQL][ODBC 5.3(w) Driver]Lost connection …Run Code Online (Sandbox Code Playgroud) 如何从连接对象获取数据库名称的名称
try {
this.ds = (DataSource) new InitialContext().lookup("java:comp/env/jdbc/amger");
} catch (NamingException ne) {
}
Connection conObj = ds.getConnection();
Run Code Online (Sandbox Code Playgroud)
如何从con获取该数据库名称
我曾经遇到过wildfly 8这个问题,但解决了包含$ WILDFLY_HOME/modules/system/layers/base/org/eclipse/persistence/main中的eclipselink.jar并使用资源root更新module.xml
<resource-root path="eclipselink.jar" />
Run Code Online (Sandbox Code Playgroud)
并包括在我的ejb模块的POM.xml上
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.6.0</version>
<scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这在Wildfly 8中运行良好.*.不幸的是,为Wildfly 9CR1采用相同的技术一直都没有通过以下日志:
08:52:31,028 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."rga-ear-1.0.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."rga-ear-1.0.ear".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "rga-ear-1.0.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.ServiceConfigurationError: javax.persistence.spi.PersistenceProvider: Provider org.eclipse.persistence.jpa.PersistenceProvider could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.jboss.as.jpa.persistenceprovider.PersistenceProviderLoader.loadProviderModuleByName(PersistenceProviderLoader.java:70)
at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:998)
at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.nextPhaseDependsOnPersistenceUnit(PersistenceUnitServiceHandler.java:1046) …Run Code Online (Sandbox Code Playgroud) 在Django <2中,正常的方法是使用正则表达式.但现在建议在Django => 2中使用path()而不是url()
path('account/<int:code>/', views.account_code, name='account-code')
Run Code Online (Sandbox Code Playgroud)
这看起来还不错,并且可以很好地匹配url模式
/account/23/
/account/3000/
Run Code Online (Sandbox Code Playgroud)
但是,这个问题是我也希望这个匹配负整数
/account/-23/
Run Code Online (Sandbox Code Playgroud)
请问如何使用path()执行此操作?
我有一个现有的 Django 项目,我正在尝试将其从模板移动到 NextJs 前端。我遇到了 Next-Auth-js,它在 Next Auth 中似乎不错。
然而,该文档似乎更关注与 JS 相关的后端身份验证。按照此示例,我已将 NEXTAUTH_URL 环境变量发送到我的 DRF 端点 localhost:8002。当前端运行在 localhost:3000 上时。虽然我的 _app.js 看起来像这样:
<Provider options={{site: process.env.NEXTAUTH_URL,}} session={pageProps.session} >
<Component {...pageProps} />
</Provider>
Run Code Online (Sandbox Code Playgroud)
使用Nav.js进行测试,我更改了登录/退出 href 以指向我的 Django 端点,但似乎 next-auth-js 忽略了这一点,并将会话提取放置到我的前端http://localhost:3000/api/auth/session而不是http://localhost:8002/api/auth/session.
对于如何使用 Django Rest Framework (DRF) 正确/安全地实现此身份验证的任何帮助,我将不胜感激
我想创建一个布局,我想在水平方向上对齐内容,但每行只能在水平方向滚动.这是我的JSFiddle示例.
.x-scroller{
overflow-x: scroll;
overflow-y:hidden;
height:100px;
width: 300px
}
Run Code Online (Sandbox Code Playgroud)
所述.X-卷轴DIV将与她的内容的循环动态生成,每个所述x卷轴DIV的将同样有一些内容,我将希望能够在水平方向上滚动仅作为可以在下面的图可以看到:

我是Asterisk的新手,这是我第一次尝试连接数据库(MySQL).但我一直收到此错误[unixODBC] [驱动程序管理器]未找到数据源名称,并且未指定默认驱动程序.这是我的设置:
/etc/odbcinst.int
[Default]
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1
;UsageCount = 2
Run Code Online (Sandbox Code Playgroud)
/etc/odbc.ini
[MYSQL-DNS]
Driver =MySQL
Description = MySQL connection to ‘My Voice’ database
Trace = Yes
TraceFile = /tmp/odbc.log
Server =localhost
Port =3306
Database =my_database
UserName =myuser
Password =mypass
Option = 3
Socket =/var/run/mysqld/mysqld.sock
Run Code Online (Sandbox Code Playgroud)
/var/lib/asterisk/.profile
export ODBCINI=/etc/odbc.ini
export ODBCSYSINI=/etc
Run Code Online (Sandbox Code Playgroud)
我还将odbcinst.ini和odbc.ini分别复制到〜/ .odbcinst.ini和〜/ .odbc.ini,并复制到/ var/lib/asterisk /只是为了清除所有疑问.
res_odbc.conf
[ENV]
[my_database]
enabled => yes
dsn =>MYSQL-DNS
username => …Run Code Online (Sandbox Code Playgroud) 我有一个只需要实例化一次的对象。尝试使用 Redis 缓存实例失败并出现错误cache.set("some_key", singles, timeout=60*60*24*30),但由于其他线程操作而出现序列化错误:
类型错误:无法 pickle _thread.lock 对象
但是,我可以根据需要轻松缓存其他实例。
因此我正在寻找一种创建 Singleton 对象的方法,我也尝试过:
class SingletonModel(models.Model):
class Meta:
abstract = True
def save(self, *args, **kwargs):
# self.pk = 1
super(SingletonModel, self).save(*args, **kwargs)
# if self.can_cache:
# self.set_cache()
def delete(self, *args, **kwargs):
pass
class Singleton(SingletonModel):
singles = []
@classmethod
def setSingles(cls, singles):
cls.singles = singles
@classmethod
def loadSingles(cls):
sins = cls.singles
log.warning("*****Found: {} singles".format(len(sins)))
if len(sins) == 0:
sins = cls.doSomeLongOperation()
cls.setSingles(sins)
return sins
Run Code Online (Sandbox Code Playgroud)
在 view.py 中我调用了 Singleton.loadSingles()但我注意到我得到了
已找到: …
我有一个对象数组,我想从每个对象中内爆特定的私有属性以形成一个分隔字符串。
我只对该数组的属性之一感兴趣。我知道如何通过迭代数据集,foreach()但是有函数式方法吗?
$ids = "";
foreach ($itemList as $item) {
$ids = $ids.$item->getId() . ",";
}
// $ids = "1,2,3,4"; <- this already returns the correct result
Run Code Online (Sandbox Code Playgroud)
我的班级是这样的:
class Item {
private $id;
private $name;
function __construct($id, $name) {
$this->id=$id;
$this->name=$name;
}
//function getters.....
}
Run Code Online (Sandbox Code Playgroud)
样本数据:
$itemList = [
new Item(1, "Item 1"),
new Item(2, "Item 2"),
new Item(3, "Item 3"),
new Item(4, "Item 4")
];
Run Code Online (Sandbox Code Playgroud) 我的第一个JSF页面正在抛出javax.faces.application.ViewExpiredException.当我搜索时,我得到了解决我问题的解决方案.
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)
但我担心安全隐患.
mysql ×3
asterisk ×2
django ×2
odbc ×2
python ×2
unixodbc ×2
arrays ×1
css ×1
deployment ×1
django-urls ×1
eclipselink ×1
html ×1
java ×1
java-ee-7 ×1
javascript ×1
jdbc ×1
jsf ×1
jsf-2.2 ×1
next-auth ×1
next.js ×1
object ×1
oop ×1
php ×1
reactjs ×1
security ×1
session ×1
singleton ×1
viewstate ×1
wildfly ×1