我在SUSE Linux中有一个SQLite3数据库.
它像命令提示一样停留在命令提示符下:
sqlite> q
...> exit
...> .exit
...> quit
...> .quit
Run Code Online (Sandbox Code Playgroud)
如何退出数据库?
我按照这里的示例:https://www.youtube.com/watch?v = MoMjIwGSFVQ并使用网络摄像头进行对象检测.
但我已经将我的网络摄像头转换为使用来自IP摄像机的rtsp流,我相信它正在流式传输H264 ,我现在注意到视频中有大约30秒的延迟,而且视频有时会停止启动.
这是执行主要处理的python代码:
import cv2
cap = cv2.VideoCapture("rtsp://192.168.200.1:5544/stream1")
# Running the tensorflow session
with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
ret = True
while (ret):
ret,image_np = cap.read()
# Expand dimensions since the model expects images to have shape: [1, None, None, 3]
image_np_expanded = np.expand_dims(image_np, axis=0)
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
# Each box represents a part of the image where a particular object was detected.
boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
# Each score …Run Code Online (Sandbox Code Playgroud) 在我的C#WinForms应用程序中,我有一个隐藏其默认控件的主窗口.
所以为了让我能够移动它,我将以下内容添加到主窗口:
private const int WM_NCHITTEST = 0x84;
private const int HTCLIENT = 0x1;
private const int HTCAPTION = 0x2;
private const int WM_NCLBUTTONDBLCLK = 0x00A3;
protected override void WndProc(ref Message message)
{
if (message.Msg == WM_NCLBUTTONDBLCLK)
{
message.Result = IntPtr.Zero;
return;
}
base.WndProc(ref message);
//Allow window to move
if (message.Msg == WM_NCHITTEST && (int)message.Result == HTCLIENT)
message.Result = (IntPtr)HTCAPTION;
}
Run Code Online (Sandbox Code Playgroud)
我有一个WPF应用程序,我也隐藏了默认控件,我想做同样的事情.我看到主窗口是从'Window'派生的,所以上面的代码不起作用.我如何在WPF中执行此操作?
我有以下程序(我从http://blogs.msdn.com/b/csharpfaq/archive/2010/06/01/parallel-programming-in-net-framework-4-getting-started.aspx获得)使用Parallel.For循环拆分任务
class Program
{
static void Main(string[] args)
{
var watch = Stopwatch.StartNew();
Parallel.For(2, 20, (i) =>
{
var result = SumRootN(i);
Console.WriteLine("root {0} : {1} ", i, result);
});
Console.WriteLine(watch.ElapsedMilliseconds);
Console.ReadLine();
}
public static double SumRootN(int root)
{
double result = 0;
for (int i = 1; i < 10000000; i++)
{
result += Math.Exp(Math.Log(i) / root);
}
return result;
}
}
Run Code Online (Sandbox Code Playgroud)
当我多次运行此测试时,我会得到以下时间:
1992年,2140年,1783年,1863年等等
我的第一个问题是,为什么时代总是不同?我每次都在进行完全相同的计算,但每次时间都不同.
现在,当我添加以下代码以使用我CPU上的所有可用处理器时:
var parallelOptions = new ParallelOptions
{
MaxDegreeOfParallelism …Run Code Online (Sandbox Code Playgroud) 我有一个以毫秒为单位的起始时间点,如下所示:
using namespace std::chrono;
typedef time_point<system_clock, milliseconds> MyTimePoint;
MyTimePoint startTimePoint = time_point_cast<MyTimePoint::duration>(system_clock::time_point(steady_clock::now()));
Run Code Online (Sandbox Code Playgroud)
现在我将有一定的小时数我要添加或减去startTimePoint.
int numHours = -5//or 5 etc (Can be a plus or minus number)
Run Code Online (Sandbox Code Playgroud)
如何将这段时间添加到原始startTimePoint?
我有一个C#WPF页面并且在其上我放置了几个我希望像复选框一样的小图像(我有自己的自定义图像用于悬停和选定状态).
我这样手动更改图像:
<Image x:Name="Image_Custom" Source="/Images/checkcircle_off.png" Width="16" Height="16" HorizontalAlignment="Left" Margin="30,107,0,0" VerticalAlignment="Top" MouseEnter="Image_Custom_MouseEnter" MouseLeave="Image_Custom_MouseLeave" MouseUp="Image_Custom_MouseUp" MouseLeftButtonDown="Image_Custom_MouseLeftButtonDown"/>
private void Image_Custom_MouseEnter(object sender, MouseEventArgs e)
{
if (_selected == false)
{
var uriSource = new Uri("/Images/checkcircle_hover.png", UriKind.Relative);
Image_Custom.Source = new BitmapImage(uriSource);
}
}
private void Image_Custom_MouseLeave(object sender, MouseEventArgs e)
{
if (_selected == false)
{
var uriSource = new Uri("/Images/checkcircle_off.png", UriKind.Relative);
Image_Custom.Source = new BitmapImage(uriSource);
}
}
private void Image_Custom_MouseUp(object sender, MouseButtonEventArgs e)
{
if (_selected)
{
var uriSource = new Uri("/Images/checkcircle_off.png", UriKind.Relative);
Image_Custom.Source = …Run Code Online (Sandbox Code Playgroud) 我需要重写一些使用windows WaitforSingleObject函数的代码.
myEvent = CreateEvent( NULL, FALSE, FALSE, szName );
WaitForSingleObject( myEvent, nMilliseconds );
Run Code Online (Sandbox Code Playgroud)
我需要等待事件或超时发生.在直接的C++中是否有相当于这个?
我使用的是STL C++ 11而不是其他任何库,例如boost.
我有一个C#.net网络应用程序,用于将视频上传到Youtube.这工作大约6个月前,但现在已停止工作.当我在本地计算机上通过Visual Studio启动我的网站时,以下代码会挂起:
UserCredential credential;
using (var auth_stream = new FileStream(Server.MapPath("~/YouTube/client_secrets.json"), FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(auth_stream).Secrets,
// This OAuth 2.0 access scope allows an application to upload files to the
// authenticated user's YouTube channel, but doesn't allow other types of access.
new[] { YouTubeService.Scope.YoutubeUpload },
"user",
CancellationToken.None
);
}
Run Code Online (Sandbox Code Playgroud)
在查看堆栈溢出的其他帖子之后我也尝试了以下内容:
UserCredential credentialS;
using (var auth_stream = new FileStream(Server.MapPath("~/YouTube/client_secrets.json"), FileMode.Open, FileAccess.Read))
{
credentialS = await GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
{
ClientId = "blahblah-myDetailsBlahBLah.apps.googleusercontent.com",
ClientSecret = "myClientSecret",
},
// This …Run Code Online (Sandbox Code Playgroud) c# google-api youtube-api oauth-2.0 google-api-dotnet-client
我在Windows 7上安装了VS2013和VS2015.
我有一个现有的C++ Dll项目正在建设正常但现在突然间它不会使用VS2015构建并给我错误:
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
Run Code Online (Sandbox Code Playgroud)
从这篇文章:致命错误LNK1104:无法打开文件'kernel32.lib'我去找了kernel32.lib文件,它位于这里:
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86
Run Code Online (Sandbox Code Playgroud)
当我转到我的项目属性 - >链接器 - >输入并选择宏时,我看到这条路径确实存在:
我的平台工具集设置为Visual Studio 2013 - Windows XP(v120_xp),它始终设置为.
为什么我的项目突然停止建设?什么可能出错?
我有以下代码可以连接到站点:
int main()
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl)
{
curl_easy_setopt(curl, CURLOPT_URL, "https://192.168.200.115:8080/appliances");
curl_easy_setopt(curl, CURLOPT_USERNAME, "myusername");
curl_easy_setopt(curl, CURLOPT_PASSWORD, "mypassword");
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
// Perform the request, res will get the return code
res = curl_easy_perform(curl);
// Check for errors
if(res != CURLE_OK)
{
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
}
//always cleanup
curl_easy_cleanup(curl);
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
运行时出现错误:对等证书无法使用给定的 ca 证书进行身份验证
谷歌搜索后,我发现我必须添加以下行:
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
Run Code Online (Sandbox Code Playgroud)
但是现在我收到错误消息:ssl peer certificate or ssh remote key is not ok
我试过添加:
curl_easy_setopt(curl, …Run Code Online (Sandbox Code Playgroud) c# ×4
c++ ×3
c++11 ×2
wpf ×2
xaml ×2
c++-chrono ×1
curl ×1
google-api ×1
kernel32 ×1
libcurl ×1
oauth-2.0 ×1
opencv ×1
python ×1
sqlite ×1
tensorflow ×1
visual-c++ ×1
youtube-api ×1