如果我有这样一张桌子:
jobId, jobName, Priority
Run Code Online (Sandbox Code Playgroud)
其中,优先级可以是1到5之间的整数.
由于我需要此查询来生成报表上的图表,因此我需要显示jobid,jobname和名为Priority1,Priority2,Priority3,Priority4的5个字段.Priority5.
Priority1应计算优先级字段值为1的行数.
Priority2应计算优先级字段值为2的行数.
Priority3应计算优先级字段值为3的行数.
等等
我怎么能以快速和高效的方式做到这一点?
非常感谢,Kave
我在virtualenv中安装pytz时遇到问题.
下载/解压缩pytz
无法找到满足要求pytz的版本(版本:2009r,2008b,2009f,2008c,2007g,2011g,2005m,2011e,2007f,2011k,2007k,2006j,2008h,2008i,2011e,2008a, 2009e,2006g,2011j,2010l,2005m,2008i,2005k,2008g,2007c,2007i,2009l,2009r,2006j,2011k,2007d,2006p,2009i,2009u,2007i,2009f,2010g,2008h,2009a,2007g,2011e, 2006p,2012b,2010k,2005r,2007f,2009l,2009p,2008c,2009j,2008g,2010g,2010h,2011h,2010k,2007c,2007d,2011d,2009l,2011c,2008a,2005m,2007k,2009n,2011d,2010o, 2013b,2012h,2010e,2012c,2012d,2012f,2011n,2011b,2011j,2008c,2012j,2007k,2009f,2009d,2010e,2010b,2013b,2011d,2009p,2008h,2005r,2009i,2009n,2009a,2010k, 2008g,2006g,2008b,2012c,2009i,2007g,2012c,2010h,2011n,2012g,2007d,2008a,2009u,2012g,2010o,2006p,2010b,2009u,2012d,2011k,2012f,2009a,2007f,2011h,2010l, 2009j,2011g,2009g,2009g,2005r,2011c,2012g,2009g,2012d,2009j,2010o,2007c,2010g,2006g,2009d,2010h,2005k,2006j,2010b,2009n,2011g,2011c,2012b,2009e,2009d,2011j,2007i,2012j,2010l,2009r,2012h,2010e,2009p,2008i,2012f,2009e,2012b, 2011h,2005k,2008b,2013b,2011n,2012j,2004b)
清理......
没有匹配pytz版本的发行版
这似乎是最新版本的pip的一个问题.
有没有解决方法?
我在文本框中输入一个字符串值,显示需要格式化的余额,如下所示:
###,###,###,##0.00
Run Code Online (Sandbox Code Playgroud)
我可以使用value.ToString("c"),但这会将货币符号放在它前面.
知道如何在输入文本框之前操作字符串以实现上述格式化吗?
我试过这个,没有成功:
String.Format("###,###,###,##0.00", currentBalance);
Run Code Online (Sandbox Code Playgroud)
非常感谢,
我最近有两次电话采访.
在两次采访中,我被问到是定义Lambda表达式的最后一个问题.
我声称Lambda表达式是一个未命名的方法来代替委托.但不知何故,这还不够.
我发现在电话采访中很难解释这一点.
有谁知道更好吗?
这会将输出写入日志文件:
& $Env:WinDir\system32\inetsrv\appcmd.exe >test.log
Run Code Online (Sandbox Code Playgroud)
但是如果我想将输出保存在字符串变量中以便在电子邮件正文中使用它呢?
我试了这个没有运气..
$test = ""
& $Env:WinDir\system32\inetsrv\appcmd.exe >$test
Write-Host $test
Run Code Online (Sandbox Code Playgroud) 如果您想创建自定义委托,则可以使用delegate小写的关键字.
你能用实际的Delegate班级做什么?这有什么用?我不明白确切的区别.
我在ButtonStyle中创建了一个Image.现在我创建了一个附加属性,以便我可以为该图像设置Source.应该是直截了当但我坚持下去.
这是我缩短的ButtonStyle:
<Style x:Key="ToolBarButtonStyle"
TargetType="Button">
...
<Image x:Name="toolbarImage"
Source="{TemplateBinding PrismExt:ImageSourceAttachable:ImageSource}"
Width="48"
Height="48" />
...
</Style>
Run Code Online (Sandbox Code Playgroud)
这是附加的属性定义,注意我不知道如何修复回调,因为dependencyproperty似乎是按钮而不是图像.而Button不会在我的风格中暴露我的Image.这很棘手.
namespace SalesContactManagement.Infrastructure.PrismExt
{
public class ImgSourceAttachable
{
public static void SetImgSource(DependencyObject obj, string imgSource)
{
obj.SetValue(ImgSourceProperty, imgSource);
}
public static string GetImgSource(DependencyObject obj)
{
return obj.GetValue(ImgSourceProperty).ToString();
}
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ImgSourceProperty =
DependencyProperty.RegisterAttached("ImgSource", typeof(string), typeof(ImgSourceAttachable), new PropertyMetadata(Callback));
private static void Callback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
//((Button)d).Source = …Run Code Online (Sandbox Code Playgroud) .net silverlight wpf dependency-properties attached-properties
这个问题不应该与此混淆..这是两件不同的事情.
有一个很好的例子,说明如何在SO上使用UITableView标头.
这一切都很好,只要样式设置为主标题就固定在顶部plain.
但是如果我使用的话sections,主标题不再粘到顶部并且在向下滚动时移开.
在这个方法中,我返回每个部分的标题.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
Run Code Online (Sandbox Code Playgroud)
在这个方法中,我设置上面标题部分的高度:
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
Run Code Online (Sandbox Code Playgroud)
在这个方法中,我正在设置真正的表头.
- (void)viewWillAppear:(BOOL)animated {
...
self.recordTableView.tableHeaderView = headerView;
}
Run Code Online (Sandbox Code Playgroud)
是否可以使用固定的表头,同时使用部分?请问有什么替代解决方案吗?
有人在四月份提出完全相同的问题,没有任何答案.但由于他提供的信息太少; 这个问题被抛弃了.
我也有同样的问题.在一个main_page.html我有这样一行:
<a href="/contact/edit/{{ item.id }}" title="Edit">edit</a>
Run Code Online (Sandbox Code Playgroud)
一旦你点击那里,编辑模板将出现在twitter bootstrap模式中.
url.py
(r'^contact/edit/(?P<contact_id>\d+)/$', contact_view),
Run Code Online (Sandbox Code Playgroud)
view.py
def contact_view(request, contact_id=None):
profile = request.user.get_profile()
if contact_id is None:
contact = Contact(company=profile.company)
template_title = _(u'Add Contact')
else:
contact = get_object_or_404(profile.company.contact_set.all(), pk=contact_id)
template_title = _(u'Edit Contact')
if request.POST:
if request.POST.get('cancel', None):
return HttpResponseRedirect('/')
form = ContactsForm(profile.company, request.POST, instance=contact)
if form.is_valid():
contact = form.save()
return HttpResponseRedirect('/')
else:
form = ContactsForm(instance=contact, company=profile.company)
variables = RequestContext(request, {'form':form, 'template_title': template_title})
return render_to_response("contact.html", variables)
Run Code Online (Sandbox Code Playgroud)
这通常是contact.html的样子: …
在我的Django模型中,我创建了一个十进制字段,如下所示:
price = models.DecimalField(_(u'Price'), decimal_places=2, max_digits=12)
Run Code Online (Sandbox Code Playgroud)
显然,价格为负或零是没有意义的.有没有办法将十进制数限制为只有正数?
或者我是否必须使用表单验证来捕获它?
.net ×2
django ×2
python ×2
c# ×1
conditional ×1
count ×1
currency ×1
delegates ×1
format ×1
forms ×1
ios ×1
lambda ×1
modal-dialog ×1
pip ×1
powershell ×1
pytz ×1
silverlight ×1
sql ×1
string ×1
uitableview ×1
virtualenv ×1
wpf ×1