小编Abh*_*hek的帖子

将 SELECT 语句中的“前一行”值与现有行值相加

我想将先前的值与该行中的现有值相加。

这是我的代码:

SELECT
    co.partner_id,
    to_char(co.date, 'DD') AS day,
    to_char(co.date, 'MM') AS month,
    to_char(co.date, 'YYYY') AS year,
    sum(col.qty * p.price) AS priceday
FROM
    order_detail col
    JOIN
ORDER co ON co.id = col.order_id
JOIN product p ON p.id = col.product_id
GROUP BY
    co.partner_id,
    to_char(co.date, 'MM'),
    to_char(co.date, 'YYYY'),
    to_char(co.date, 'DD')
Run Code Online (Sandbox Code Playgroud)

该代码变成这样:图像表

桌子应该是这样的: 图片

谢谢。

postgresql select postgresql-9.3

9
推荐指数
2
解决办法
1万
查看次数

无法在react-native-web上运行webpack-dev-server.错误:您可能需要适当的加载程序来处理此文件类型

我正试图深入研究React生态系统,并在使用react-native-web我的React Native Application时遇到问题.我已经在https://github.com/thedarklord1/testNativeWithWeb上托管了该应用程序.我使用Redux Store和React Native来构建一个非常简单的POC来构建计算器.Android和iOS版本正在按预期执行.我面临的问题是,在尝试运行时webpack-dev-server,为了使用react-native-webWeb,它会因错误而失败

ERROR in ./src/App.js
Module parse failed: /Users/abhishekkumar/Desktop/Credifiable/front_end/testNativeWithWeb/src/App.js Unexpected token (9:6)
You may need an appropriate loader to handle this file type.
|   render() {

|     return (
|       <Provider store={store}>
|         <AppContainer/>
|       </Provider>
 @ ./index.web.js 1:0-28
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./index.web.js
Run Code Online (Sandbox Code Playgroud)

我是React和WebPack生态系统的新手,我们非常感谢任何帮助或指针.TIA.

编辑:我正在使用该命令webpack-dev-server -d --config web/webpack.config.js --inline --hot --colors来运行服务器.

babel reactjs webpack react-native react-native-web

7
推荐指数
1
解决办法
757
查看次数

文档的根元素不是<xsd:schema>

我的项目中有一个名为jvxml-implementation-0-7.xsd的文件.

该文件的内容是

<?xml version="1.0" encoding="UTF-8"?>
<xsi:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema"
 xmlns="http://www.jvoicexml.org/xsd/jvxml-implementation-0-7.xsd"
   xmlns:tns="http://www.example.org/jvxml-implementation"    
xmlns:beans="http://www.springframework.org/schema/beans"
  elementFormDefault="qualified">
  <xsi:import namespace="http://www.springframework.org/schema/beans"
    schemaLocation="spring-beans-2.0.xsd" />
  <xsi:element name="implementation">
    <xsi:annotation>
      <xsi:documentation>
    Implementation platform for JVoiceXML
  </xsi:documentation>
</xsi:annotation>
<xsi:complexType>
  <xsi:sequence minOccurs="0" maxOccurs="unbounded">
    <xsi:element name="repository" type="xsi:string"
      minOccurs="0" maxOccurs="1">
      <xsi:annotation>
        <xsi:documentation>
          The name of the loader repository.
        </xsi:documentation>
      </xsi:annotation>
    </xsi:element>
    <xsi:element name="classpath" type="xsi:string"
      minOccurs="0" maxOccurs="unbounded">
      <xsi:annotation>
        <xsi:documentation>
          Entry to be added to the CLASSPATH when
          loading this implementation platform^M
        </xsi:documentation>
      </xsi:annotation>
    </xsi:element>
    <xsi:element ref="beans:bean" minOccurs="1"
      maxOccurs="unbounded">
      <xsi:annotation>
        <xsi:documentation>Spring bean configuration
        </xsi:documentation>
      </xsi:annotation>
    </xsi:element>
  </xsi:sequence>
</xsi:complexType> …
Run Code Online (Sandbox Code Playgroud)

java spring ivr

6
推荐指数
1
解决办法
2万
查看次数

将time_t打印为long int而不进行强制转换会产生意外行为

我试图打印time_t而不在Microsoft Visual Studio Project中将其作为long int投射,它给了我意想不到的结果.源代码是

#include <time.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include <string.h>

int main()
{
    int a=1,b=2;
    long int c=3;
    time_t myTime;
    time(&myTime);
    printf("%d_%ld_%d_%ld",a,myTime,b,c);
    printf("\n");
    getchar();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

输出是1_1389610399_0_2.这在我的linux机器上运行正常.我知道time_t不应该像这样打印但是我不确定为什么?请告诉我如何调试这样的问题?

编辑:我期待输出被1_1389610399_2_3认为time_t是C中的算术.

c c++ datetime

6
推荐指数
2
解决办法
6148
查看次数

使用由 M2Crypto 生成的加密/pycrypto 进行私有加密(生成签名)

我正在尝试为有效负载生成签名。我的技术栈是 Python3.6,它提供了密码学或 pycrypto 之类的库。问题是,我无法private_encrypt在密码学等库中重新创建M2Crypto的功能。M2Crypto生成的签名被我的对端接受为有效签名,而两个库生成的签名被丢弃,表示签名无效。

我使用 python2.7 创建了一个最小的 POC 来说明我的情况。

import base64

payload = b'This is the payload for which I wish to generate signature'

### Using library cryptography ###
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import padding

with open("private_key", "rb") as key_file:
    private_key = serialization.load_pem_private_key(
        key_file.read(),
        password=None,
        backend=default_backend()
    )


signature = private_key.sign(
    payload,
    padding=padding.PKCS1v15(),
    algorithm=hashes.SHA1()
)
encoded_signature = base64.b16encode(signature)
print("Signature using cryptography - ", encoded_signature)


### Using library pycrypto ###
from Crypto.Signature import …
Run Code Online (Sandbox Code Playgroud)

python rsa m2crypto pycrypto python-cryptography

5
推荐指数
0
解决办法
380
查看次数

绝对位置工作,而在父级中没有相对位置

我想换我解决此头教程,其中.dropdown-content放置absolute,但包含无父relativeabsolute在那里。我遵循了许多教程,其中提到如果没有这样的父级,它将被附加到<body>标签上。为什么在这里需要这种绝对定位。

我也碰到了这个问题,它讨论了这样定位的父母的不必要。

编辑:

插入代码,因为链接可能会在一段时间后消失

<!DOCTYPE html>
<html>
<head>
<style>
ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
}

li {
    float: left;
}

li a, .dropbtn {
    display: inline-block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

li a:hover, .dropdown:hover .dropbtn {
    background-color: red;
}

li.dropdown {
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute; # What is the …
Run Code Online (Sandbox Code Playgroud)

css css-position

4
推荐指数
1
解决办法
2909
查看次数

使用char指针从字符串到整数的atoi

这是我编写的在c中拆分字符串的代码,然后我想返回char指针指向的第一个整数值。

#include<stdio.h>
void main(){
    int month[12]={0};
    char buf[]="1853 was the year";
        char *ptr;
        ptr = strtok(buf," ");
        printf("%s\n",ptr);
        int value = atoi(*ptr);
        printf("%s",value);
} 
Run Code Online (Sandbox Code Playgroud)

编辑:这给了我分割错误。

问题是它将1853年打印为年份,但我想将其转换为整数格式。如何使用指针将其作为整数检索?

c pointers

3
推荐指数
1
解决办法
1万
查看次数

给定代码有什么问题

我只是在C中学习一些指针,我碰巧知道使用*one可以取消引用指针.所以我编写了以下代码来检查它.

#include<stdio.h>
#include<string.h>

char *findChar(char *s, char c){
  while(*s!=c){
     s++;
  }
  return s;
}

int main(){
  char myChar='a';
  const char myString[]="Hello abhishek";
  char *location;
  location = findChar(myString,myChar);
  puts(location);
  char temp = *location;
  printf(temp);
}
Run Code Online (Sandbox Code Playgroud)

我假设temp应该得到字符指针位置指向的值,但是这个程序给了我一个分段错误.请清楚我做错了什么?

c pointers segmentation-fault

2
推荐指数
1
解决办法
105
查看次数