我安装了Python 3.3.2(x86和x64版本),并在它们之上安装了PyQt5.1.
最近我安装了PyCharm 3.0 Community Edition并配置为使用这些Python解释器.问题是PyQt5没有显示在已安装的软件包列表中,文档也不起作用(Ctrl+Space自动完成和Ctrl+Q文档).
当PyCharm正在查询骨架生成时,它似乎处理PyQt但没有用.当我尝试使用PyCharm中的包系统安装PyQt时,我收到以下错误:
C:\Program Files (x86)\PyCharm3.0\helpers\packaging_tool.py run on 10/06/13 13:58:52
Downloading/unpacking PyQt5
Getting page https://pypi.python.org/simple/PyQt5/
URLs to search for versions for PyQt5: https://pypi.python.org/simple/PyQt5/
Analyzing links from page https://pypi.python.org/simple/PyQt5/
Could not find any downloads that satisfy the requirement PyQt5
No distributions at all found for PyQt5
Exception information:
Traceback (most recent call last):
File "C:\Python\332_x64\lib\site-packages\pip-1.4.1-py3.3.egg\pip\basecommand.py", line 134, in main
status = self.run(options, args)
File "C:\Python\332_x64\lib\site-packages\pip-1.4.1-py3.3.egg\pip\commands\install.py", line 236, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File …Run Code Online (Sandbox Code Playgroud) 假设以下代码:
#include <iostream>
using namespace std;
char one()
{
cout << "one\n";
return '1';
}
char two()
{
cout << "two\n";
return '2';
}
int main(int,char**)
{
// 1:
cout << one()
<< '\n'
<< two()
<< '\n';
// 2:
operator<<(
operator<<(
operator<<(
operator<<(
cout,
one()),
'\n'),
two()),
'\n');
}
Run Code Online (Sandbox Code Playgroud)
执行标记为1和的行,并2使用ideone编译时执行相同的操作,它打印如下:
two
one
1
2
Run Code Online (Sandbox Code Playgroud)
从我的观点来看,我们在这里观察到的是未指定的行为,因为未指定解析函数参数的顺序.
这是一个在采访中的问题,打印上面给出的序列(没有任何替代方案)应该是正确答案,但它是否真的正确?
我读过" 了解你一个Haskell",Haskell中的列表理解可以改写为monadic join或(实际上是相同的)do-notation.
但是,当我尝试重写以下代码时(生成所有可能的列表,其中包含给定列表中的每个元素):
c :: [[a]] -> [[a]]
c [] = [[]]
c (x:xs) = [a:b | a <- x, b <- c xs]
Run Code Online (Sandbox Code Playgroud)
以这种方式:
d :: [[a]] -> [[a]]
d [] = [[]]
d (x:xs) = do
a <- x
b <- d xs
return a:b
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Couldn't match type `a' with [a]
`a' is a rigid type variable bound by
the type signature for d :: [[a]] -> [[a]]
Expected type: [[a]]
Actual type: …Run Code Online (Sandbox Code Playgroud) 我在视图和模型之间有一个QTableViewwith QSortFilterProxyModel( QStandardItemModel)。问题是当我调用 sort() 时,我无法恢复表中行的原始顺序。我试图通过将模型代理更改QIdentityProxy为即时但无济于事来实现这一点,因为唯一的变化是行重新编号但顺序保持排序。
是否有可能以某种方式“取消排序”数据?我认为,在这种情况下,该代码是不必要的,但会在询问时发布。
我在 Win x64 上使用 Qt5
PS:同样的问题于 2009年在这里发布,但从未得到回答。
比方说,我在代码的catch部分有一个宏
#define CATCH( doSomething ) \
catch (MyException& e) \
{ \
try \
{ \
doSomething; \
} \
} \
catch (MyException* e) \
{ \
try \
{ \
doSomething; \
} \
}
Run Code Online (Sandbox Code Playgroud)
在doSomething部分我需要获取异常的内容,有没有办法做到这一点?一些函数isPointer可以像这样使用:
try
{
THROW(new MyException());
}
CATCH( \
if( isPointer(e) ) \
{ \
std::cout << (*e).toString(); \
} \
else \
{ \
std::cout << e.toString(); \
} \
)
Run Code Online (Sandbox Code Playgroud) 假设我有以下代码:
#include <iostream>
#include <deque>
#include <memory>
struct Test
{
int test;
};
int main(int, char**)
{
std::deque<std::unique_ptr<Test>> deque;
deque.push_back(std::unique_ptr<Test>(new Test{10}));
auto start = deque.begin();
std::cout << start->test << std::endl; // <- compilation error
std::cout << (start.operator->())->operator->()->test << std::endl; // <- OK
}
Run Code Online (Sandbox Code Playgroud)
为什么将智能指针视为常规指针对象,尽管并非如此(据我所知)?据我所知,operator->()应该重复出现直到到达T*。
这里有一些相关的问题,对如何箭头超载工作和我们需要,而不是取消引用箭头的两倍。
假设我有一个包含两个字段的对象:
data Example = Example { _position :: Int
, _storage :: [Int]}
Run Code Online (Sandbox Code Playgroud)
如何构建聚焦于position内部元素的镜头storage?
另外,是否可以将position通过镜头修改的值限制在基于尺寸的范围内storage?
似乎可以以某种方式使用旁边Example,因为它与元组同构,但我无法理解这样做的方法。
我不知道如何表达这个问题,所以我无法找到很多相关信息。
我在Boost 1.51+中遇到了fast_pool_allocator的问题,这个问题在1.45时没有出现.经过一些研究,我能够找出原因,但现在我想知道是否有可能找到一些完整的Boost变更列表,甚至是涉及特定类的变更列表?
c++ ×4
haskell ×2
boost ×1
c++11 ×1
containers ×1
do-notation ×1
haskell-lens ×1
ide ×1
iterator ×1
macros ×1
pycharm ×1
pyqt ×1
pyqt5 ×1
python ×1
qt ×1