小编use*_*104的帖子

使用Swift邮件程序发送邮件时出现错误501

<?php

  require_once '../plugin/swift/lib/swift_required.php';

  // Create the Transport
  $transport = Swift_SmtpTransport::newInstance('pod51003.outlook.com',587,'tls')
    ->setUsername('user@connect.polyu.hk')
    ->setPassword('pw')
    ;

  // Create the Mailer using your created Transport
  $mailer = Swift_Mailer::newInstance($transport);

  // Create a message
  $message = Swift_Message::newInstance('Wonderful Subject')
    ->setFrom(array('john@doe.com' => 'John Doe'))
    ->setTo(array('foodil@hotmail.com', 'foodil@yahoo.com.hk' => 'A name'))
    ->setBody('Here is the message itself')
    ;

  // Send the message
  $result = $mailer->send($message);

  printf("Sent %d messages\n", $result);

?>
Run Code Online (Sandbox Code Playgroud)

结果是:

Fatal error: Uncaught exception 'Swift_TransportException' 
with message 'Expected response code 250 but got code "501", with message "501 5.5.4 Invalid …

php

4
推荐指数
1
解决办法
9758
查看次数

带有消息'没有活动事务'的未捕获异常'PDOException'?

这是我用来插入记录的代码.每当有插入错误时,即使我已经回滚,订户表auto-inc号码仍然会增加?问题是什么? 我只是想在发生错误时不添加自动增量编号.非常感谢您的帮助.

$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
$conn->beginTransaction();
try {

    $email = $_POST['Email'];
    $FirstName = $_POST['FirstName'];
    $LastName = $_POST['LastName'];


    $query="INSERT INTO subscriber (Email,FirstName,LastName,CreateDate) VALUES (?,?,?,CURDATE())";
    $stmt = $conn->prepare($query);


    $stmt->bindParam(1, $email , PDO::PARAM_STR);
    $stmt->bindParam(2, $FirstName, PDO::PARAM_STR);
    $stmt->bindParam(3, $LastName, PDO::PARAM_STR);
    $stmt->execute();
    $conn->commit();

}
catch(PDOException $e)
    {
    $conn->rollBack();
    die ($e->getMessage()."<a href='addSub.php'>Back</a>");
    }

$conn->beginTransaction();
try {
    $userID = $_SESSION['username'];
    $query="INSERT INTO list_sub (SubID,ListID) VALUES ('',$_SESSION[ListID])";
    $stmt = $conn->prepare($query);
    $stmt->execute();
    $conn->commit();

}
catch(PDOException $e)
    {
    $conn->rollBack();
    die ($e->getMessage()."<a href='addSub.php'>Back</a>");
    }

$conn = null;}
Run Code Online (Sandbox Code Playgroud)

php mysql pdo

4
推荐指数
2
解决办法
3万
查看次数

使用Javascript/Jquery禁用桌面Web浏览器中页面的缩放

可能重复:
如何在所有现代浏览器中检测页面缩放级别?

var obj=document.body;  // obj=element for example body
// bind mousewheel event on the mouseWheel function
if(obj.addEventListener)
{
    obj.addEventListener('DOMMouseScroll',mouseWheel,false);
    obj.addEventListener("mousewheel",mouseWheel,false);
}
else obj.onmousewheel=mouseWheel;

function mouseWheel(e)
{
    // disabling
    e=e?e:window.event;
    if(e.ctrlKey)
    {
        if(e.preventDefault) e.preventDefault();
        else e.returnValue=false;
        return false;
    }
}
Run Code Online (Sandbox Code Playgroud)

我正在开发一个Web应用程序,如果用户放大/缩小,所有ui元素的顺序将不正确.那么,有什么方法可以阻止它吗?我想到了一些方法,但它有可能吗?

1)获取用户的屏幕分辨率.当窗口大小改变(宽度或高度)时,将窗口宽度/高度返回到屏幕宽度/高度.

2)将鼠标滚动事件或键盘事件绑定为空.(请参阅上面的演示代码),但如果用户单击浏览器并选择放大,该怎么办?

谢谢

javascript jquery screen

4
推荐指数
1
解决办法
4万
查看次数

在IE9 +上显示base64 pdf的解决方法

我想将PDF转换为base64并在浏览器上显示.

问题是,以下代码适用于Firefox和Chrome

<iframe src="data:application/pdf;base64,encodeString></iframe>
Run Code Online (Sandbox Code Playgroud)

但不是在IE 9 +中,假设用户正在使用adobe reader插件,是否有任何jquery插件/解决方法允许在iframe上嵌入base64 pdf?谢谢

pdf iframe base64 internet-explorer cross-browser

4
推荐指数
2
解决办法
2万
查看次数

为什么mysqli open transcation会锁定数据库?

我试图使用mysqli插入数据,并有一些奇怪的行为.例如,当我第一次使用$mysqli->autocommit(FALSE);并花费几分钟来运行我的PHP并等待提供的查询时,它将保持数据库直到$mysqli->commit();,因此我无法执行任何其他数据库操作.当我检查phpmyadmin中的状态时,它显示即将到来的SQL查询状态是Waiting for table metalock,如何修复它?谢谢

/* Insert log Query */
function putLog($query){
global $mysqli,$ip,$browser,$dateLog,$isQuerySuccess;
$isQuerySuccess = $mysqli->query("INSERT INTO DPS_Log_$dateLog (PageID,FunctionID,ActionID,UserID,UserIP,UserInfo,LogType,Remark,LogTime) VALUES (15,20,25,25,'$ip','$browser',1,'$query',NOW())") ? true : false;
}

/* Start DB connection */
$mysqli = new mysqli(DATABASEIP, DBUSER, DBPWD, DATABASE,PORT);

if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$mysqli->autocommit(FALSE);

$isQuerySuccess = true;

putLog ("Fail to delete: $folderPath.$item");

$isQuerySuccess ? $mysqli->commit() : $mysqli->rollback();
$mysqli->close();
Run Code Online (Sandbox Code Playgroud)

更新:我终于发现问题是由另一个查询引起的.简而言之,上面的编码是插入日志,而下面的查询是检查用户登录时是否存在日志表.问题是,当我打开一个事务并尝试记录操作(操作需要> 30秒)的结果时,我无法执行下面的查询(等待表metalock)所以整个系统一直保持到操作完成,如何修理它?谢谢

$sql = "
CREATE TABLE IF NOT EXISTS `$logTableName` …
Run Code Online (Sandbox Code Playgroud)

php mysql mysqli transactions

4
推荐指数
1
解决办法
1421
查看次数

为什么Tab主机不在android中显示图标?

这是设置tabhost的代码,但是有两个问题

  1. 如果文本太长,文本将转到下一行,我可以减小大小并将其强制为单行吗?
  2. 所有图标都不显示,即使我确定图像src是正确的

    public class MainActivity extends FragmentActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            FragmentTabHost tabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
    
            tabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
            tabHost.addTab(tabHost.newTabSpec("restaurant").setIndicator("Restaurant",getResources().getDrawable(R.drawable.food)),PlaceList.class, null);
            tabHost.addTab(tabHost.newTabSpec("attraction").setIndicator("Attraction",getResources().getDrawable(R.drawable.view)), PlaceList.class, null);
            tabHost.addTab(tabHost.newTabSpec("map").setIndicator("Map",getResources().getDrawable(R.drawable.map)),Map.class,null);
            tabHost.addTab(tabHost.newTabSpec("planner").setIndicator("Planner",getResources().getDrawable(R.drawable.plan)),Planner.class, null);
        }
     }
    
    Run Code Online (Sandbox Code Playgroud)

tabs android android-layout android-tabhost fragment-tab-host

4
推荐指数
1
解决办法
2593
查看次数

在android中绘制图片

我正在开发一个可以在其上绘制线条的自定义图像视图,问题是绘图区域大小与位图大小不完全相同.

例如,在另一个应用程序中,它看起来像:

在此输入图像描述

但是,在我的应用程序中,它看起来像

在此输入图像描述

这是我的程序,似乎位图不适合画布.谢谢你的帮助

   public class DrawingView extends View {

    //drawing path
    private Path drawPath;
    //drawing and canvas paint
    private Paint drawPaint, canvasPaint;
    //initial color
    private int paintColor = 0xFF660000;
    //canvas
    private Canvas drawCanvas;
    //canvas bitmap
    private Bitmap canvasBitmap;


    public DrawingView(Context context, AttributeSet attrs){
        super(context, attrs);
        setupDrawing();
    }

    //setup drawing
    private void setupDrawing(){

        //prepare for drawing and setup paint stroke properties
        drawPath = new Path();
        drawPaint = new Paint();
        drawPaint.setColor(paintColor);
        drawPaint.setAntiAlias(true);
        drawPaint.setStrokeWidth(15.0f);
        drawPaint.setStyle(Paint.Style.STROKE);
        drawPaint.setStrokeJoin(Paint.Join.ROUND);
        drawPaint.setStrokeCap(Paint.Cap.ROUND);
        canvasPaint = new Paint(Paint.DITHER_FLAG);
    } …
Run Code Online (Sandbox Code Playgroud)

android canvas android-layout android-imageview

4
推荐指数
1
解决办法
9900
查看次数

通过codeigniter中的查询来逃避订单

这是SQL查询运行:

SELECT * FROM (`news`) WHERE `country` IS NULL AND `region` IS NULL ORDER BY IFNULL(update_date, `create_date)` DESC
Run Code Online (Sandbox Code Playgroud)

你可能会注意到create_date有一些格式错误,我想禁用转义,但即使我在order_by函数后添加false也没有效果.怎么解决?非常感谢

 $this->db->select('*');
 $this->db->from('news');
 $this->db->where($data);
 $this->db->order_by('IFNULL(update_date,create_date)', 'DESC', false);
 $query = $this->db->get();
 return $query->result_array();
Run Code Online (Sandbox Code Playgroud)

php mysql sql codeigniter

4
推荐指数
1
解决办法
1555
查看次数

亚马逊sns(推送通知)不会发送到IOS应用程序

最近应用程序无法接收通知,android端工作正常,但ios一个失败

所以这就是我的尝试:

1) generate token from apple apn service
2) create the endpoint at amazon backend
3) publish the message at amazon backend
4) it does not receive message and the endpoint will go to disabled after a while.
Run Code Online (Sandbox Code Playgroud)

我检查了以下内容:

1) try serveal ios device , including iphone/ ipad/ipod touch also the same result
2) checked the secret key/ platform arn it is matched
3) created another platform ARN but still the same.
Run Code Online (Sandbox Code Playgroud)

那么,我应该继续调试哪个方向,例如推送通知证书?我应该检查哪部分编码,因为它之前有效,但最近才失败.

非常感谢.

push-notification amazon-web-services apple-push-notifications ios

4
推荐指数
1
解决办法
6590
查看次数

在PHP上传时,$ _FILES为空

我使用dropzone.js使用JQuery处理前端的上传部分.

http://www.dropzonejs.com/

我的测试用例是:

上传34 MB文件.工作正常...
上传一个27 MB的文件.工作正常...
上传两个文件,每个文件是5 MB.工作正常...
上传两个文件,34 MB + 27 MB.失败,$_FILES是一个空数组

这是JQuery代码:

<script>
    $(document).ready(function () {
        Dropzone.options.myAwesomeDropzone = {
            autoProcessQueue: false,
            url: '<?= site_url("admin/video/upload"); ?>',
            addRemoveLinks: true,
            previewsContainer: ".dropzone-previews",
            uploadMultiple: true,
            parallelUploads: 50,
            maxFilesize: 500, //500MB
            acceptedFiles: 'video/*',
            maxFiles: 100,
            init: function () {
                var myDropzone = this;

                myDropzone.on("success", function (file, response) {
                    $("#success, #fail").hide();
                    $("#" + response).show();
                });

                myDropzone.on("maxfilesexceeded", function (file) {
                    this.removeFile(file);
                });

                $("#submit-all").click(function (e) {
                    e.preventDefault();
                    e.stopPropagation();
                    myDropzone.processQueue();
                });
            } …
Run Code Online (Sandbox Code Playgroud)

php upload jquery file-upload file

4
推荐指数
1
解决办法
438
查看次数