我需要实现一个具有特殊功能的集合。另外,我想将此集合绑定到 ListView,因此我最终得到了下一个代码(我在论坛中省略了一些使其更短的方法):
public class myCollection<T> : INotifyCollectionChanged
{
private Collection<T> collection = new Collection<T>();
public event NotifyCollectionChangedEventHandler CollectionChanged;
public void Add(T item)
{
collection.Insert(collection.Count, item);
OnCollectionChange(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item));
}
protected virtual void OnCollectionChange(NotifyCollectionChangedEventArgs e)
{
if (CollectionChanged != null)
CollectionChanged(this, e);
}
}
Run Code Online (Sandbox Code Playgroud)
我想用一个简单的数据类来测试它:
public class Person
{
public string GivenName { get; set; }
public string SurName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
所以我创建了 myCollection 类的实例,如下所示:
myCollection<Person> _PersonCollection = new myCollection<Person>();
public myCollection<Person> PersonCollection
{ get { return _PersonCollection; } …Run Code Online (Sandbox Code Playgroud) data-binding wpf observablecollection inotifycollectionchanged
我有:
struct DoubleVec {
std::vector<double> data;
};
DoubleVec operator+(const DoubleVec& lhs, const DoubleVec& rhs) {
DoubleVec ans(lhs.size());
for(int i = 0; i < lhs.size(); ++i) {
ans[i] = lhs[i]] + rhs[i]; // assume lhs.size() == rhs.size()
}
return ans;
}
DoubleVec someFunc(DoubleVec a, DoubleVec b, DoubleVec c, DoubleVec d) {
DoubleVec ans = a + b + c + d;
}
Run Code Online (Sandbox Code Playgroud)
现在,在上面,"a + b + c + d"将导致3个临时DoubleVec的创建 - 是否有一种方法可以通过某种类型的模板魔术来优化它...即将其优化为某种东西相当于:
DoubleVec ans(a.size());
for(int i = 0; i < ans.size(); i++) …Run Code Online (Sandbox Code Playgroud) 我试图在此线程的帮助下将添加SDK平台1.6添加到现有的2.2版安装中.
按照建议,我跑了Help→ Check for Updates发现并安装了以下内容:
+ Android DDMS 8.0.1.v201012062107-82219
+ Android Development Tools 8.0.1.v201012062107-82219
Run Code Online (Sandbox Code Playgroud)
它提示重新启动Eclipse,当它重新启动时,它给了我以下错误消息:
"SDK Platform Tools component is missing!
Please use the SDK Manager to install it."
Run Code Online (Sandbox Code Playgroud)
咦?为什么?我仍然在C:\ android-sdk-windows上安装了SDK平台工具,在我进行"升级"之前,它工作得很好.
在我的开发环境中,我需要支持2.2和1.6吗?
这是我使用的代码:
class Server
{
.....
void Server::accepted()
{
std::cout << "Accepted!" << std::endl;
boost::array<char, 1> buf;
boost::asio::async_read(socket, boost::asio::buffer(buf),
boost::bind(&Server::handleRead, this, buf, boost::asio::placeholders::error));
}
void Server::handleRead(boost::array<char, 1> buf, const boost::system::error_code& error)
{
if(!error)
{
std::cout << "Message: " << buf.data() << std::endl;
}
else
{
std::cout << "Error occurred." << std::endl;
}
}
.....
}
Run Code Online (Sandbox Code Playgroud)
问题是我总是从客户端获取相同的数据:特定的char.在我的客户端,我尝试发送其他字符,但仍然服务器显示相同的字符.
当我尝试读取超过1个字节时,我得到一个错误,该buf变量在初始化之前使用.
虽然我问过,但Visual Studio 2010似乎没有为我的F#模块生成代码覆盖率统计信息.单元测试是用C#编写的Ms Tests,因此由Visual Studio本机运行,并且干净地执行.但似乎没有为正在测试的F#库创建任何覆盖信息.涉及的C#库分析得很好.
我错过了什么吗?
我有一个字典作为列表有价值.
dictionary = {
'C1' : [10,20,30]
'C2' : [20,30,40]
}
Run Code Online (Sandbox Code Playgroud)
假设我想将C1列表中的所有值递增10,我该怎么做?
dictionary.get('C1') 给我列表,但我如何更新它?
我有一个我想要下载的.php文件,它会显示一个4位数字.无论如何在没有wget回显到外部文件的情况下检索此输出,然后读取外部文件并删除外部文件.
就像是..
OUTPUT=`wget www.google.com`
print $OUTPUT
Run Code Online (Sandbox Code Playgroud)
它会获得google.com的文本
当我在Eclipse中编写.xml文件时,我经常需要手动缩进代码.例如
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_height="fill_parent"
android:layout_width="fill_parent" />
Run Code Online (Sandbox Code Playgroud)
格式化后,它看起来像这样.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_height="fill_parent"
android:layout_width="fill_parent" />
Run Code Online (Sandbox Code Playgroud)
如何自动化?我在Eclipse for XML中找不到格式设置.
任何人都知道如何抑制/忽略select语句中的错误?
我的select语句使用STLineFromText函数,当它遇到无效行时,会引发错误.我可以忽略坏行,并且无法真正改变我的源数据.
这是一个演示我的问题的示例查询:
SELECT geography::STLineFromText('LINESTRING(-74.2204037952351 40.4283173372472,-74.2204851952350 40.4283519372471)', 4326) UNION ALL
SELECT geography::STLineFromText('LINESTRING(-74.2316367952177 40.4386102038979,-74.2313671952181 40.4388540705641)', 4326) UNION ALL
SELECT geography::STLineFromText('LINESTRING(-74.2229282618978 40.4252709372519,-74.2229171285645 40.4252638039186,-74.2229282618978 40.4252709372519,-74.2227441952315 40.4251499372521,-74.2231121285642 40.4243291372534)', 4326) UNION ALL
SELECT geography::STLineFromText('LINESTRING(-74.2418989952017 40.4417621372263,-74.2417773285352 40.4417915372263)', 4326) UNION ALL
SELECT geography::STLineFromText('LINESTRING(-74.2166069952410 40.4334496039059,-74.2158269952422 40.4336396039056)', 4326)
Run Code Online (Sandbox Code Playgroud)
这是错误:
Msg 6522, Level 16, State 1, Line 2
A .NET Framework error occurred during execution of user-defined routine or aggregate "geography":
System.ArgumentException: 24200: The specified input does not represent a valid geography instance.
System.ArgumentException:
at Microsoft.SqlServer.Types.SqlGeography.ConstructGeographyFromUserInput(GeoData g, Int32 srid)
at …Run Code Online (Sandbox Code Playgroud) 我一直受到动态,未来主义的用户界面的启发.我能描述的最好的是图形界面,例如最新的钢铁侠电影.
虽然我不会建立一个完整的应用程序,但我想制作一些我计划进行交互式动画的小动画.也许有一天他们可以把它们放在一起以制造更大的东西 不可否认,我将来会用于音频操作,但无论如何,这不是重点,因为它是我不确定的动画/图形.
我知道可以在Adobe After Effects中制作这些动画.我只是很难想到要继续进行的过程(艺术和可编程性).
在我自己研究这个问题的同时,我已经获得了OGRE 3D和Blender的基本经验.我已经在OGRE上导入和编译了网格,已经能够做基本的事情,比如围绕它移动网格.
我开始认为我可能正在以错误的方式接近这个并且有更好的工具,或者如果3D足以满足这些类型的动画,并且可能提供更流畅的体验.
我无法理解这个过程,我想知道两件事:
1.)我理解的主要问题是如何让静态图形制作动画?网格是否保持Blender等程序的时间线,然后像OGRE这样的图形引擎读取时间轴并播放它们?
最重要的是:
2.)我甚至需要图形(网格)吗?大多数界面都是薄边框,文字和透明LED样颜色的形状,可以动态移动以产生未来效果.
请分享您的意见,建议和您认为可以帮助我完成的任何事情来开发那些性感的眼睛糖果!谢谢.
c++ ×3
eclipse ×2
.net ×1
2d ×1
3d ×1
adt ×1
android ×1
bash ×1
boost ×1
boost-asio ×1
data-binding ×1
dictionary ×1
f# ×1
formatting ×1
graphics ×1
list ×1
python ×1
sdk ×1
sql ×1
sql-server ×1
t-sql ×1
wget ×1
wpf ×1
xml ×1