我正在使用Spring JPA,为了向我的实体添加一个String列表,我正在使用@ElementCollection,如下所示.
@ElementCollection
private Map<Integer, String> categories;
Run Code Online (Sandbox Code Playgroud)
当我使用它时,它会生成一个名为subscription_categoriesthis 的表,其中包含以下列subscription(varchar), catergories(varchar) and caterogies_key (int)
如果我在桌面上使用我的SQL工具,我可以使用以下内容查询此表
select `subscription_categories`.`subscription` from `subscription_categories` where `subscription_categories`.`categories`='TESTING';
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试在Spring Data中使用它时,它会因"... not mapped"错误而失败
以下是一些尝试:
@Query("select s.subscription from subscription_categories s where s.categories = ?1")
List<Subscription> findUsernameByCategory(String category);
@Query("select s.subscription from categories s where s.categories = ?1")
List<Subscription> findUsernameByCategory(String category);
Run Code Online (Sandbox Code Playgroud)
两者都返回相同的错误.
引起:org.hibernate.hql.internal.ast.QuerySyntaxException:未映射类别
我的问题是:
如何查询@ElementCollection创建的表?
I am capturing events from a stream, each event is a Device Object. The way the stream work is that it is on a timer, so it picks up the same device multiple times and adds to the stream.
I am putting all theres is a List<Device> and putting that into another stream.
I have create a StreamTransformer in the attempt to remove duplicate from the list and then add the unique list back into the stream.
This transform …
我正在对 Flutter 移动应用程序进行 Web 化,并尝试解决 Web 中对路径提供程序缺乏支持的问题。
我正在使用 PDF (pdf: ^1.9.0) 包生成 PDF 文档并将其上传到 Google Drive,我试图找出是否可以生成 PDF 并将其存储在内存中以使其与网络兼容。
使用路径提供程序的当前代码示例。
createFile() async {
final downloads = await getApplicationSupportDirectory();
final file = File("${downloads.path}/$filename.pdf");
await file.writeAsBytes(pdf.save());
await GoogleDriveController.uploadFileToGoogleDrive(file.path);
}
Run Code Online (Sandbox Code Playgroud)
问题:有没有办法使用 Flutter web 为 web 生成并存储 Fies 在内存中?
我正在使用以下对 Twitter API 的调用
https://api.twitter.com/1.1/search/tweets.json?q=#iosgames
Run Code Online (Sandbox Code Playgroud)
我得到回应:
{"errors":[{"code":25,"message":"Query parameters are missing."}]}
Run Code Online (Sandbox Code Playgroud)
根据this唯一需要的参数是q查询字符串。
问题不在于我的 OAuth,因为它对状态/用户调用很好。
我错过了什么?
我目前正在使用 Dart/Flutter BLE 插件来更好地了解 BLE 设备。
插入:
https://pub.dartlang.org/packages/flutter_blue
当我连接到虚拟循环训练器时,我选择 0x1818 服务,然后订阅循环功率测量的 0x2A63 特征。
我正在努力将我得到的响应列表与下面针对此服务/特性的 GATT 文档进行调整。该列表中有 18 个值,但 GATTS 列表中只有 17 个。而且这些价值观似乎没有任何意义。
我还尝试将前两个值“52”、“24”转换为 16 位二进制,看看它是否与第一个字段的标志对齐,但结果如下,这又没有意义。
0x3418 = 11010000011000
Run Code Online (Sandbox Code Playgroud)
这是我第一次连接到训练器时的屏幕截图。
这个截图是我骑着自行车轻骑时的
此屏幕截图是当我停止骑车但踏板和车轮仍在转动时的屏幕截图。
自行车训练器是Cycleops Magnus,它没有Cycle Speed Cadence服务1816,但可以提供基于功率的虚拟速度。
我的问题是这样的:
列表中与 GATTS 特征和奖励问题相对应的值是,我如何从该服务中的值推断速度或节奏?
我有一段时间与BLE合作,但主要是为了阅读和通知特性。
这些设备特别是支持GATTS自行车动力服务的虚拟自行车训练器-0x1818 链接
我知道可以增加此教练机的阻力,但是我已经阅读了有关循环功率控制点-0x2A66 [link] [2]的文档,这是唯一具有强制写入功能的文档,但是似乎没有文档感。
培训师:Cyclopop Magnus
读写特点
// Reads all characteristics
var characteristics = service.characteristics;
for(BluetoothCharacteristic c in characteristics) {
List<int> value = await device.readCharacteristic(c);
print(value);
}
// Writes to a characteristic
await device.writeCharacteristic(c, [0x12, 0x34])
Run Code Online (Sandbox Code Playgroud)
读写描述符
// Reads all descriptors
var descriptors = characteristic.descriptors;
for(BluetoothDescriptor d in descriptors) {
List<int> value = await device.readDescriptor(d);
print(value);
}
// Writes to a descriptor
await device.writeDescriptor(d, [0x12, 0x34])
Run Code Online (Sandbox Code Playgroud)
我能看到的最接近的位置是曲柄长度或链条重量,但是在这个阶段,我只是猜测,正在寻找一些指导。
问题是这个。
我应该使用什么特征或描述符来调整Virtual Power训练器的电阻,什么是最好的方法?
任何编码语言都可以,我可以将其转置。
设备可用服务的屏幕截图 …
直到今天我还没有看到这个 dart 代码建议。我很高兴遵循最佳实践,但说实话,这在没有构造函数的有状态小部件中出现是没有意义的。我认为这可能与 @immutable 注释有关,但似乎并非如此,而且 dart 文档也没有真正的帮助。
Dart 文档 https://dart-lang.github.io/linter/lints/prefer_const_constructors.html
VSCode 中的代码建议
Prefer const literals as parameters of constructors on @immutable classes.dart. || Prefer const with constant constructors
Run Code Online (Sandbox Code Playgroud)
问题:这是我需要关心的事情还是我的 VSCode 插件出了问题?
代码示例,其中显示所有小部件。
Column(
children: [
Container(
margin: EdgeInsets.only(left: 20, right: 20),
height: 50,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(30),
),
color: Colors.black,
),
child: Center(
child: Text(
'Create Account',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 19),
),
),
),
SizedBox(
height: 20,
)
Run Code Online (Sandbox Code Playgroud)
完整性筛选
我在集成过程中在Spring Security之外有一个自定义身份验证实现。
我正在基于现有用户模型在身份验证过程中生成一个Spring用户。
除了getAuthority函数外,其他所有东西似乎都工作正常。
我在实现UserDetails的User模型中具有以下内容。
@Override
public Set<GrantedAuthority> getAuthorities() {
Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();
authorities.add(new SimpleGrantedAuthority(this.role));
return authorities;
}
Run Code Online (Sandbox Code Playgroud)
但是,我得到以下答复。
“ message”:“需要授权的文本表示形式”,
我相信我在数据库中缺少正确的ROLES的生成。当前private String role是“ USER”。
我想我的问题是这个。
我的角色字段的正确格式是什么,以使其正常工作?插入此角色的最佳方法是什么?
我正在使用dart / flutter和,'package:latlong/latlong.dart'将GPX文件解析为LatLng对象列表。一切正常,但下一步是找到路线的总距离。
这里的问题是
如何从Dart中的LatLng对象列表中获得总距离?
我以前在Java中使用过Haversine公式,但不确定使用Dart实现它的最佳方法。任何建议的帮助将不胜感激。
编辑
下面是根据下面的答案来获取总距离的尝试。由于某种原因,它不会加totalDistance和不会返回双精度。
下面假设要遍历60个以上的LatLng对象的列表,并找到每个对象之间的距离,并添加一个totalDistance的double值,该double值在循环结束时返回。
static double getDistanceFromGPSPointsInRoute(List<LatLng> gpsList) {
double totalDistance = 0.0;
for (var i = 0; i < gpsList.length; i++) {
var p = 0.017453292519943295;
var c = cos;
var a = 0.5 -
c((gpsList[i + 1].latitude - gpsList[i].latitude) * p) / 2 +
c(gpsList[i].latitude * p) *
c(gpsList[i + 1].latitude * p) *
(1 - c((gpsList[i + 1].longitude - gpsList[i].longitude) * p)) /
2;
double distance = 12742 …Run Code Online (Sandbox Code Playgroud) 我在一台服务器上有一个旧的Subversion,在另一台服务器上有另一个新的Subversion.
我想从旧存储库导出头版本并将其导入新版本.
我尝试了下面似乎导出,但我无法导入到新的导入.
svn export --depth immediates file:///repositories/repo1/ /home/me/repo-export
Run Code Online (Sandbox Code Playgroud)
这就是我想要导入的内容:
svn import /home/me/repo-export/ /svnroot/
Run Code Online (Sandbox Code Playgroud)
如何通过Linux(Red Hat Linux 4)命令行完成?
我试图在列表的 forEach 循环之间暂停。
我原以为超时会导致循环暂停,但它似乎同时启动了 3 个计时器。(非常快的连续。)
startTimeout(int seconds) async {
print('Timer Being called now');
var duration = Duration(seconds: seconds);
Timer(duration, doSomething());
}
startDelayedWordPrint() {
List<String> testList = ['sfs','sdfsdf', 'sfdsf'];
testList.forEach((value) async {
await startTimeout(30000);
print('Writing another word $value');
});
}
Run Code Online (Sandbox Code Playgroud)
知道我怎么做吗?
for child in platformGroupNode.children {
CGPoint p = [child.superview convertPoint:child.center toNode:self.view ]
println(p)
}
Run Code Online (Sandbox Code Playgroud)
但是我不确定如何与SKSpriteNode孩子和SKNode父母一起使用。
我也没有运气尝试过
for child in platformGroupNode.children {
var pos = child.position
var viewPos = convertPoint(pos, toNode: self.parent!)
if viewPos.x < 0 {
println("Out of screen")
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使Phaser JS项目上的所有声音静音,但是使用下面的方法无效。
game.sound.mute
Run Code Online (Sandbox Code Playgroud)
将Phaser.js项目中的所有声音静音的最佳方法是什么?