对于一个干净的数据模型,我来回这个......
以批准工作流程为例,假设在我的Web应用程序中,我有一个页面,允许用户标记MyEntityObject要批准.MyEntityObject有一些控制其审批工作流程的属性,因此我有一个通用的实用方法FlagForApproval(MyEntityObject eo).
该页面应该调用FlagForApproval()来仅设置必要的属性,然后在它准备好时调用SaveChanges(),还是应该FlagForApproval()保存更改?
使用实用程序方法保存更改似乎比它要求做的更多(如果它只是一系列操作中的一步?),但同时,使页面调用SaveChanges()并提交数据到数据库似乎可以认为它太接近数据层职责.
思考?
(更新:FWIW,到目前为止我一直在使用实用方法调用SaveChanges(),这样页面只有一组异常要处理,无论是验证还是数据.)
升级到Snow Leopard后,我发现安装一些宝石不再有效,包括webrat,mechanize等.每次我收到此错误:
checking for xmlParseDoc() in -lxml2... no
libxml2 is missing. try 'port install libxml2' or 'yum install libxml2'
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Run Code Online (Sandbox Code Playgroud)
不,我没有尝试用macports安装它,因为几年前,当我发现我无法轻易降级/管理端口时,我放弃了macports.从那时起,我已经变得非常舒适地手工制作源头,这是我第一次遇到超出我的想法.我愿意被说服回到macports,但只有在没有简单的解决方案的情况下我才会失踪.
似乎libxml2实际上并不存在,或许只是过时了?...
扩展输出
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for libxslt/xslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes …Run Code Online (Sandbox Code Playgroud) macos development-environment rubygems macports osx-snow-leopard
我收到了从spinner.getSelectedItem().toString()调用返回的文本'android.database.sqlite.SQLiteCursor@435b9ba0'.我不知道为什么.微调器绑定到SimpleCursorAdapter.
这是代码
cCategories = (Cursor) myAdapter.getAllCategories();
this.startManagingCursor(cCategories);
SimpleCursorAdapter scaCategories = new SimpleCursorAdapter(this, R.layout.track_category_item,cCategories,new String[] {DBAdapter.KEY_CATEGORIES_NAME},new int[]{R.id.text1});
scaCategories.setDropDownViewResource(R.layout.track_category_dropdown_item);
mCatSpinner = (Spinner) findViewById(R.id.thecategory);
mCatSpinner.setAdapter(scaCategories);
if(mCatSpinner.isSelected() != true) {
mCatSpinner.setSelection(0);
}
Run Code Online (Sandbox Code Playgroud)
和xml track_category_item.xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@android:id/text1"
style="?android:attr/spinnerItemStyle"
android:ellipsize="marquee"
android:singleLine="true">
</TextView>
Run Code Online (Sandbox Code Playgroud)
track_category_dropdown_item.xml
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:ellipsize="marquee" />
Run Code Online (Sandbox Code Playgroud)
spinner xml看起来像这样
<Spinner
android:id="@+id/thecategory"
android:prompt="@string/SELECT_CATEGORY"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_x="15px"
android:layout_y="133px" >
</Spinner>
Run Code Online (Sandbox Code Playgroud)
并且返回的光标是
public Cursor getAllCategories()
{
return db.query(DATABASE_CATEGORIES_TABLE, new String[] {
KEY_CATEGORIES_ROWID,
KEY_CATEGORIES_NAME,
KEY_CATEGORIES_DEFAULT},
null,
null,
null,
null,
null);
} …Run Code Online (Sandbox Code Playgroud) 该方法连续执行两次,没有明显的理由这样做.它发生在VS2010 Express(4.0)和VS2008(3.5)中.
public GUI()
{
InitializeComponent();
this.lvwFiles.DragDrop += new System.Windows.Forms.DragEventHandler(this.lvwFiles_DragDrop);
this.lvwFiles.DragEnter += new System.Windows.Forms.DragEventHandler(this.lvwFiles_DragEnter);
}
private void lvwFilesAdd(string path, string[] paths)
{ ... }
private void lvwFilesWrite()
{ ... }
private void lvwFiles_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}
private void lvwFiles_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
var paths = (string[])e.Data.GetData(DataFormats.FileDrop);
var path = Path.GetDirectoryName(paths[0]);
lvwFilesAdd(path, paths);
lvwFilesWrite();
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个带有各种命名空间的xml,我想使用它来查询.SelectNodes(string xPath)
我注意到的问题是,只要我拥有所有这些名称空间,xPath查询就不会返回任何内容.
无论如何告诉XmlDocument.SelectNodes忽略这些命名空间,只是给我正确的元素(我查询的元素似乎没有名称空间前缀)?
如果有,有谁可以请我提供一个如何做的例子?我在查询节点之前/当我应该定义什么?
谢谢您的帮助.
更正:我仍然无法确定问题所在.这是我的xml:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gf="http://schemas.google.com/finance/2007"
xmlns:gd="http://schemas.google.com/g/2005" >
<id>http://finance.google.com/finance/feeds/xyx@google.com/portfolios</id>
<updated>2009-12-15T19:32:21.000Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/finance/2007#portfolio" />
<title type="text" >Portfolio Feed</title>
<link rel="alternate" type="text/html" href="http://finance.google.com/finance/portfolio?action=view" />
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://finance.google.com/finance/feeds/default/portfolios" />
<link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="http://finance.google.com/finance/feeds/default/portfolios" />
<link rel="self" type="application/atom+xml" href="http://finance.google.com/finance/feeds/default/portfolios" />
<openSearch:totalResults>24</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>24</openSearch:itemsPerPage>
<entry>
<id>http://finance.google.com/finance/feeds/xyx@google.com/portfolios/2</id>
<updated>2009-12-14T16:26:53.000Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/finance/2007#portfolio" />
<title type="text" >Main</title>
<link rel="self" type="application/atom+xml" href="http://finance.google.com/finance/feeds/default/portfolios/2" />
<link rel="edit" type="application/atom+xml" href="http://finance.google.com/finance/feeds/default/portfolios/2" />
<gd:feedLink href="http://finance.google.com/finance/feeds/xyx@google.com/portfolios/2/positions" />
<gf:portfolioData currencyCode="USD" gainPercentage="0.0" return1w="0.0" return1y="0.0" return3m="0.0" return3y="0.0" return4w="0.0" return5y="0.0" returnOverall="0.0" returnYTD="0.0" …Run Code Online (Sandbox Code Playgroud) 我正在编写一个应用程序,它将在会员网站上显示文章.
我们希望应用能够阅读和显示设置为"仅限会员"的文章 - 即使应用所有者不是会员.
所以我希望能够在不向应用用户显示任何用户或密码信息的情况下登录.
当我尝试访问仅限成员的文章时,我会获得重定向,但我没有获得身份验证质询.
任何想法如何让我的应用程序自动登录?
这是形式的样子.我是否必须在POST请求中包含所有输入值?
<FORM ACTION="https://www.mysite.com/cgi-bin/mysite/process" METHOD=POST>
<input type="hidden" NAME="mv_todo" VALUE="return">
<input type="hidden" name="mv_session_id" value="DySUxWM5">
<INPUT TYPE="hidden" name="mv_success_variable_hash" VALUE="">
<INPUT TYPE="hidden" name="mv_success_variable_hash_colon" VALUE="">
<INPUT TYPE="hidden" NAME="mv_successpage" VALUE="index">
<input type="hidden" name="mv_failpage" value="login">
<input value="1942255628Hx0xE2S5iCw0caMyNmrf7j2ROvvM0QUJoEVLVz+2PRq4Jjs4azdjrjWSnwN7JkIr" name="form_fn" type="hidden"><input value="login" name="form_page" type="hidden"><input value="1" name="login_form_2_revisit" type="hidden"><table cellpadding="4" class="standard_form">
<tr><td colspan="2"><font color=red><b>New Visitors:</b></font> <a href="http://www.mysite.com/cgi-bin/mysite/account_create.html">Create a new account</a></td></tr>
<tr><td class="standard_form_field"><b>Username:</b></td>
<td colspan="1"><input maxlength="64" name="mv_username" onChange="if (this.value.match(/(^\s+)|(\s+$)/)){this.value = this.value.replace(/(^\s+)|(\s+$)/g,'');}if (this.value.match(/^$/) && !this.getAttribute('js_init_now')) {alert('This is a required field. Please make sure that it is …Run Code Online (Sandbox Code Playgroud) 我有一个应用程序需要针对不同级别的聚合进行分析,这就是OLAP工作负载.我也想经常更新我的数据库.
例如,这是我的更新看起来像(架构看起来像:时间,目标,源IP,浏览器 - >访问)
(15:00-1-2-2010, www.stackoverflow.com, 128.19.1.1, safari) --> 105
(15:00-1-2-2010, www.stackoverflow.com, 128.19.2.1, firefox) --> 110
...
(15:00-1-5-2010, www.cnn.com, 128.19.5.1, firefox) --> 110
Run Code Online (Sandbox Code Playgroud)
然后我想问一下上个月从firefox浏览器访问www.stackoverflow.com的访问量是多少.
我知道Vertica系统可以以相对便宜的方式实现这一点(明智的性能和可扩展性,但可能不是成本方面的).我这里有两个问题.
1)是否有可以构建的开源产品来解决这个问题?特别是,蒙德里安系统的运作情况如何?(可扩展性和性能)2)是否有HBase或Hypertable基础解决方案(显然,裸HBase/Hypertable不能这样做)? - 但如果有基于HBase/Hypertable的项目,可扩展性可能不会成为IMO的问题)?
谢谢!
使用php/sql在我的站点上创建搜索功能,这很简单 - 只需使用LIKE子句在数据库上使用SELECT ALL查询并在页面上回显结果.我的问题是,如果用户输入错误的搜索查询,我该如何添加拼写建议.除非搜索词与数据库内容完全匹配,否则Mysql不会返回任何内容,例如"Dofs"不会返回"Dogs".那么如何添加拼写建议呢?
谢谢.
我正在寻找一种方法来获得看起来像css3 text-shadow的文本阴影,但这适用于IE,Firefox,Opera,Safari等...我发现的解决方案看起来很乱或看起来不一致IE浏览器.谢谢
http://www.workingwith.me.uk/articles/css/cross-browser-drop-shadows
.shadow {
height: 1em;
filter: Shadow(Color=#666666,
Direction=135,
Strength=5);
}
Run Code Online (Sandbox Code Playgroud)
这对我不起作用......在IE中
ul.dropdown a.selected-l {
background-image: url('Images/Navigation/Left_round/hoverL.png');
height: 50px;
width: 130px;
font-family: Cambria, Cochin, Georgia, Times, "Times New Roman", serif;
font-size: large;
color: #FFFFFF;
text-align: center;
text-decoration: none;
line-height: 50px;
vertical-align: middle;
/* pretty browsers*/
text-shadow:#000 0px 0px 5px;
/* ugly ie */
zoom:1;/*force hasLayout*/
position:relative;/*for absolute position of child element*/
;
}
ul.dropdown a.selected-l span {
position:absolute;
left:-7px;top:-7px; /* strength + pixelradius */
z-index:-1;/* force under the normal …Run Code Online (Sandbox Code Playgroud) 在我的键盘钩子中,每个按键都会获得一个标志,指示它是否被注入. http://msdn.microsoft.com/en-us/library/ms644967(VS.85).aspx
我从lParam中提取了一个KBDLLHOOKSTRUCT.我可以访问kbd.flags.XXX.我只是不知道如何将这个8位标志转换为if (injected) {...我知道如何使用的条件类型.
如果你们中的一个聪明的计算机科学类型会帮助我,我会非常感激.
private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
{
KBDLLHOOKSTRUCT kbd = new KBDLLHOOKSTRUCT();
Marshal.PtrToStructure(lParam, kbd);
//if (injected) {...
Run Code Online (Sandbox Code Playgroud)
干杯!