小编Mic*_*tta的帖子

这个无效指针在哪里?

我有以下代码(我检查objCur在免费之前不是Nil}:

try
  objCur.Free;
Except on E:Exception do
  begin
    OutputDebugString(PChar('Exception '+E.Message));
    Assert(False);
  end;
end;
Run Code Online (Sandbox Code Playgroud)

它报告此异常消息:

指针操作无效.objCur是TXX_TEA类型.
objCur:TXX_TEA;

在TXX_TEA.Destroy中我有以下代码

destructor TXX_TEA.Destroy;
begin
  OutputDebugString(PChar('Inside Destroy'));
  ...
  inherited;
  OutputDebugString(PChar('End of Destroy'));
end;
Run Code Online (Sandbox Code Playgroud)

在debugView中,我看到以下消息:

内部毁灭
...... 毁灭
结束

例外:无效的指针操作

我知道objCur.Free调用TXX_TEA.Destroy,但它看起来TXX_TEA.Destroy执行没有错误.那么我应该在哪里跟踪这个无效的指针操作?

delphi free pointers

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

无状态模式如何影响Play中的安全性!框架?

Play中的无状态操作模式!据说框架不如有状态模式安全.它如何影响Play框架,是否有可能改善关键公共Web应用程序的安全性缺陷?

security playframework

3
推荐指数
1
解决办法
2130
查看次数

警告:匹配字符串时,模式匹配重叠

我想在Haskell中创建一个简单的url路由,并且无法绕过警告:

Warning: Pattern match(es) are overlapped
             In a case alternative: "/" -> ...
Ok, modules loaded: Main.
Run Code Online (Sandbox Code Playgroud)

片段:

{-# LANGUAGE OverloadedStrings #-}
import Network.Wai
import Network.Wai.Handler.Warp (run)
import Network.Wai.Middleware.Debug (debug)
import Network.HTTP.Types (statusOK, status404)
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L
import Data.ByteString.Char8 (unpack)
import Data.ByteString.Lazy.Char8 (pack)
import qualified Data.Text.Lazy as T
import Control.Monad.IO.Class (liftIO, MonadIO)

application req = do
  case unpack $ rawPathInfo req of
    "/items" -> itemsJSON 
    "/" -> indexPage
    _ ->  return $ responseLBS …
Run Code Online (Sandbox Code Playgroud)

haskell

3
推荐指数
1
解决办法
690
查看次数

我可以将我的代码组合成某种"全球活动"吗?

Android上是否有任何全局活动,我将我的代码放在一个活动中,它会影响我项目中的所有活动?这种情况发生在我身上,因为相同的代码是在多个活动中编写的KeyEvent.KEYCODE_BACK

例如,我在这里使用:

public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_BACK)) {
            try {
                final Intent itnt_BackServices = new Intent(this,
                        BackServices.class);
                AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
                alertbox.setTitle("Touch signs");
                alertbox.setMessage("Do you want to quit!");
                alertbox.setPositiveButton("Yes",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface arg0, int arg1) {
                                stopService(itnt_BackServices);
                                mPlayer.stop();

                                finish();
                            }
                        });
                alertbox.setNegativeButton("No",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface arg0, int arg1) {
                            }
                        });
                alertbox.show();
            } catch (Exception e) {
                // TODO: handle exception
            }
        }
        return false;
    } …
Run Code Online (Sandbox Code Playgroud)

android

3
推荐指数
1
解决办法
923
查看次数

C#字符串操作.获取文件名子字符串

myfinename_slice_1.tif
myfilename_slice_2.tif
...
...
myfilename_slice_15.tif
...
...
myfilename_slice_210.tif
Run Code Online (Sandbox Code Playgroud)

在C#中,如何使用字符串操作获取文件索引,如"1","2","15","210"?

c#

3
推荐指数
1
解决办法
1553
查看次数

iPhone相当于Eclipse

什么是开发iPhone应用程序的标准开发人员平台,例如相当于Eclipse?

eclipse iphone

3
推荐指数
1
解决办法
355
查看次数

文本文件只读奇数或偶数行?

我正在尝试编写一个从文本文件中读取的C#程序,并允许您选择要打印的行.

出于某种原因,它只会打印1,3,5等行.

如果我改变写着位int chooseLine = Convert.ToInt32(input);来int chooseLine = (int)Convert.ToInt64(input);,然后只打印偶数行(0,2,4,6等).

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Steve
{
    public static int count = 0;
    public static String[] steveTalk;
    public static void Main()
    {
        using (StreamReader r = new StreamReader("Steve.txt"))
        {
            string line;
            while ((line = r.ReadLine()) != null)
            {
                count++;
            }
        }
        using (StreamReader sr = new StreamReader("Steve.txt"))
        {
            int i = 0;
            steveTalk = new String[count];
            String line;
            while ((line = …
Run Code Online (Sandbox Code Playgroud)

c# file-io

3
推荐指数
1
解决办法
2482
查看次数

在 SQL 表创建过程中还有其他方法可以创建约束吗?

假设我有以下 SQL 语句,使用 Oracle:

drop table department cascade constraints;
drop table facultyStaff cascade constraints;
drop table student cascade constraints;
drop table campusClub cascade constraints;
drop table studentClub cascade constraints;

create table department 
(   code      varchar2(3) primary key,
    name      varchar2(40)  not null,
    chair     varchar2(11));

create table facultyStaff 
(   staffID     varchar2(5) primary key,
    dob     date,
    firstName   varchar2(20),
    lastName    varchar2(20),
    rank        varchar2(10),
    deptCode    varchar2(3),
    constraint rankValue check (rank in ('Assistant', 'Associate', 'Full', 'Emeritus')),
    constraint facultyDeptFk foreign key (deptCode) references department (code));

create table …
Run Code Online (Sandbox Code Playgroud)

sql oracle

3
推荐指数
1
解决办法
418
查看次数

sftp从windows到unix与Python

我试图将我的Windows笔记本电脑中的文件sftp到Unix机箱(Juniper路由器).

我写了一个小脚本,但它说我的远程路径错了.我知道我可能需要添加一些花哨的东西,所以Windows可以翻译nix目录,但我无法在Google上找到它:(

这是脚本:

import paramiko
host = "192.168.1.87"
port = 22
transport = paramiko.Transport((host, port)) 
password = "juniper123"
username = "root"
transport.connect(username = username, password = password)
sftp = paramiko.SFTPClient.from_transport(transport)
filepath = '/balls/test.txt'
localpath = 'C:\Users\python1\test.txt'
sftp.put(filepath, localpath)
sftp.close()
transport.close()
Run Code Online (Sandbox Code Playgroud)

我收到错误:

WindowsError:[错误3]系统找不到指定的路径:'/ balls/test.txt'

python sftp paramiko

3
推荐指数
1
解决办法
3500
查看次数

如果与特定JavaScript代码相对

为什么测试驱动的JavaScript开发(Christian Johansen)的作者使用while语句而不是if下面代码中的语句?

function getEventTarget(event) {
    var target = event.target || event.srcElement;

    while (target && target.nodeType != 1) {
        target = target.parentNode;
    }

    return target;
}
Run Code Online (Sandbox Code Playgroud)

javascript

3
推荐指数
1
解决办法
1038
查看次数