我正在尝试优化我的MySQL查询,我需要一些帮助.这是我目前的查询:
SELECT *,
(SELECT name FROM stores WHERE id = products.store_id) AS store_name,
(SELECT username FROM stores WHERE id = products.store_id) AS store_username,
(SELECT region_id FROM stores WHERE id = products.store_id) AS region_id,
(SELECT city_id FROM stores WHERE id = products.store_id) AS city_id,
(SELECT name FROM categories_sub WHERE id = products.subcategory_id) AS subcategory_name,
(SELECT name FROM categories WHERE id = category_id) AS category_name
FROM products
WHERE date_start <= DATE(NOW()) AND date_end >= DATE(NOW())
Run Code Online (Sandbox Code Playgroud)
我很确定它可以更快.
我也有一个问题,当我尝试按region_id选择所有产品时(通过添加类似"AND region_id = MYID"的东西)它不起作用,我想知道它是否可以让它工作,以及如何?
感谢您的时间!
解 …
这让我疯了.我已经花了两个多小时试图解决这个问题......
这是我的问题.我正在开发一个适用于贝叶斯网络的大型程序.这是主要功能:
using namespace std;
int main()
{
DSL_network net;
initializeNetwork(net);
setEvidence(net);
net.SetDefaultBNAlgorithm(7);
net.SetNumberOfSamples(80000);
cout << "Samples:\t" << net.GetNumberOfSamples() << endl;
updateEvidence(net);
//net.WriteFile("test.dsl");
return(DSL_OKAY);
}
Run Code Online (Sandbox Code Playgroud)
一切正常.当我想要打印出一个字符串时出现问题:
using namespace std;
int main()
{
//simple string creation
string a = "test";
//should print out "test"
cout << a << endl;
DSL_network net;
initializeNetwork(net);
setEvidence(net);
net.SetDefaultBNAlgorithm(7);
net.SetNumberOfSamples(80000);
cout << "Samples:\t" << net.GetNumberOfSamples() << endl;
updateEvidence(net);
//net.WriteFile("test.dsl");
return(DSL_OKAY);
}
Run Code Online (Sandbox Code Playgroud)
这是输出(只是打印字符串a ...):
▀ÇΦy♠≈6♦
会发生什么事?
更新:
int main()
{
//simple string creation
string a = "test"; …Run Code Online (Sandbox Code Playgroud) 好吧,我刚刚获得了新的MSVS 2010 Beta 1,就像2008快递一样,我无法弄清楚如何编译任何东西,甚至不是简单的hello world程序.任何人有任何指针?我通常只是得到一条毯子失败的消息.没有真实的信息.
编辑:对不起
#include <iostream>
using namespace std;
main()
{
cout << "hello world";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我去构建,我得到:
1> ------ Build build:项目:forkicks,配置:调试Win32 ------
1>嵌入清单......
1>.\ Debug\forkicks.exe.intermediate.manifest:一般错误c1010070:无法加载和解析清单.该系统找不到指定的文件.
1>构建日志保存在"file:// c:\ Users\Randy\Documents\Visual Studio 2008\Projects\forkicks\forkicks\Debug\BuildLog.htm"
1> forkicks - 1个错误,0个警告==========构建:0成功,1个失败,0个最新,0个跳过======== ==
那是2008年
1>------ Build started: Project: For Kicks, Configuration: Debug Win32 ------
1>Build started 7/22/2009 9:36:39 PM.
1>_PrepareForBuild:
1> Creating directory "Debug\".
1> Creating "Debug\lastbuild.timestamp" because "AlwaysCreate" was specified.
1>ClCompile:
1> main.cpp
1>c:\users\randy\documents\visual studio 10\projects\for kicks\main.cpp(5): error C4430: missing type specifier - …Run Code Online (Sandbox Code Playgroud) 必须有一个简单的解释.
我有一个父<div>标记,其中包含许多需要根据其类隐藏的子div.问题是,我甚至无法得到我的父div的句柄.这究竟是什么问题?我要离开我的葫芦.
jQuery代码(片段)看起来像这样:
$(function() {
$('#dasummary').children().hide();
Run Code Online (Sandbox Code Playgroud)
违规<div>部分及其所有内容如下:
<asp:ListView ID="lvLedger" runat="server" DataSourceID="ldsLedger">
<LayoutTemplate>
<h2>Current Day Activity Summary</h2>
<div id="#dasummary">
<div id="itemPlaceholder" runat="server" />
</div>
</LayoutTemplate>
<ItemTemplate>
<div id="toggleRow" runat="server" class="group">
<asp:Image ID="imgToggle" runat="server"
ImageUrl="~/App_Themes/SunDIAL/images/maximize.png"
ImageAlign="Left" />
<%# Eval("Key") %> (<%# Eval("Count") %> entries)
</div>
<!-- Add nested ListView control for individual items here -->
<asp:ListView ID="lvItems" runat="server" DataSource='<%# Eval("Tasks") %>'>
<LayoutTemplate>
<div class="activity_summary">
<table>
<thead>
<tr>
<th class="first" />
<th>Day</th>
<th>Job</th>
<th>Batch</th>
<th>Duration</th>
</tr>
</thead>
<tbody>
<tr …Run Code Online (Sandbox Code Playgroud) 好的,我在主窗口中有2个编辑控件和一个按钮; 在一个编辑控件中,用户可以编写一个数字,当他按下按钮时,我读取该编号,然后将其打印在另一个编辑控件(只读)中.
我的问题是,当我输入一个数字并按下按钮时,由于某种原因,我不明白我可以得到那个数字.GetDlgItemInt()总是返回零,他的第三个参数总是返回false.
这是我使用GetDlgItemInt()读取数字的代码:
case CM_BUTTON:
number = GetDlgItemInt(hwndEdit2, CM_EDIT2, &flag, FALSE);
if(flag)
{
if(number > 0 && number < 20)
{
sprintf(message, "This is the number %d", number);
SetWindowText(hwndEdit, message);
}
else
MessageBox(hwnd, "Number to high or to low", "Error", MB_OK | MB_ICONWARNING);
}
else
MessageBox(hwnd, "Error getting the number", "Error", MB_ICONEXCLAMATION | MB_OK);
break;
Run Code Online (Sandbox Code Playgroud)
有什么建议?
使用正则表达式(在c#.net中)是否可以检查字符串的上一行?
举例来说,我需要选择字符串中前行不是一系列星号(前行:******)
我在这里阅读了几个问题,用正则表达式解析HTML,我知道这总的来说是个糟糕的主意.
话虽如此,我有一个非常具体的问题,我认为正则表达可能是答案.我一直在努力寻找答案,但我是新的(今天)到Regex,我希望有些善良的人可以帮助我.
我有一个总是遵循格式的字符串数组
STUFF HERE<a href="somewhere" title="something" target="_blank">name of thing</a>STUFF HERE
我希望实现的只是留下'某处'和'名称的东西,以便我可以输出<a href="somewhere">name of thing</a>.
如果你碰巧感兴趣,那么字符串数组来自我的Facebook个人资料上的链接RSS源.
很多,非常感谢任何帮助.
插口