是否存在动态改变浏览器中运行的javascript的工具?例如,在运行时更改javascript变量的值.
有没有什么神奇的工具可以用来扫描为PHP4编写的源代码,以突出PHP5中不推荐使用的函数?我目前正在服务器上运行最新版本的PHP,需要移植此代码.那里有什么可以帮我一臂之力吗?
我有这个小HTML文档:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>HTML Test</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("script").each(function()
{
if($(this).attr("type") == "code")
{
alert($(this).text());
}
});
});
</script>
</head>
<body>
<script type="code">
var Text = "Text";
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
使用Firefox运行时,警报会显示<script type="code">标记的文本内容.在IE8中运行时,它什么都不显示.
你知道为什么吗?我很难过.
我的代码:
function Check($Variable, $DefaultValue) {
if(isset($Variable) && $Variable != "" && $Variable != NULL) {
return $Variable;
}
else {
return $DefaultValue;
}
}
$a = Check(@$foo, false);
$b = Check(@$bar, "Hello");
//$a now equals false because $foo was not set.
//$b now equals "Hello" because $bar was not set.
Run Code Online (Sandbox Code Playgroud)
isset()测试一个变量时,引擎盖下的检查?编辑:
默认值是用户定义的.有时它会是一个数字,有时是一个字符串.
我目前正在使用C#和VS2010的快速版本编写屏幕保护程序.我创建了一个漂亮的小屏幕保护程序,并将生成的程序集重命名为*.scr扩展名.
当我将它放在我的桌面上并双击它(或从上下文菜单中选择配置)时,它运行正常并显示正确的表单/屏幕保护程序.但是,当我通过将其放入文件夹安装它C:\Windows\System32,我尝试双击它并得到此错误:
Unable to find a version of the runtime to run this application
它也不能从屏幕保护程序控制面板.它列在下拉列表中但不起作用.
知道发生了什么事吗?
您是否知道任何已将PHP的本机类型(字符串,数组,整数,浮点数,布尔值等)重新定义为对象的项目?我不确定它会有多可行,但我只是认为将原生类型作为对象会很好.
例:
$Name = new String('Mary had a little lamb.');
print($Name->Length); //prints 23
print($Name->Replace('/lamb/', 'duck')); // prints Mary had a little duck.
Run Code Online (Sandbox Code Playgroud)
这会增加很多开销吗?有什么想法吗?
是否可以指定使用 CSS 时制表符空间占用多少像素等<pre>?
例如,假设我有一段代码出现在<pre>网页上:
function Image()
{
this.Write = function()
{
document.write(this.ToString());
return this;
};
...
}
Image.prototype = new Properties();
...
Run Code Online (Sandbox Code Playgroud)
是否可以使用CSS指定制表符缩进行的不同空间量?
如果没有,有什么解决方法吗?
我有一个小dll,我想用D语言.我假设它已用C语言编写.这些是我可以访问的文件,它们与我的程序存在于同一目录中:
这是我试图让D使用这个DLL.
test.d
pragma(lib, "blitz3dsdk.lib");
int main(string[] Args)
{
bbBeginBlitz3D();
bbEndBlitz3D();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
编译: dmd test.d -w -wi -debug
结果: Error 43: Not a Valid Library File.
Blitz3DSDK.d
module Blitz3DSDK;
// __declspec(dllimport) int bbBeginBlitz3D() - from the header file.
export extern (Windows) int bbBeginBlitz3D();
// __declspec(dllimport) void bbEndBlitz3D() - from the header file.
export extern (Windows) void bbEndBlitz3D();
Run Code Online (Sandbox Code Playgroud)
test.d
import Blitz3DSDK;
int main(string[] Args)
{
bbBeginBlitz3D();
bbEndBlitz3D();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
编译: dmd test.d …
我正在Linux上使用inotify子系统在D中编写文件监视器来进行事件通知.我已经在下面写了一些代码而且我差不多了,但是我有一个问题,即被监视的文件被切换为忽略,并且不再为它提出任何事件.
看起来这个人有类似的问题,但那里没有答案:Inotify vim修改
请考虑以下代码:
/**
* Imports.
*/
import core.sys.posix.unistd;
import core.sys.posix.sys.select;
import inotify;
import std.stdio;
/**
* Main.
*/
void main(string[] arguments)
{
immutable int EVENT_BUF_LEN = (1024 * (inotify_event.sizeof + 16));
auto inotifyInstance = inotify_init();
if (inotifyInstance >= 0)
{
string watchedFile = "/home/gary/Desktop/test.txt";
char[EVENT_BUF_LEN] buffer;
void* pointer;
auto watchDescriptor = inotify_add_watch(inotifyInstance, cast(char*)watchedFile, IN_ALL_EVENTS);
while (true)
{
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(inotifyInstance, &rfds);
timeval timeout;
timeout.tv_sec = 5;
timeout.tv_usec = 0;
if (select(FD_SETSIZE, &rfds, …Run Code Online (Sandbox Code Playgroud) 在下面的C代码中是用于所有这些定义的八进制文字?即使他们从多个零开始?
#define TCL_REG_BASIC 000000 /* BREs (convenience). */
#define TCL_REG_EXTENDED 000001 /* EREs. */
#define TCL_REG_ADVF 000002 /* Advanced features in EREs. */
#define TCL_REG_ADVANCED 000003 /* AREs (which are also EREs). */
#define TCL_REG_QUOTE 000004 /* No special characters, none. */
#define TCL_REG_NOCASE 000010 /* Ignore case. */
#define TCL_REG_NOSUB 000020 /* Don't care about subexpressions. */
#define TCL_REG_EXPANDED 000040 /* Expanded format, white space & comments. */
#define TCL_REG_NLSTOP 000100 /* \n doesn't match . or [^ ] …Run Code Online (Sandbox Code Playgroud)