问题列表 - 第28339页

使用自定义TTPhotoView扩展TTPhotoViewController

我已经在我的项目中成功集成了three20框架,并且我已经扩展了TTPhotoViewController以添加一些其他功能.

现在我需要为TTPhotoViewController加载的TTPhotoView添加一些子视图.特别是我想在每个TTPhotoView加载后添加子视图.这些子视图表示图像上的合理区域,因此它们应与图像成比例缩放.用户可以点击子视图以获取有关图像的额外信息.

我不知道如何实现这种行为.我应该扩展TTPhotoView并确保TTPhotoViewController使用此扩展版本而不是其TTPhotoView吗?

有人能指出我正确的方向吗?谢谢

iphone three20 ttphotoviewcontroller

5
推荐指数
1
解决办法
2500
查看次数

在树的鸟在背景中

这些鸟如何在底部的树后面突然出现?

http://grabaperch.com/about

他们使用CSS与CSS或它是什么?

html javascript css php

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

Python + PostgreSQL +奇怪的ascii = UTF8编码错误

我有ascii字符串,其中包含"\x80"代表欧元符号的字符:

>>> print "\x80"
€
Run Code Online (Sandbox Code Playgroud)

将包含此字符的字符串数据插入数据库时​​,我得到:

psycopg2.DataError: invalid byte sequence for encoding "UTF8": 0x80
HINT:  This error can also happen if the byte sequence does not match the encodi
ng expected by the server, which is controlled by "client_encoding".
Run Code Online (Sandbox Code Playgroud)

我是一个unicode新手.如何将包含的字符串转换"\x80"为包含相同欧元符号的有效UTF-8?我已经打过电话.encode,并.decode在不同的字符串,但遇到错误:

>>> "\x80".encode("utf-8")
Traceback (most recent call last):
  File "<pyshell#14>", line 1, in <module>
    "\x80".encode("utf-8")
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)

python postgresql unicode encoding utf-8

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

我可以从表中选择一组行并直接将其插入到SQL中的表或同一个表中吗?

大家好我只是好奇我是否可以做类似的事情 -

insert into Employee ( Select * from Employee where EmployeeId=1)
Run Code Online (Sandbox Code Playgroud)

我觉得有必要这么做很多次......所以只是好奇有没有办法实现它...

sql sql-server insert sql-server-2008

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

boost :: asio :: io_service :: poll()带来的麻烦

以下代码:

/***************************************************************************/

boost::mutex m;

struct func {
   func(int v):n(v) {}
   void operator()() {
      {  boost::mutex::scoped_lock l(m);
         std::cout << "run function " << n << std::endl;
      }
      for ( int idx = 0; idx < 4; ++idx ) {
         {  boost::mutex::scoped_lock l(m);
            std::cout << "function " << n << ", ping " << idx << std::endl;
         }
         sleep(1);
      }
   }

private:
   int n;
};

/***************************************************************************/

int main(int argv, const char** argc) {
   boost::asio::io_service io;

   for ( int idx = 0; idx …
Run Code Online (Sandbox Code Playgroud)

c++ boost boost-asio

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

如何获得更多Feed项目?

如何获取Feed的下一页或更多结果?

例如,当我去到安全现在喂页,有任何与"页面= 100"的URL参数没有"下一个"链接什么也不做:

http://leoville.tv/podcasts/sn.xml

我只得到了大约20集的1页结果.但是,我的Google阅读器可以成功检索早于此的剧集.

rss feeds atom-feed

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

Excel COM Interop - tlbimp vs primary WrapperTool

我正在尝试将ActiveX Microsoft Excel 11.0对象库添加到我的.NET项目中.它在我的计算机上工作正常,但是当我检查我的代码时,它对我的​​同事不起作用.固定在他身上,它打破了我的.添加后,我们的计算机之间的命名空间不同.

事实证明,不同之处在于,当我添加它tlbimp作为WrapperTool 使用的引用时,但是对于他来说它使它成为primary引用.

我如何以同样的方式让它们同时适用于我们?他的机器不喜欢tlbimp进口互操作,而我的机器不喜欢primary互操作.

.net interop com-interop office-interop

5
推荐指数
1
解决办法
2628
查看次数

C++:从wstringstream获取LPCWSTR?

如果我有wstringstream,并且我想将其.str()数据作为LPCWSTR获取,我该怎么做?

c++ string unicode

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

使用迭代器将"哑"函数重构为通用STL样式

我已经设法绕过一些C++的功能(for_each,映射函数,使用迭代器......)但是用于接收泛型容器和迭代器的模板和函数参数列表的构造仍然无法实现.我有一个实际的例子,我希望有人可以为我说明:

使用以下函数处理传入的std :: vector并构建一个进程的许多数据点/迭代的运行总计:

/* the for-loop method - not very savvy */
void UpdateRunningTotal (int_vec& total, int_vec& data_point) {
  for (int i = 0; i < V_SIZE; i++) {
    total[i] += data_point[i];
  }
}

typedef int_vec std::vector<int>;
int_vec running_total (V_SIZE, 0);  // create a container to hold all the "data points" over many iterations
/* further initialization, and some elaborate loop to create data points */

UpdateRunningTotal (running_total, iteration_data);
/* further processing */
Run Code Online (Sandbox Code Playgroud)

上面的工作,但我宁愿有一个函数,它接受迭代器并执行此求和.更好的是,使用推导类型的通用参数列表而不是指定容器类型,即:

UpdateRunningTotal (iteration_data.begin(), iteration_data.end(), running_total.begin());
Run Code Online (Sandbox Code Playgroud)

我现在真的迷失了,需要一些指导来找到如何定义模板和参数列表以使函数通用.模板和函数定义是什么样的?我已经熟悉使用STL功能执行此特定任务的方法 …

c++ containers iterator stl generic-programming

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

INotifyPropertyChange~当属性是一个集合并且一个新项目被添加到集合时,PropertyChanged不会触发

我有一个实现INotifyPropertyChanged接口的类.该类的一些属性是List类型.例如:

public List<string> Answers
{
    get { return _answers;  }
    set
    {
      _answers = value;
      onPropertyChanged("Answers")
    }
}

...

private void onPropertyChanged(string propertyName)
{
    if(this.PropertyChanged != null)
        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
Run Code Online (Sandbox Code Playgroud)

如果我将一个新的List <string>分配给Answer,那么PropertyChanged事件将按预期触发; 但是如果我使用List Add方法将一个字符串字符串添加到Answer列表中,那么PropertyChanged事件就不会触发.

我正在考虑在我的类中添加一个AddAnswer()方法,该方法将处理调用列表的Add方法并从那里调用onPropertyChanged(),但这是正确的方法吗?有更优雅的方式吗?

干杯,KT

c# inotifypropertychanged

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