这就是我在打字稿中导入app.config.ts类并使用它的方式。如何AppConfig在 Javascript 文件 (config.js) 中导入相同的类并访问该方法getConfig?
服务.ts
import { AppConfig } from '../app.config';
constructor(private http: Http, private config: AppConfig) {
this.dataURL = this.config.getConfig('restApi') + '/api/getdata/'
console.log(this.dataURL)
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的Kafka动物园管理员设置SASL身份验证。我遵循了以下链接中提到的所有步骤
https://cwiki.apache.org/confluence/display/ZOOKEEPER/Client-Server+mutual+authentication
下面是我的server_jaas.conf文件保存在/ home目录中
Server {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="admin"
password="admin-secret"
user_admin="admin-secret"
};
Run Code Online (Sandbox Code Playgroud)
以下是我的java.env文件配置
SERVER_JVMFLAGS="-Djava.security.auth.login.config=/home/server_jaas.conf"
Run Code Online (Sandbox Code Playgroud)
以下是我得到的错误
2017-08-01 16:49:40,774 [myid:] - ERROR [main:ServerCnxnFactory@199] - No JAAS configuration section named 'Server' was foundin '/home/server_jaas.conf'.
2017-08-01 16:49:40,774 [myid:] - ERROR [main:ZooKeeperServerMain@64] - Unexpectked exception, exiting abnormally
java.io.IOException: No JAAS configuration section named 'Server' was foundin '/home/server_jaas.conf'.
at org.apache.zookeeper.server.ServerCnxnFactory.configureSaslLogin(ServerCnxnFactory.java:200)
at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:82)
at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:117)
at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:87)
at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:53)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
Run Code Online (Sandbox Code Playgroud) Snackbar 宽度与手机中的全宽匹配,但在平板电脑中运行时未设置 match_parent。请帮助我!代码如下
final Snackbar mSnackbar = Snackbar.make(view, "", Snackbar.LENGTH_LONG);
LayoutInflater inflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Snackbar.SnackbarLayout layout = (Snackbar.SnackbarLayout) mSnackbar.getView();
layout.setPadding(0,0,0,0);
TextView textView = (TextView)
layout.findViewById(android.support.design.R.id.snackbar_text);
textView.setVisibility(View.INVISIBLE);
snackView = inflater.inflate(R.layout.snackbar_layout, null);
layout.addView(snackView, 0);
Run Code Online (Sandbox Code Playgroud) 我正在使用 java 类创建一个大的 excel。Excel 包含一个存储字符串的合并单元格。字符串的长度非常大,我正在动态获取此字符串。我需要增加合并单元格的高度,以便完整的字符串适合该单元格。我尝试使用“换行文本”,它会换行文本但不会增加合并单元格的高度,因为在 excel 中看不到完整的字符串。我正在使用的 Java 类是:
以及其他必需的依赖类。有没有办法根据单元格值增加合并单元格的高度。
全部!
我想知道如何从 RSpec 发出 PUT/PATCH 请求来测试 Rails 5.1.2 API,如下所示:
describe 'PUT /users/:id' do
context '# check success update' do
it 'returns status code 204' do
put 'update', params: { user: { id: 3, email: 'newmail@ya.ru'} }
expect(response).to have_http_status(204)
end
end
end
Run Code Online (Sandbox Code Playgroud)
得到以下错误:
ActionController::UrlGenerationError:
No route matches {:action=>"update", :controller=>"users", :user=>{:id=>3, :email=>"newmail@ya.ru"}}
Run Code Online (Sandbox Code Playgroud)
路线没问题:
Prefix Verb URI Pattern Controller#Action
users GET /users(.:format) users#index
POST /users(.:format) users#create
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
Run Code Online (Sandbox Code Playgroud) algorithm ×1
android ×1
apache-poi ×1
jaas ×1
java ×1
javascript ×1
rspec ×1
sasl ×1
typescript ×1