我想使用页面链接生成网页的预览缩略图.我怎样才能做到这一点?我对C#.NET,Javascript/JQuery很满意.
关心NLV
我有
public enum Als
{
[StringValue("Beantwoord")] Beantwoord = 0,
[StringValue("Niet beantwoord")] NietBeantwoord = 1,
[StringValue("Geselecteerd")] Geselecteerd = 2,
[StringValue("Niet geselecteerd")] NietGeselecteerd = 3,
}
Run Code Online (Sandbox Code Playgroud)
同
public class StringValueAttribute : Attribute
{
private string _value;
public StringValueAttribute(string value)
{
_value = value;
}
public string Value
{
get { return _value; }
}
}
Run Code Online (Sandbox Code Playgroud)
我想将我从组合框中选择的项的值放入int:
int i = (int)(Als)Enum.Parse(typeof(Als), (string)cboAls.SelectedValue); //<- WRONG
Run Code Online (Sandbox Code Playgroud)
这是可能的,如果是的话,怎么样?(StringValue匹配从组合框中选择的值).
我想绑定<< stream运算符:
for_each(begin, end, boost::bind(&operator<<, stream, _1));
Run Code Online (Sandbox Code Playgroud)
不幸的是它不起作用:
Error 1 error C2780: 'boost::_bi::bind_t<_bi::dm_result<MT::* ,A1>::type,boost::_mfi::dm<M,T>,_bi::list_av_1<A1>::type> boost::bind(M T::* ,A1)' : expects 2 arguments - 3 provided c:\source\repository\repository\positions.cpp 90
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么 ?
我正在使用webBrowser控件在winforms中打开PDF文档,它工作正常但是在关闭应用程序时我偶尔会遇到错误:"0x2d864aa2处的指令"引用"0x00000008"处的内存.内存无法"读取".有这个问题的解决方案吗?
问候.
我正在尝试以http:// servername/find/by/CRITERION/VALUE格式构建URL
CRITERION是一组有限的字符串,VALUE也是如此.麻烦的是,在某些情况下,VALUE需要是一个IP地址,这会导致我出现路由错误.
这是我的路线:
map.find 'find/by/:criterion/:query', :controller => "find", :action => "by"
Run Code Online (Sandbox Code Playgroud)
而来自Mongrel日志的错误:
Processing ApplicationController#index (for 127.0.0.1 at 2010-05-07 10:20:32) [GET]
ActionController::RoutingError (No route matches "/find/by/ip/1.2.3.4" with {:method=>:get}):
Rendering rescues/layout (not_found)
Run Code Online (Sandbox Code Playgroud)
如果我访问/ find/by/foo/bar或/ find/by/foo/1234我没有问题.我怀疑问题可能是Rails根据URL中的句点推断MIME类型,但我真的不知道如何禁用它.我已经尝试将:defaults => {:format =>:html}传递给路由,但这会导致Mongrel无法完全启动.
任何帮助赞赏!
这是我的代码。运行PHP代码后
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --enable-libamr-nb --enable-libamr-wb --enable-libdirac --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-x11grab
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 0 / 52.20. 0
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Nov 6 2009 19:05:03, …Run Code Online (Sandbox Code Playgroud) 我有一个rspec模拟对象,一个值被赋值为属性.我很难在我的rspec测试中满足这种期望.只是想知道sytax是什么?代码:
def create
@new_campaign = AdCampaign.new(params[:new_campaign])
@new_campaign.creationDate = "#{Time.now.year}/#{Time.now.mon}/#{Time.now.day}"
if @new_campaign.save
flash[:status] = "Success"
else
flash[:status] = "Failed"
end end
Run Code Online (Sandbox Code Playgroud)
考试
it "should able to create new campaign when form is submitted" do
campaign_model = mock_model(AdCampaign)
AdCampaign.should_receive(:new).with(params[:new_campaign]).and_return(campaign_model)
campaign_model.should_receive(:creationDate).with("#{Time.now.year}/#{Time.now.mon}/#{Time.now.day}")campaign_model.should_receive(:save).and_return(true)
post :create
flash[:status].should == 'Success'
response.should render_template('create') end
Run Code Online (Sandbox Code Playgroud)
问题是我收到此错误:
Spec::Mocks::MockExpectationError in 'CampaignController new campaigns should able to create new campaign when form is submitted' Mock "AdCampaign_1002" received unexpected message :creationDate= with ("2010/5/7")
Run Code Online (Sandbox Code Playgroud)
那么我如何设置对象属性赋值的期望?
谢谢
我正在为Android编写RSS阅读器.我遇到了一些难以解决的问题,因为数据库不是我的专业知识,所以我无法解决这个问题.所以我想你也许其中一个可以帮助我!我目前有3个表(类别,链接和提要).我的目标是将Feed添加到多个类别.因此我使用的是Link表.我的数据库是Android ContentProvider(sqlite),如下所示:
| Categories | | Links | | Feeds |
|------------| |---------| |-------|
| _ID | | Category| | _ID |
| Title | | Feed | | Title |
| URL |
Run Code Online (Sandbox Code Playgroud)
我目前在FeedListActivity中编写了以下代码,以检索链接及其提要列表.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//gets the intent URI to retrieve the Feeds.
Intent intent = getIntent();
if (intent.getData() == null) {
intent.setData(Feeds.CONTENT_URI);
}
// stores the Category id so it knows from what category it came from
mCatId = intent.getIntExtra("catId", -1);
getListView().setOnCreateContextMenuListener(this);
// …Run Code Online (Sandbox Code Playgroud) 我正在尝试选择<script type="text/html">页面中的所有标签.我使用<script>标签来存储HTML模板,类似于John Resig的工作方式.出于某种原因,以下jquery选择器似乎没有选择任何东西:
$("script[type*=html]").each(function() {
alert("Found script "+this.id);
});
Run Code Online (Sandbox Code Playgroud)
此标记位于HTML文档的BODY中:
<body>
<script id="filter-search" type="text/html">
<dt>Search</dt>
<dd><input type="text"/></dd>
</script>
</body>
Run Code Online (Sandbox Code Playgroud)
我也尝试将它放入HTML文档的HEAD中,但仍然没有找到它.没有显示警报.
如果我改为将代码更改为:
$("script[type*=javascript]").each(function() {
alert("Found script "+this.id);
});
Run Code Online (Sandbox Code Playgroud)
然后它只找到HEAD中具有src外部文件的脚本.找不到实际页面中的脚本.例如,在HEAD中有以下内容:
<head>
<script type="text/javascript" src="jquery.js" id="jquery"></script>
<script type="text/javascript" src="jquery-ui.js" id="ui"></script>
<script type="text/javascript" id="custom">
$(document).ready( function() {
$("script[type*=javascript]").each(function() {
alert("Found script "+this.id);
});
$("script[type*=html]").each(function() {
alert("Found TEMPLATE script "+this.id);
});
});
</script>
<script id="filter-test" type="text/html">
<dt>Test</dt>
</script>
</head>
<body>
<script id="filter-search" type="text/html">
<dt>Search</dt>
<dd><input type="text"/></dd>
</script> …Run Code Online (Sandbox Code Playgroud)