我使用Atmel Studio在C语言编程(对于那些不熟悉它的人来说,它用于编程到arduino等微控制器.你不能简单地打印,你必须将数据串行发送到终端等应用程序.)
我到目前为止:
uint8_t * stackHolder;
char buffer[128];
stackHolder = &buffer[127];
Run Code Online (Sandbox Code Playgroud)
让我们说地址buffer[127]恰好是0x207.我可以看到的值stackHolder是0x207使用调试器.我有一个功能,需要char *和打印.所以我的问题是如何将其转换uint8_t * stackHolder成一个char *所以我可以将它传递给我的打印功能?
我已经查看了其他问题和bootstrap文档,似乎无法找出这些类对元素的作用.任何帮助表示赞赏!我只是想让我的搜索栏在大视口上的大小为1/4,在中型视口上大小为1/3,在小视口上大小为100%!
我正在尝试使用 socketio 在 Nestjs 中创建一个简单的房间,但无法掌握房间的概念。我想要的是客户端将 id 发送到通用端点,然后服务器将该套接字加入到特定房间,然后开始从其他地方向该房间发送消息。我目前遇到的是客户加入一个名为“会议”的活动,然后收到一个假会议,但我不知道如何让多个客户加入同一个房间并同时收到相同的信息。
客户端(html)
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.1/socket.io.js"></script>
<script>
const url = 'http://localhost:4001';
const socket = io(url);
socket.on('connect', function() {
console.log('Connected');
socket.emit('meeting', { roomId: '12345' });
});
socket.on('meeting', function(data) {
console.log('you have joined the meeting: ', data);
});
socket.on('exception', function(data) {
console.log('event', data);
});
socket.on('disconnect', function() {
console.log('Disconnected');
});
</script>
Run Code Online (Sandbox Code Playgroud)
服务器(NestJS):
@WebSocketGateway(4001)
export class PackGateway implements OnGatewayConnection {
constructor(private otherService: OtherService) {}
@WebSocketServer()
server: Server;
handleConnection() {
console.log('new connection!');
}
@SubscribeMessage('meeting')
joinUserToMeeting(@MessageBody() data: any, @ConnectedSocket() client: Socket): Observable<WsResponse<any>> …Run Code Online (Sandbox Code Playgroud) 我从我的客户那里收到一个这样的格式的字符串
yyyy-MM-dd'T'HH:mm:ss.SSSXXX:
2021-02-04T15:31:22.265-05:00
2021-02-04T15:31:22.265+00:00
2021-02-04T15:31:22.265-06:00
Run Code Online (Sandbox Code Playgroud)
我需要将它们转换为新格式:
MMMM dd, yyyy - HH:mm a z (where z is the three character abbreviation for the timezone. Ex. EST)
February 02, 2021 - 15:31 PM EST
February 02, 2021 - 15:31 PM UTC
February 02, 2021 - 15:31 PM CST
Run Code Online (Sandbox Code Playgroud)
通常我会做这样的事情:
SimpleDateFormat inDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
SimpleDateFormat outDateFormat = new SimpleDateFormat("MMMM dd, yyyy - HH:mm a z")
Date date = inDateFormat.parse("2021-02-04T15:31:22.265-05:00");
String convertedTime = outDateFormat.format(date) // February 02, 2021 - 15:31 PM EST
Run Code Online (Sandbox Code Playgroud)
但后来我意识到它只是在打印 …
我知道 NotificationCenter 已更改,并且我已查找如何使用此链接将其更改为新的实现: Swift 3 上的 NotificationCenter 问题,但我仍然无法让我的工作!我正在使用课堂教科书做我班上的作业,这是我目前的班级:
//
// ViewController.swift
// Persistence
//
// Created by Skyleguy on 10/31/16.
// Copyright © 2016 Skyleguy. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet var lineFields: [UITextField]!
override func viewDidLoad() {
super.viewDidLoad()
let filePath = self.dataFilePath()
if (FileManager.default.fileExists(atPath: filePath))
{
let array = NSArray(contentsOfFile: filePath) as! [String]
for i in 0 ..< array.count
{
lineFields[i].text = array[i]
}
}
let notificationName = Notification.Name("applicationWillResignActive")
NotificationCenter.default.addObserver(self, selector: #selector(Persistence.applicationWillResignActive(notification: NSNotification)), …Run Code Online (Sandbox Code Playgroud)