/**
*
*/
package com.sprucetec.tms.fee.utils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.springframework.core.io.support.PropertiesLoaderUtils;
/**
*
* Title: ConfigFileUtils.java<br>
* Description: <br>
* Copyright: Copyright (c) 2016<br>
* Company: 北京云杉世界信息技术有限公司<br>
*
* @author
* 2016年3月2日
*/
public class TmsConfigFileUtils {
private static final Logger logger = Logger.getLogger(TmsConfigFileUtils.class);
/**
*
* @author meicai
* 2016年3月2日
* @param nodeName
* @return
*/
public static ArrayList<Long> getShardconfig(String nodeName) {
String configName = "shard.properties";
String result = pubReadConfig(configName, nodeName);
if (result == null) {
result = pubReadConfig("prop/" + configName, nodeName);
}
String[] nodes = result.split(",");
ArrayList<Long> nodeList = new ArrayList<Long>();
for(String node : nodes){
nodeList.add(Long.valueOf(node));
}
return nodeList;
}
/**
* 通用读取方法
*
* @param configName
* @param nodeName
* @return
*/
public static String pubReadConfig(String configName, String nodeName) {
Properties props = new Properties();
while (true) {
try {
props = PropertiesLoaderUtils.loadAllProperties(configName);
return (String) props.get(nodeName);
} catch (IOException e) {
logger.error("ReadConfigException", e);
System.out.println(e.getMessage());
}
}
}
}
相关推荐
使用 sdcc 编写51单片机.zip
使用 sdcc 编写51单片机.zip
Visual Studio Code + SDCC开发51单片机 2 - 特殊之处
SDCC中51寄存器的定义与Keil的不同。为了与Keil保持兼容性,将SDCC的关键字做一些定义,可以通过EIDE创建一个blink例程,然后里面会有一个reg52.h,拷贝这个文件并添加自己选择的MCU额外定义的寄存器即可。 1. 特殊寄存器命令 typedef __sfr sfr; typedef __sfr16 sfr16; typedef __sfr32 sfr32; typedef __sbit sbit; typedef __bit bit; 2. 存储类型 #define ree
51单片机开发环境-使用VSCode结合SDCC搭建.zip
51单片机开发环境-使用VSCode结合SDCC搭建.zip
sdcc对应stc51单片机
现在国产stc51单片机性能上还是够用的了,软件工具选择sdcc是好的选择。别的付费软件就算了吧。 使用了一段时间的sdcc,汇编和c都试用了下,感觉还可以,命令行输入,错误列在命令下面,没有错误就是没有反应。文本编辑软件使用的是notepad++。 c语言下有个函数数组的调用出了问题,__code伪指令没有起到作用,只好转换成函数的一般调用的基本方式。 汇编还好,虽然是很少用到。混合asm和c也是简单,只是里面的io定义还不一样,汇编要按汇编的定义,c的要按c的定义。 c的头文件要注意,当然把所有
NVIDIA DGX Spark 深度应用解析:从大模型训练到边缘推理的完整实践指南
内存管理:充分利用统一内存架构,避免不必要的数据传输批处理大小:根据模型大小调整批处理大小以优化内存使用精度选择:在精度损失可接受范围内使用较低精度计算流水线优化:重叠计算和数据传输操作DGX Spark作为一个专门的AI计算平台,在大模型开发的各个阶段都能发挥重要作用。从数据预处理到模型训练,从微调到推理部署,其统一内存架构和强大的计算能力为AI开发者提供了前所未有的本地开发体验。需要注意的是,虽然DGX Spark性能强大,但合理的算法设计和系统优化仍然是获得最佳性能的关键。
LibTV本地部署:AI漫剧创作完整解决方案与实战指南
如果你正在关注AI漫剧创作这个赛道,可能会发现一个有趣的现象:市面上的AI视频工具要么功能单一,要么云端服务昂贵且存在内容审核风险。而今天要介绍的LibTV本地部署方案,或许能为你打开一扇新的大门。 这个方案的核心是Seedance2.0与豆包AI的本地化集成,它真正解决的是创作者对内容自主权、成本控制和创作效率的三重需求。与红果、抖音等平台提供的标准化AI工具相比,本地部署意味着你可以完全掌控生成过程,不受平台规则限制,更重要的是——所有数据都在本地,不存在内容泄露风险。 1. 这篇文章真正要解决的问题
使用 SDCC 编译器开发 51 单片机应用时需要注意的几个地方
有时候为了代码方便管理,我们会将中断服务函数和相应模块放在一个文件里(如 timer 中断放在 timer.c 中)或者集中放在一个文件中(如 interrupt.c)。如果 main 函数在不同的文件里(如 main.c),中断服务程序是不会工作的。这时必须在 main.c 文件中加入中断服务函数的声明(如 timer_irq __interrupt 1 是的,中断函数的声明也要加上中断号。也可以将声明放在一个头文件里,然后在 main.c 文件中使用 #include 宏包含)。
Linux之SUSE系统SAP-HANA经常系统内存不足使得SAP应用不能使用解决方案
问题描述 Linux内存使用量超过阈值,使得sap应用程序无可用内存,最终导致程序崩溃。 问题原因 自己查阅了一些资料,也基于zabbix的可用内存和实际不太一样入手去找原因发现问题出现于Cached的值过大,导致系统没有可以再分配的内存空间。Cached只要用来缓存文件的,经常读写的文件会被缓存到Cached中,可以增加读写效率,该功能是Linux系统内核提供的,而SAP-HANA的日志文件很大...
Spring Boot @Value读不到Nacos配置中心的值。(properties配置文件)
嘻嘻哈哈学技术
简单概述人形机器人的“大脑、小脑”
原创 仲翔云人形机器人产业通2024年09月13日 19:41上海人形机器人的大脑和小脑是其控制系统的关键组成部分,它们模拟了人类大脑和小脑的功能,以实现复杂的运动控制和决策过程。
一文入门BMS(电池管理系统)
本文章是基于曾师兄的文稿《具有组网扩展功能的新能源汽车电池管理系统》而写的文章。该文章主要是对BMS(Battery Management System,电池管理系统)做一些简要的介绍,借此助各位也助我入门BMS。有纰漏请指出,转载请说明。学习交流请发邮件 1280253714@qq.com。
java读properties配置文件中的值
思维导图: 我这边使用的是类加载器的方法,获取properties文件 案例代码如下: PropertiesTest package com.lbl.properties; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class PropertiesTest { public static void main(String[] args) throws I
【OTFS与信号处理:论文阅读4】OTFS时延多普勒域嵌入导频辅助信道估计(已更新)
【OTFS与信号处理:论文阅读】Embedded Pilot-Aided Channel Estimation for OTFS in Delay–Doppler Channel(快来看看OTFS嵌入式导频设计的经典之作!!!)
比properties更好用的读配置文件的方式
用properties.load()时总是要求改level为6,很不舒服 学习了用别的方式读配置文件 案例如下: 一、需要的依赖有: <!--log4j日志核心包--> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16
在 ABAP 平台上搭建 OAuth 2.0 Server:架构、流程、权限与落地实战
摘要:本文为SAP ABAP开发人员提供将ABAP平台配置为OAuth 2.0授权服务器的实战指南。重点介绍两种授权流程(授权码和SAML Bearer)的实现方案,包括核心事务配置(SOAUTH2/SAML2)、授权对象(S_SCOPE)管理以及端点交互规范。通过具体配置清单和三类典型集成场景(第三方Web应用访问OData、企业集成平台调用、BTP应用对接)的落地示例,帮助读者快速构建安全的OAuth 2.0服务架构。文档强调SSL/TLS基础安全、scope最小授权原则以及授权与令牌端点的标准交互模式
36、R语言中的回归模型与机器学习算法
本文介绍了R语言中多种回归模型和机器学习算法,包括Cox回归模型、数据平滑方法(如样条函数、多项式曲面拟合和核平滑)以及回归树模型等。重点讲解了这些方法的实现函数、参数说明以及实际应用示例,如使用`coxph`进行生存分析、使用`spline`和`smooth.spline`进行数据平滑处理、使用`loess`和`locpoly`进行非参数回归分析,以及使用`rpart`构建和可视化回归树。此外,还涉及了模型评估与优化策略,如数据拆分、交叉验证和树的修剪。通过这些方法,可以更好地处理复杂数据集并提升模型性能
java读properties配置文件
import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.net.URL; import java.util.Properties; public class ConfigureProperties { private static ConfigureP
TMS_WebGMaps_1.9.8.0_Full_Source
TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder
Properties类读配置文件、修改配置文件——IO流随记7
配置文件的读取
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)
迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)
Java读常用配置文件properties的方法
有两种方法:第一种直接使用,第二种封装的好点。 1 // 代表静态资源路径 private static String WEB_ROOT = System.getProperty("user.dir") + "\\" + "src\\main\\webapp"; // 还要将配置文件中的信息读取到map中 private static Map<String, String>...
IMSL CNL 7.0.0 (x86-64)Crack
IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件
读配置文件properties
package com.sais.inkaNet.common.util; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; i
读配置文件可以保持顺序的 Java Properties 类
序 前几天,公司项目中有一个需求是读取配置文件的,而且最好能够保证加载到内存中的顺序能够和配置文件中的顺序一致,但是,如果使用 jdk 中提供的 Properties 类的话,读取配置文件后,加载到内存中的顺序是随机的,不能保证和原文件的顺序一致,因此,jdk 提供的 Properties 是不行的。 背景 由于有这样的需求,而 Java 的 Properti
java 读properties配置文件_java简单读取properties配置文件的方法示例
本文实例讲述了java简单读取properties配置文件的方法。分享给大家供大家参考,具体如下:读取配置文件,小结如下import java.io.FileNotFoundException;import java.io.IOException;import java.util.Properties;public class loadConf {private Properties prop =...
java properties 路径问题_Java properties 读不到配置文件的问题
Properties properties=new Properties();properties.load(JDBCUtils.class.getClassLoader().getResourceAsStream("druid.properties"));JDBCUtils是我这个类的类名druid.propeeties 是我要读取的配置文件 路径在我JDBCUtils这个类文件的同一个包下但是...
Java--读/写Properties配置文件
1.Properties文件的创建 或者 结果 2.properties类与properties配置文件 我们平时可以通过java中的properties类创建对象对properties文件中的内容进行读写操作。 properties类继承自Hashtable类并实现了Map接口,也是使用一种键值对的形式来保存属性集,properties的键和值都是字符串类型。 3.Properties中的...
Java Properties 类 该类用于读/写Java的配置文件
Java Properties 类 该类用于读/写Java的配置文件。 韩顺平Java课程学习笔记
读配置文件能够保持顺序的 Java Properties 类
序 前几天,公司项目中有一个需求是读取配置文件的。并且最好可以保证载入到内存中的顺序可以和配置文件里的顺序一致,可是。假设使用 jdk 中提供的 Properties 类的话,读取配置文件后。载入到内存中的顺序是随机的,不能保证和原文件的顺序一致,因此,jdk 提供的 Properties 是不行的。 背景 因为有这种需求。而 Java 的 P...
5019



被折叠的 条评论
为什么被折叠?



