我需要依赖项,因为我想将这些添加到我的 RPM 元数据中。
要构建我使用:
python setup.py bdist_rpm
Run Code Online (Sandbox Code Playgroud)
当我构建包时,cryptography-2.2.2它会创建一个文件/src/cryptography.egg-info/requires.txt
它包含了:
idna>=2.1
asn1crypto>=0.21.0
six>=1.4.1
[:platform_python_implementation != 'PyPy']
cffi>=1.7
[:python_version < '3']
enum34
ipaddress
Run Code Online (Sandbox Code Playgroud)
如何读取所有依赖项,评估 之间的表达式[]?
我正在使用 Python 2.7(不要问)
我需要以下输出:
idna>=2.1
asn1crypto>=0.21.0
six>=1.4.1
cffi>=1.7
enum34
ipaddress
Run Code Online (Sandbox Code Playgroud)
我想省略其他部分,如[doc],[test]等等。
我可以手动连接:
Mx sql-postgres
并键入用户,数据库,主机,服务器
我想做点什么:
(connect-foo(用户"我")(数据库"bar")(主机"地球"))
目前解决方案:
我从sql.el中获取了一些代码并对其进行了更改,以便我可以非交互式地使用它.
(defun sql-create-buffer (profile)
"derived from sql-product-interactive in sql.el which is"
"covered by GNU General Public License version 3."
(setq sql-user (cdr (assoc 'user profile))
sql-password (cdr (assoc 'password profile))
sql-server (cdr (assoc 'server profile))
sql-database (cdr (assoc 'database profile)))
(setq product 'postgres) ;;(cdr (assoc 'product profile)))
(when (sql-product-feature :sqli-connect product)
(if (comint-check-proc "*SQL*")
(pop-to-buffer "*SQL*")
;; Connect to database.
(message "Login...")
(funcall (sql-product-feature :sqli-connect product))
;; Set SQLi mode.
(setq sql-interactive-product product) …Run Code Online (Sandbox Code Playgroud) 在C#中,我有一个声明为的属性:
public fixed byte foo[10]
Run Code Online (Sandbox Code Playgroud)
在客户端代码中,我看到它使用此函数转换为字符串:
public static unsafe string GetString(byte* byteArray)
{
return new String((sbyte*)byteArray);
}
Run Code Online (Sandbox Code Playgroud)
在IronPython打印中,它给了我一个字符串类型:
>>> print obj.foo
Baz+<foo>e__FixedBuffer1
Run Code Online (Sandbox Code Playgroud)
尝试使用转换函数会出错.
>>> print GetString(obj.foo)
expected Byte*, got <Foo>e__FixedBuffer1
Run Code Online (Sandbox Code Playgroud)
在IronPython中读取此属性的正确方法是什么?
我刚刚使用macports安装了boost 1.42.0 sudo port install boost.
一切都很好.现在我有一个项目,我正在尝试使用makefile构建.一切都很好,直到它需要boost库的文件.
它说:
src/graph.h:20:42:错误:boost/graph/adjacency_list.hpp:没有这样的文件或目录
该文件实际上位于两个地方:
/opt/local/include/boost/graph/adjacency_list.hpp
和
/opt/local/var/macports/software/boost/1.42.0_0/opt/local/include/boost/graph /adjacency_list.hpp
在src/graph.h文件中,它正在寻找boost/graph/adjacency_list.hpp,include语句在这里:
#include<boost/graph/adjacency_list.hpp>
我该如何工作?
有人也可以告诉我,我试图做的行动是否正确.我是c ++的新手,我认为它是正确的,但我有疑问
#include<iostream>
#include<fstream>
#include<cstdlib>
#include<iomanip>
using namespace std;
int main()
{
ifstream in_stream; // reads itemlist.txt
ofstream out_stream1; // writes in items.txt
ifstream in_stream2; // reads pricelist.txt
ofstream out_stream3;// writes in plist.txt
ifstream in_stream4;// read recipt.txt
ofstream out_stream5;// write display.txt
float price=' ',curr_total=0.0;
int wrong=0;
int itemnum=' ';
char next;
in_stream.open("ITEMLIST.txt", ios::in); // list of avaliable items
if( in_stream.fail() )// check to see if itemlist.txt is open
{
wrong++;
cout << " the error occured here0, you have " …Run Code Online (Sandbox Code Playgroud) 我希望能够构建A或B而不必考虑构造函数参数的数量.
第二个构造函数不是合法的C++,但我这样写它是为了表达我想要的东西.
是否有一个enable_if技巧来有选择地启用其中一个构造函数?
(例如,取决于A和B的构造函数参数的数量.)
我需要这个来测试大约15个带有1,2或3个构造函数参数的类.
struct A
{
A(int x)
{
}
};
struct B
{
B(int x, int y)
{
}
};
template<typename T>
struct Adaptor // second constructor is illegal C++.
{
T t;
Adaptor(int x, int y)
: t(x)
{
}
Adaptor(int x, int y) // error: cannot be overloaded
: t(x, y)
{
}
};
int main()
{
Adaptor<A> a(1,2);
Adaptor<B> b(1,2);
return 0;
}
Run Code Online (Sandbox Code Playgroud) 请考虑以下示例:
#include <iostream>
#include <clocale>
#include <cstdlib>
#include <string>
int main()
{
std::setlocale(LC_ALL, "en_US.utf8");
std::string s = "03A0";
wchar_t wstr = std::strtoul(s.c_str(), nullptr, 16);
std::wcout << wstr;
}
Run Code Online (Sandbox Code Playgroud)
这?在Coliru输出.
题
std::strtoul,是来自<cstdlib>.使用它我完全没问题,但我想知道上面的例子是否只能使用C++标准库(也许是字符串流)?
另请注意,0x字符串上没有prefex 表示十六进制.