尝试运行cabal install cabal-install时出现以下错误我已安装haskell平台:http://www.haskell.org/platform/ for Mac OS X Lion.我想运行cabal install cabal-install,所以我可以安装quickcheck
在尝试更新时,我得到了这个错误.
$ cabal install cabal-install
Resolving dependencies...
Configuring cabal-install-1.16.0...
Building cabal-install-1.16.0...
Preprocessing executable 'cabal' for cabal-install-1.16.0...
<command line>: cannot satisfy -package-id HTTP-4000.2.3-d6c69f84aec25261a9a3f6946119d9d2
(use -v for more information)
cabal: Error: some packages failed to install:
cabal-install-1.16.0 failed during the building phase. The exception was:
ExitFailure 1
Run Code Online (Sandbox Code Playgroud) 我想要的是看到一个系统的理想框架,该系统具有一组对象(即用户),其中数据包含在数据库中.我被建议有一个User类和一个UserMapper类,这是我对它的外观的理解:
user.class.php
/* The class for constructing any user's information
*/
class User {
protected $userId, $email, $userGroup;
protected function getEmail() {
return $this->email;
}
protected function getUserId() {
return $this->userId;
}
public function __construct($userId, $email, $userGroup) {
$this->userId = $userId;
$this->email = $email;
$this->userGroup = $userGroup;
}
}
class UserMapper {
// database connection
private $db;
public function __construct($db)
{
$this->db = $db;
}
public function findByUserId ($userId) {
$userObject = new User();
$q = $this->db->prepare("SELECT userId, email, userGroup …Run Code Online (Sandbox Code Playgroud) 我已经设置了一个PHP脚本来执行GitHub拉取:
这包含在我的Github文件夹中 /home/mysite/public_html/github
github_pull.php
<?php
echo `git pull 2>&1`;
?>
Run Code Online (Sandbox Code Playgroud)
我的服务器已经拥有SSH公钥,就好像我git pull从终端执行:
ssh username@host.com
cd public_html/github
git pull
Run Code Online (Sandbox Code Playgroud)
这成功(但我必须先输入rsa 密码的密码)更新:不再需要密码(请参阅注释)
但是,当我运行时,github_pull.php我收到以下错误:权限被拒绝(publickey).致命:远程端意外挂断
SSH密钥包含在 /home/mysite/.ssh/id_rsa
我跑的时候
<?php echo `whoami`;
Run Code Online (Sandbox Code Playgroud)
它输出 mysite
我有一个变量...
$whatever = "5865/100";
这是一个文本变量.
我希望它计算5865/100,以便我可以将其添加到其他数字并进行计算.
Number_format不起作用,因为它只返回"5,865".而我希望它返回58.65
我可以...
$explode=explode("/",$whatever);
if(count($explode)=="2") {
$whatever = $explode[0]/$explode[1];
}
Run Code Online (Sandbox Code Playgroud)
但它看起来相当混乱.有更简单的方法吗?
我没有解释清楚.
但我的意思是,如果我有一个ajax脚本通过函数'loadpage('whatever.php')加载DIV元素中页面的内容,而不是手动对所有链接执行此操作,是有一种方法可以让脚本自动使所有常规链接通过该ajax函数加载吗?
就像在Facebook上一样,您的个人资料通过ajax加载,但如果您查看他们的代码,他们只需要定期链接到个人资料.
干杯!
就像你可以在PHP中
<?php
function whatever($var='') {
}
?>
Run Code Online (Sandbox Code Playgroud)
你能用javascript做到吗?
我想要一个可以检测jquery是否调用的脚本
如果没有,它会显示页面+布局,如果没有,它只是内容(但这是无关紧要的)
但是,是的,一种检测它是否被jquery load-ajax调用或直接请求的方法.
干杯!
我想获取vBulletin的注销哈希,以便我可以直接从我的主站点链接到注销位.
我怎样才能做到这一点?(在PHP中)
我正在将用户从旧数据库转移到 vBulletin 数据库。
我想要一个脚本来执行此操作,否则将花费很长时间。
我存储了所有用户的密码,就像 md5(password) 一样
但当然,由于盐等原因,这不适用于 vBulletin。
所以我的代码是这样的:
<?Php
mydatabase_connect();
$select=mysql_query("SELECT * from `users`");
while($user=mysql_fetch_array($select)) {
forum_connect();
$check=mysql_query("SELECT * from `user` where `username` = '{$user[username]}'");
if(mysql_num_rows($check)>="1") {
echo "fail";
}else{
$insert=mysql_query("INSERT into `user` SET `username` = '{$user[username]}', `password` = '{$user[password]}', `email` = '{$user[email]}'");
if($insert) {
echo 'success';
}else{
echo 'fail';
}
}
mydatabase_connect();
}
?>
Run Code Online (Sandbox Code Playgroud)
我如何更改它以与 vBulletin 一起使用 - 这样我就可以设置 vBulletin 用户。password字段和 vBulletin 用户。salt正确。请记住我的 $user[password] 或users. password存储为真实文本密码的 md5 哈希值。
谢谢!
我已经用PHP编程了很多年,但是最近才开始用类编程.我有以下 - 基本 - 用户类如下:
<?php
/* The class for constructing any user's information
*/
class User {
protected $userId, $email, $userGroup;
protected function getEmail() {
return $this->email;
}
protected function getUserId() {
return $this->userId;
}
protected function getUserGroup() {
return $this->userId;
}
public function __construct($userId='') {
if($userId) {
$select = mysql_query("SELECT userId, email, user_group FROM user WHERE userId = '$userId'");
while($user==mysql_fetch_array($select)) {
$this->email = $user[email];
$this->userId = $userId;
$this->userGroup = $user[user_group];
}
}
}
}?>
Run Code Online (Sandbox Code Playgroud)
所以我明白我可以做到以下几点
<?php
$user = …Run Code Online (Sandbox Code Playgroud)