如何将md5哈希与grep命令匹配?
在php中我过去使用过这个正则表达式模式:
/^[0-9a-f]{32}$/i
Run Code Online (Sandbox Code Playgroud)
但我试过:
grep '/^[0-9a-f]{32}$/i' filename
grep '[0-9a-f]{32}$/' filename
grep '[0-9a-f]{32}' filename
Run Code Online (Sandbox Code Playgroud)
和其他变种,但我没有得到任何输出,我知道该文件包含md5哈希.
我正在使用此代码来检索网址内容:
private ArrayList request(string query)
{
ArrayList parsed_output = new ArrayList();
string url = string.Format(
"http://url.com/?query={0}",
Uri.EscapeDataString(query));
Uri uri = new Uri(url);
using (WebClient client = new WebClient())
{
client.DownloadStringAsync(uri);
}
// how to wait for DownloadStringAsync to finish and return ArrayList
}
Run Code Online (Sandbox Code Playgroud)
我想使用DownloadStringAsync因为DownloadString挂起应用程序GUI,但我希望能够返回结果request.我怎么能等到DownloadStringAsync完成请求?
我正在使用此代码来创建带有圆边的表单(FormBorderStyle = none):
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn
(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // height of ellipse
int nHeightEllipse // width of ellipse
);
public Form1()
{
InitializeComponent();
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
}
Run Code Online (Sandbox Code Playgroud)
这是在Paint事件上设置自定义边框:
ControlPaint.DrawBorder(e.Graphics, this.ClientRectangle, Color.Black, 5, ButtonBorderStyle.Solid, Color.Black, 5, ButtonBorderStyle.Solid, Color.Black, 5, ButtonBorderStyle.Solid, Color.Black, …Run Code Online (Sandbox Code Playgroud) 我一直在使用这个简单的脚本从文本生成图像:
<?php
header('Content-type: image/png');
$color = RgbfromHex($_GET['color']);
$text = urldecode($_GET['text']);
$font = 'arial.ttf';
$im = imagecreatetruecolor(400, 30);
$bg_color = imagecolorallocate($im, 255, 255, 255);
$font_color = imagecolorallocate($im, $color[0], $color[1], $color[2]);
imagefilledrectangle($im, 0, 0, 399, 29, $bg_color);
imagettftext($im, 20, 0, 10, 20, $font_color, $font, $text);
imagepng($im);
imagedestroy($im);
function RgbfromHex($hexValue) {
if(strlen(trim($hexValue))==6) {
return array(
hexdec(substr($hexValue,0,2)), // R
hexdec(substr($hexValue,2,2)), // G
hexdec(substr($hexValue,4,2)) // B
);
}
else return array(0, 0, 0);
}
?>
Run Code Online (Sandbox Code Playgroud)
我用file.php调用脚本?text = testing script&color = 000000
现在我想知道如何在同一图像中混合使用普通和粗体字体生成文本,例如 file.php?text=testing <b>script</b>&color=000000
感谢dqhendricks帮助我解决这个问题. …
我需要构建一个php应用程序,我正在考虑使用一个框架(之前从未使用过).我一直在浏览一些,但大多数看起来有点复杂,我真的很喜欢我看到的Symfony,但看起来我将花费一个月,直到我真正了解如何使用它,并在一个月内我可以在没有框架的情况下编写我想到的应用程序5次.但我想用一个来"标准化"我的代码并防止错误.
所以我想知道是否有人可以与我分享您认为哪些PHP框架更容易学习如何使用.
我的应用程序将使用mysql,它将有一些"搜索引擎"来搜索将使用一些"刮刀脚本"(我也想使用框架编码)填充在数据库上的数据.
我正在使用NSIS为我的某个应用程序创建安装程序,并且我使用此代码在开始菜单上创建快捷方式:
;create start-menu items
CreateDirectory "$SMPROGRAMS\myFolder"
CreateShortCut "$SMPROGRAMS\myFolder\app.lnk" "$INSTDIR\app.exe" "" "$INSTDIR\app.exe" 0
CreateShortCut "$SMPROGRAMS\myFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
Run Code Online (Sandbox Code Playgroud)
它可以工作,但开始菜单> myFolder上的卸载程序快捷方式出现在app.exe快捷方式之前.
有没有办法控制快捷方式的顺序?
我在.NET中使用ThreadPool在后台发出一些Web请求,我希望有一个"停止"按钮来取消所有线程,即使它们正在发出请求,所以一个简单的bool不会这样做工作.
我怎样才能做到这一点?
我需要匹配["this"但不是:["this"
我有这个代码:
Match match = Regex.Match(result, @"\[""(.*?)""",
RegexOptions.IgnoreCase);
while (match.Success)
{
MessageBox.Show(match.Groups[1].Value.Trim());
}
Run Code Online (Sandbox Code Playgroud)
我试过这个模式@"(?!:)\[""(.*?)""",但它仍然匹配:["this".我需要实现这个模式吗?
我正在使用XHTML 1.0 Transitional doctype html文件,我希望有一个宽度为800px的主div,并使其显示为居中(不是div内容,而是div本身).
我过去用过这个:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
<!--
html, body { margin:0; padding:0; }
#main-container { background:black; width:800px; }
-->
</style>
</head>
<body>
<center>
<div id="main-container">
Content
</div>
</center>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但我不确定这是否是跨浏览器兼容的,或者它是否有效的xhtml.
c# ×4
php ×2
regex ×2
asynchronous ×1
cakephp ×1
frameworks ×1
gd ×1
grep ×1
html ×1
httprequest ×1
image ×1
imagettftext ×1
installer ×1
linux ×1
nsis ×1
request ×1
shortcuts ×1
string ×1
symfony1 ×1
threadpool ×1
winforms ×1
xhtml ×1