如何根据Rating表格中字段的平均值对查询进行排序,字段本身是JSON文本,结构如下:
[
{"Type":1,"Rating":5},
{"Type":2,"Rating":5},
{"Type":3,"Rating":5}
]
Run Code Online (Sandbox Code Playgroud)
我需要按3 Ratings 的平均值对查询进行排序。永远只有3个值。
我当前的查询是:
SELECT `Name`, `Town`, `Vehicle`, `Review`, `Rating`, `Pics`, `PostedOn`
FROM `tbl_ShopReviews`
WHERE `Approved` = 1
ORDER BY `PostedOn` DESC
Run Code Online (Sandbox Code Playgroud)
当前结果:
Name Town Vehicle Review Rating Pics PostedOn
Kevin Chicopee 94 Corolla Great stuff, very glad I brought it here [{"Type":1,"Rating":5},{"Type":2,"Rating":5},{"Type":3,"Rating":5}] \N
Run Code Online (Sandbox Code Playgroud) 如何跳过备份我的"下载"文件夹?
这是我的代码:
#!/bin/bash
# Daily backup script
# Create some needed variable
day=$(date +%F)
Folder="/home/ME/"
File="/media/MediaTwo/Copy/UbuntuBackup/$day.tar.gz"
# Backup Server Configuration
tar cpzf $File $Folder
# Remove backup files older than 90 days
find $File* -mtime +90 -exec rm {} \;
Run Code Online (Sandbox Code Playgroud) 我想我在这里感到困惑。由于响应式设计有点绿色,我试图根据网站的查看宽度导入2个样式表中的1个。
但是,使用以下内容时,在Firebug中查看时,两者似乎都下降了。
它是否正确?我究竟做错了什么?
我想要实现的是,如果浏览器宽度小于940px,则拉active.css,如果大于px,则拉full.css
我已经包含了react.js库 https://github.com/scottjehl/Respond
@import url("/inc/Styles/full.css") (min-width: 940px);
@import url("/inc/Styles/responsive.css") (max-width: 940px) and (min-width: 100px);
Run Code Online (Sandbox Code Playgroud) 我今天在RegEx上有点时间
\('[\d',]+
在字符串中:
INSERT INTO `order_status_histories` VALUES ('3602','52efabe9-5f8c-4512-a994-3227c63dd20e','1','','Order recieved','2014-02-03 16:47:05','2014-02-03 16:47:05'),('3603','52eff713-54fc-4be0-9389-68d5c63dd20e','1','','Order recieved','2014-02-03 22:07:47','2014-02-03 22:07:47'),('3604','52effd1a-bc14-4095-97fd-6d46c63dd20e','1','','Order recieved','2014-02-03 22:33:30','2014-02-03 22:33:30')
Run Code Online (Sandbox Code Playgroud)
正如你所看到的那样,这是一个insert语句,第一个值是记录的ID,我不需要插入它,所以我试图找到所有这些,然后将它们清空......但我需要到#1得到那个数字,2个'字符,然后,才能这样做...所以我虽然我会从开头开始(.
我在这里发布的正则表达式抓住了我需要的东西,但是有点额外......它似乎抓住了这个('3670','5304(例如在第一个可插入记录中)
我怎么能在这里做我需要的?
好吧......星期五,天色已晚,我有点倦怠......
码:
public partial class SiteSelection : Window
{
private IList<IISBrowser.IISSiteList> _siteList;
public IList<IISBrowser.IISSiteList> SelectedItemsList { get; set; }
public SiteSelection(IList<IISBrowser.IISSiteList> _sl)
{
InitializeComponent();
_siteList = _sl;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.dg_Sites.ItemsSource = _siteList;
}
private void btnSelectSites_Click(object sender, RoutedEventArgs e)
{
SelectedItemsList = (IList<IISBrowser.IISSiteList>)dg_Sites.SelectedItems;
this.Close();
}
Run Code Online (Sandbox Code Playgroud)
填充数据网格,我可以在其中选择项目.带按钮(btnSelectSites)
我一直在 Unable to cast object of type 'System.Windows.Controls.SelectedItemCollection' to type 'System.Collections.Generic.IList 1[Backup.S3.Store.IISBrowser+IISSiteList]'.
并且不明白为什么......这是我的理解,因为我IList<>在申请ItemSource 时设置了这个,我会返回相同的数据类型..
我怎样才能解决这个问题?
编辑:
已经尝试过这里的解决方案:在wpf数据网格中键入所选项目的列表,这与其他解决方案类似......其中没有一个有效.
我的 nginx.conf 中有以下内容
add_header Content-Security-Policy
"default-src 'self';
img-src 'self' 'unsafe-inline' 'unsafe-eval' data: *.printfriendly.com *.w.org *.gravatar.com *.vimeocdn.com;
script-src 'self' 'unsafe-inline' 'unsafe-eval' *.w.org *.gravatar.com *.googleapis.com *.jsdelivr.net *.printfriendly.com *.kxcdn.com *.vimeocdn.com *.hs-analytics.net *.securitymetrics.com *.google-analytics.com;
style-src 'self' 'unsafe-inline' *.googleapis.com *.bootstrapcdn.com *.gstatic.com *.vimeocdn.com;
font-src 'self' data: *.googleapis.com *.bootstrapcdn.com *.gstatic.com *.googleapis.com;
frame-src 'self' *.vimeocdn.com *.vimeo.com;
object-src 'self'";
Run Code Online (Sandbox Code Playgroud)
(我不得不将它多行以使其清晰......)
但是,在我的网站中,我仍然收到此错误:
Content Security Policy: The page’s settings blocked the loading of a resource at http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css (“style-src”).
Run Code Online (Sandbox Code Playgroud)
当它被列入白名单时,任何想法为什么会发生这种情况?
如何在表格中将每4列列为自己的行?请不要告诉我,我应该把它们当作div,这需要是一张桌子......
这是我的代码:
$tmpRet = array_filter($ret, function($e){
return ($e['categoryID'] == 6) ? $e : null;
});
$tmpRet = array_values($tmpRet);
$tmpCt = count($tmpRet);
$counter = 0;
echo '<table width="100%" cellpadding="10" cellspacing="5">' . PHP_EOL;
for($i = 0; $i < $tmpCt; ++$i){
$counter ++;
echo ($i == 0 || $i % 4 === 0) ? ' <tr>' . PHP_EOL : null;
echo '<td width="25%" align="center" valign="middle"><a href="' . $tmpRet[$i]['sponUrl'] . '" target="_blank"><img border="0" src="http://sparkusa.org/' . GetLogoPath($tmpRet[$i]['showType']) . '/images/sponsors/' . $tmpRet[$i]['sponFileName'] . '" alt="' . …Run Code Online (Sandbox Code Playgroud) 好的,我在这里做错了什么?我正在尝试将一些vb内容重写为c#(所以我可以学习一些c#),但是我很失败.
这是代码,我将发布之后发生的事情:
private object[] _PNs;
internal object[] ParameterNames { set { _PNs = value; } }
private object[] _PVs;
internal object[] ParameterValues { set { _PVs = value; } }
private Enumerations.DataType[] _DTs;
internal Enumerations.DataType[] ParameterDataTypes { set { _DTs = value; } }
protected void PrepareParams(SqlCommand objCmd)
{
try
{
long _DataSize = 0;
int _PCt = _PVs.GetUpperBound(0);
Type _t_dt = _DTs.GetType();
for (int i = 0; i <= _PCt; ++i)
{
if (_t_dt.IsArray)
{
switch (_DTs[i])
{
case …Run Code Online (Sandbox Code Playgroud) 我有一个名为fullname列的表 userFullName
我正在尝试创建一个正确的select语句来显示下拉列表的"-Select User-"值,但是在userFullName字段中按结果名排序结果集.
我怎么能够:
SQL语句:
SELECT
0 As UserID, '-Select User-' As UsersName, '' As Surname
UNION ALL
SELECT
userID As UserID, userFullName As UsersName,
REVERSE(SUBSTRING(REVERSE([userFullName]), 0, CHARINDEX(' ', REVERSE([userFullName])))) As Surname
FROM
vwSelectUser
ORDER BY
REVERSE(SUBSTRING(REVERSE([userFullName]), 0, CHARINDEX(' ', REVERSE([userFullName]))))
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
消息207,级别16,状态1,行6
无效的列名称"userFullName".
消息207,级别16,状态1,行6
无效的列名称"userFullName". 如果语句包含UNION,INTERSECT或EXCEPT运算符,则
消息104,级别16,状态1,行6
ORDER BY项必须出现在选择列表中.
是的,userFullName是一个有效的专栏vwSelectUser
我试图bash在我的python脚本中运行命令,但它失败了:
sh: -c: line 0: syntax error near unexpected token('`
脚本非常简单......
import os
os.system('bash <(curl -f -L -sS https://ngxpagespeed.com/install) --assume-yes --nginx-version latest -a "--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/media/cache/nginx/client_temp --http-proxy-temp-path=/media/cache/nginx/proxy_temp --http-fastcgi-temp-path=/media/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/media/cache/nginx/uwsgi_temp --http-scgi-temp-path=/media/cache/nginx/scgi_temp --user=www-data --group=www-data --with-file-aio --with-threads --with-ipv6 --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-http_xslt_module --with-http_image_filter_module --with-stream --with-stream_ssl_module"')
Run Code Online (Sandbox Code Playgroud)
但我无法看到我在哪里出错.
在shell中运行的确切命令工作正常:
bash <(curl -f -L -sS https://ngxpagespeed.com/install) --assume-yes \
--nginx-version latest -a "--prefix=/etc/nginx \ …Run Code Online (Sandbox Code Playgroud)