我正在尝试在do while循环中发送多个帖子,但结果未添加
<script type="text/javascript">
function action() {
var initval = 1;
var endval = 5;
do {
var action_string = 'txtuser=someone';
$.ajax({
type: "POST",
url: "http://localhost/js.php",
data: action_string,
success: function(result){
$('div#append_result').append(initval + ',<br/>');
}
});
initval++;
} while (initval <= endval);
}
</script>
Run Code Online (Sandbox Code Playgroud)
输出为:5,5,5,5,5,
我需要输出为:1,2,3,4,5,
在Haskell中,是否可以将用户输入从一个IO功能共享到另一个?
例如,如果我有:
main = do
putStrLn "Give me a number!"
my_stuff <- getLine
let nump = read (my_stuff)::Int
another_function nump
Run Code Online (Sandbox Code Playgroud)
其中another_function也是带有do
构造的IO函数.
another_function nump = do
putStrLn nump
putStrLn "Try again!"
main
Run Code Online (Sandbox Code Playgroud)
这将使得在幻想世界的Haskell解释我有我的头感觉.但是,在现实世界中:my_stuff在another_function中未绑定; 而在main中,my_stuff需要是IO t类型,但事实并非如此.
上面的代码(很可能)对Haskellers非常冒犯,但我希望它能传达出我的目标......
我该如何解决这个问题?
我发现添加类型提示对调试很有用,但我不知道如何使用<-
on和IO操作的结果
action :: IO ()
foo :: String --doesnt't compile
foo <- getLine
Run Code Online (Sandbox Code Playgroud) 我编写此代码以获取一组字符,直到读取特定字符.我知道有一种更好的方式,只是好奇心.它没用.循环持续不断.为什么是这样 ???
foreach (char myChar in monthYear)
{
do
{
whichMonth = whichMonth + myChar;
} while (myChar.ToString() == "-");
}
Run Code Online (Sandbox Code Playgroud) 如何在Fortran中实现这一目标?
do i = 1, n Except n/2
Run Code Online (Sandbox Code Playgroud)
有没有方便的方法而不是在循环中使用'if'?
我是@Nonnull
注释的新手.
我试着用它并编写以下测试:
public class TestNonull{
public static void doSmth(@Nonnull Integer integer){}
public static void main(final String[] arguments){
doSmth(null);
doSmth(1);
}
}
Run Code Online (Sandbox Code Playgroud)
我在控制台中看不到任何内容.
这是正常的吗?
我在很多情况下用来写一个属性
public string Data {get; private set; }
Run Code Online (Sandbox Code Playgroud)
通常我在构造函数中初始化它们如何为Data提供一些值,而不是显式地使用构造函数
除了存储代理的状态外,Tin Can API还能做什么?我们如何从Tin Can API中检索公共存储的语句
提前致谢
你好,
在我的AppleScript中,我正在运行以下代码,
do shell script "sudo networksetup -setproxybypassdomains Ethernet *.local, 169.254/16"
do shell script "sudo networksetup -setwebproxy Ethernet 127.0.0.1 8888"
do shell script "sudo networksetup -setsecurewebproxy Ethernet 127.0.0.1 8888"
Run Code Online (Sandbox Code Playgroud)
但是,它每次都要求输入密码.我的意思是当脚本打开时,它会为每行进程请求密码3次.为了防止要求密码,我必须在终端中键入以下内容,
sudo chmod u + s/usr/sbin/networksetup
当按下Enter键时,它会要求输入密码,输入并运行AppleScript后,它不会再要求输入密码(3次).
但是用户必须转到终端并键入以上命令.为了防止这种情况,我在AppleScript中使用了以下代码,
do shell script "sudo chmod u+s /usr/sbin/networksetup"
Run Code Online (Sandbox Code Playgroud)
因此用户运行AppleScript并自动设置.但是我收到以下错误消息,
如何更改AppleScript,
do shell script "sudo chmod u+s /usr/sbin/networksetup"
Run Code Online (Sandbox Code Playgroud)
...要求输入一次密码,然后执行"... do shell script ..."部分的其余部分而不要求输入密码.或者添加密码以及上面的代码行以使其工作?
根据HyperSpec,其页面DO
(由我提供的重点):
do接受任意数量的迭代变量,这些变量在迭代中绑定并并行执行.
但似乎DO
无法接受空变量列表,例如:
(do (())
((cond n) (end-result))
(cond-1..
(cond-2..))
Run Code Online (Sandbox Code Playgroud)
是不是真的DO
不能接受空的var列表?是否有一个原因?(我想总有LOOP
).
我正在运行SBCL.
c# ×2
do-while ×2
haskell ×2
io ×2
loops ×2
while-loop ×2
.net ×1
ajax ×1
applescript ×1
char ×1
common-lisp ×1
fortran ×1
guava ×1
java ×1
javascript ×1
lisp ×1
macos ×1
null ×1
properties ×1
public ×1
sbcl ×1
shell ×1
storage ×1
sudo ×1
syntax ×1
tin-can-api ×1