我正在制作像GNU MC这样的终端软件,我需要goto来foo,但它必须在C中.它可以是宏或C,但不是ASM代码,因为我不知道ASM.任何位运算符也可以使用,但我不知道如何伪代码或如何开始这样做.任何建议将非常感谢:)
最近,我开始研究JavaScript,我开始讨论异步编码,或者将其称为函数参数或回调(node.js更具体).
我用它测试了一些东西,但是不能理解它.例如
window.addEventListener("click", function(){ alert("HELO"); }, true);
Run Code Online (Sandbox Code Playgroud)
什么都不做 有人可以简单解释一下异步编码背后的想法究竟是什么以及这些回调是什么,这也是一个3-4行的例子.
我正在编写一些PHP代码,我通过电子邮件验证检查结束它.有人可以审查它并确认它是否是一个好的解决方案?
<?php
function isTrue($var) {
return (isset($var)) ? TRUE : FALSE;
}
function len($str) {
$i;
for($i=0; isTrue($str[$i]); $i++) {
/* count me */
}
return $i;
}
function parsMe($str) {
$at; $dot; $isvalid=0; $isnotvalid=0;
for ( $at=0; isTrue($str[$at]); $at++) {
if ( $str[$at] == "@" ) {
for ( $dot=$at+1; isTrue($str[$dot]); $dot++ ) {
if ( $str[$dot] == "." ) $isvalid += 1;
if ( $str[$dot] =="@" || $str[len($str)-1] == "@" || $str[len($str)-1] == "." ) {
die("Error email …Run Code Online (Sandbox Code Playgroud) 我正在做一些测试html/php表单.这里的一切都很好......但是单选按钮表现得很奇怪.这是代码,下面将是奇怪行为的屏幕截图:
HTML
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Differend sided dice</h1>
<form action="dice.php" method="post">
<input type="radio" value="4" name="4side" checked />4 side<br />
<input type="radio" value="10"name="10side" />10 side<br />
<input type="radio" value="20"name="20side" />20 side<br />
<input type="submit" >
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
PHP
<html><head></head>
<body>
<?
function rollOut($dice) {
$out = <<<HERE
<p>You rolled <span style="color:red"> $dice </span> of the diec</p>
HERE;
return $out;
}
function diceSide() {
$dicetype = rand(1, 10); /* default */
if ( isset($_POST["4side"] ) ) {
$dicetype …Run Code Online (Sandbox Code Playgroud)