我正在开发一个 react-redux 应用程序,一旦用户登录,我就会在本地存储中存储有关用户的一些信息。这样我就可以在用户执行操作时轻松检索用户信息。
如果用户关闭浏览器窗口,我想清除反应应用程序的所有本地存储。我怎样才能做到这一点?
我正在使用c中的xinu嵌入式操作系统.我创建了一个新的头文件并声明了一个结构:
struct callout {
uint32 time; /* Time of delay in ms */
void *funcaddr; /* Function pointer */
void *argp; /* Function arguments */
uint32 cid; /* Callout id for the specific callout */
char *sample;
Run Code Online (Sandbox Code Playgroud)
};
在我的主要部分中,我尝试声明一个struct对象并将funcaddr用于函数.
void test();
process main(void) {
struct callout *coptr;
coptr->sample ="hellowolrd";
coptr->funcaddr = &test;
(coptr->funcaddr)(coptr->argp); //error here
kprintf("coptr %s \n", coptr->sample);
return OK;
}
void test() {
kprintf("this is the test function \n");
}
Run Code Online (Sandbox Code Playgroud)
我尝试通过结构调用函数指针,但我收到一个错误:main.c:30:19:错误:被调用的对象不是函数或函数指针(coptr-> funcaddr)();
请说明调用函数指针的正确语法是什么.
我正在使用java并使用Zephyr的api进行休息调用.我不认为使用的api会影响我的问题的可能性.我只是想知道是否有可能使用多线程同时多次进行相同的休息调用?每个调用都将检索不同的数据,它们并不都是抓取相同的数据.
这仅仅是为了检索数据,而不是写入.
如果可能,有什么风险?这是推荐的吗?
我正在尝试使用球衣客户端拨打休息电话。根据 api 文档,请求以二进制数据形式返回图像。当我使用邮递员进行其余的 Get 调用时,我可以返回实际图像(假设邮递员将二进制文件转换回图像/png)。这是从邮递员返回的以下标头。
我尝试在java中使用jersey客户端来完成其余的工作。这是我的代码:
private Client client = ClientBuilder.newClient( new ClientConfig().register(LoggingFilter.class).register(MultiPartFeature.class));
private WebTarget myServer;
myServer= client.target(baseURL);
public void restGetImage(String requestURL, String headers) {
BufferedReader br = null;
StringBuilder sb = new StringBuilder();
String line;
MultivaluedMap<String, Object> userHeaders = storeHeadersInMap(headers);
WebTarget target = getWebTarget().path(requestURL);
Response response = target.request(MediaType.APPLICATION_OCTET_STREAM)
.headers(userHeaders)
.get();
System.out.println("Reuqest URL: " + session.get("baseurl") + requestURL);
int responseCode = response.getStatus();
InputStream inputStream = response.readEntity(InputStream.class);
String contentType = response.getHeaderString("Content-Type");
// br = new BufferedReader(new InputStreamReader(inputStream));
//
// try { …Run Code Online (Sandbox Code Playgroud)