小编Mal*_*ist的帖子

如何在程序执行之间保留数据

我在HP-UX机器上运行perl脚本.该脚本将每15分钟执行一次,并且需要将其结果与上次执行的结果进行比较.

我需要在执行之间存储两个变量(IsOccuring和ErrorCount).做这个的最好方式是什么?

编辑说明:
它仅将最近的执行与当前执行进行比较.
重新启动之间的值是否丢失无关紧要.
触摸文件系统几乎是不受限制的.

perl hp-ux

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

卷曲就像在Erlang中使用一样

我正在尝试将一些代码从shell脚本移动到erlang以获取新的内部工具.

当前的shell脚本调用curl,如下所示:

curl \
  --header "Content-type: text/xml; charset=utf-8" \
  --data @$OTAR_SOAP_FILE \
  --output $OTAR_OUT_FILE \
  --stderr $OTAR_ERR_FILE \
  --insecure \
  $OTAR_URL 
Run Code Online (Sandbox Code Playgroud)

我希望能够使用inets的库从erlang中做同样的事情.

这是我到目前为止所做的,但它不起作用:

stress(Url, Message, ConcurrentAttempts, Attempts) ->
    setup_connection(),
    {ok, {{Version, ResponseCode, ReasonPhrase}, Headers, Body}} = 
        httpc:request(get, {Url, [], "text/xml", Message}).
Run Code Online (Sandbox Code Playgroud)

在这种情况下,URL与$ OTAR_URL相同,Message是$ OTAR_SOAP_FILE的内容.

我如何通过curl传递来自erlang中soap文件的OTAR_URL数据?

erlang curl

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

为什么我的循环使用100%CPU并且永远不会结束?

我有这个方法:

    private delegate void watcherReader(StreamReader sr);
    private void watchProc(StreamReader sr) {
        while (true) {
            string line = sr.ReadLine();
            while (line != null) {
                if (stop) {
                    return;
                }
                //Console.WriteLine(line);
                line = stripColors(line);
                txtOut.Text += line + "\n";

                line = sr.ReadLine();
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

它从进程(cmd.exe)读取流.当用户关闭cmd.exe窗口时,它会导致CPU使用率跳至100%.在使用调试器时,我看到它在sr.ReadLine()上停止并且永远不会返回.因为它正在观察StandardErrorStream和StandardOutputStream,所以它在两个核心上都使用100%.

如果需要,这里有一些项目代码.

    [DllImport("User32")]
    private static extern int ShowWindow(int hwnd, int nCmdShow);   //this will allow me to hide a window

    public ConsoleForm(Process p) {
        this.p = p;
        p.Start();
        ShowWindow((int)p.MainWindowHandle, 0);   //0 means to hide the window.

        this.inStream = …
Run Code Online (Sandbox Code Playgroud)

c# delegates readline streamreader

0
推荐指数
2
解决办法
3914
查看次数

C#中的工厂模型而不使用默认构造函数

我一直在使用工厂模型创建子表单以添加到MDI表单.这是我一直在使用的代码:

    /// <summary>
    /// This uses the Factory Model to create the child node and then add it to the MDI Parent (this)
    /// </summary>
    /// <param name="childName">String class name of the child, i.e. RentalEase.PropertyGrid must extend Form or SingleInstance</param>
    /// <param name="singleInstance">bool If this class is to be a single instance and restricted to only on instance. Must extend SingleInstance</param>
    public void createChild(string childName, bool singleInstance) {
        if (singleInstance) {
            try {
                BaseAndSingleInstanceForm f = BaseAndSingleInstanceForm.getInstanceByType(this, Type.GetType(childName));
                    f.MdiParent = …
Run Code Online (Sandbox Code Playgroud)

c# mdi winforms

0
推荐指数
1
解决办法
870
查看次数

如何解决这个SocketException

我有一个循环打开一个套接字,作用于套接字,然后关闭套接字并重新启动.但是,在我得到的第二次迭代中SocketException,通常只允许使用每个套接字地址(协议/网络地址/端口).
但是,套接字应该关闭,netstat -a并不表示我正在侦听该端口或任何东西.抛出异常的代码是:

_bindedLocalSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_bindedLocalSocket.Bind(new IPEndPoint(Util.ChannelProfileToListeningAddress(_profile), _profile.ListenPort));
_bindedLocalSocket.Listen(30);
_bindedLocalSocket.BeginAccept(new AsyncCallback(OnRequested), null);
Run Code Online (Sandbox Code Playgroud)

但是,我认为罪魁祸首不是代码,就在我开始使用该代码之前,在我尝试关闭连接之前,我得到了这个:

An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
   at Poderosa.PortForwarding.SynchronizedSocket.EndReceive(IAsyncResult ar)
   at Poderosa.PortForwarding.Channel.OnSocketData(IAsyncResult result)

一旦我关闭程序并再次运行它,它可以使第一个连接正常,第二个连接正常(SocketException).有谁知道如何解决这个问题?

c# socketexception .net-3.5

0
推荐指数
1
解决办法
7321
查看次数

如何打开锁定的mdb文件?

我有一个锁定mdb的数据库,所以我想备份.但是我正在使用的工具(我有源)在备份之前打开文件并发现它已被锁定.

有没有办法我可以打开它只读目的?

作为参考,该工具使用C#和.NET 2.0(但可以更新为3.5).

.net c# database ms-access

0
推荐指数
1
解决办法
4131
查看次数

如何判断我的表单是否显示在屏幕之外?

所以我有两种形式,mainform和extraform.
当mainform初始化时,extraform设置总是移动到mainform的右侧
有时mainform占用两个监视器并且extraform被推离屏幕永远不会再被看到.我想尽可能防止这种情况发生.我怎么能这样做?它必须支持双显示器,它们之间可能有或没有距离(即屏幕1是屏幕2左侧的20px).

我怎样才能做到这一点?

c# screen-positioning .net-3.5 winforms

0
推荐指数
1
解决办法
806
查看次数

传递密码是否可以接受?

我有一个网站,要求用户使用用户名和密码进行身份验证.我想使用SSL,但我没有SSL证书.但是,我认为其他一些事情我觉得还可以.

我的网站主要是基于AJAX的,需要 JavaScript,否则什么都行不通.

当用户尝试登录时,我使用AJAX查询数据库以查找该用户名的盐,如果没有找到,则返回随机盐(以防止人们知道是否存在具有该用户名的用户) .然后,使用JavaScript的MD5函数,我将密码哈希并加密密码4K次(就像Linux使用MD5进行密码哈希)客户端,然后我以明文形式将该哈希传递给服务器.然后,将对此哈希进行多次哈希处理,并使用数据库中的内容进行检查.

这样安全吗?如果没有,我怎样才能保证它的安全而不需要为大多数内部网站提供SSL证书?

security ssl md5

0
推荐指数
1
解决办法
316
查看次数

将行插入具有预定义标识的表中

我正在将数据从旧数据库传输到新数据库,并且在将数据库插入新数据库时需要保留旧数据库中的ID.但是,它不起作用.

这是我的查询:

SET IDENTITY_INSERT RentalEase.dbo.tblTenant ON
INSERT INTO RentalEase.dbo.tblTenant SELECT [ID]
    ,1
      ,[PropertyID]
    ,0
      ,[UnitID]
      ,[TenantName]
      ,[Sex]
      ,[BirthDate]
      ,[SSNO]
      ,[CoTenant1]
      ,[CoTenant1Sex]
      ,[CoTenant1BirthDate]
      ,[CoTenant1SSNO]
      ,[CoTenant2]
      ,[CoTenant2Sex]
      ,[CoTenant2BirthDate]
      ,[CoTenant2SSNO]
      ,[CoTenant3]
      ,[CoTenant3Sex]
      ,[CoTenant3BirthDate]
      ,[CoTenant3SSNO]
      ,[CarColor]
      ,[CarModel]
      ,[CarYear]
      ,[CarState]
      ,[CarPlateNumber]
      ,[Memo]
      ,[Address1]
      ,[Address2]
      ,[Address3]
      ,[Address4]
      ,[Phone]
      ,[ReferBy]
      ,[BeginDate]
      ,[NoticeGiven]
      ,[LeaseMonth2Month]
      ,[LeaseEnds]
      ,[DepositPaid]
      ,[DepositRefundable]
      ,[RefundMemo]
      ,[RentDueDay]
      ,[Charge1]
      ,[Charge1Amount]
      ,[Charge2]
      ,[Charge2Amount]
      ,[Charge3]
      ,[Charge3Amount]
      ,[Charge4]
      ,[Charge4Amount]
      ,[ContractText]
      ,[BalanceDue]
  FROM [oldTables].[dbo].[tblCurrentTenant]

  SET IDENTITY_INSERT RentalEase.dbo.tblTenant OFF
Run Code Online (Sandbox Code Playgroud)

SQL Server抱怨"只有在使用列列表并且IDENTITY_INSERT为ON时才能指定表RentalEase.dbo.tblTenant中的标识列的显式值".

我需要做些什么才能让它发挥作用?

sql t-sql sql-server

0
推荐指数
1
解决办法
627
查看次数

如何判断集合何时被编辑?

我有一个名为Items的公共属性,它是一个List.我想告诉它什么时候被改变了.我怎样才能做到这一点?

例如,如果调用Items.Add,我希望能够调用UpdateInnerList.

我怎样才能做到这一点?

c# .net-3.5 winforms

0
推荐指数
1
解决办法
73
查看次数

为什么我没有自己的页面 - drupal hook_menu

我有一个我正在创建的模块,其目的是导入特定类型的数据,并根据该数据将其附加到节点.

为此,我需要创建一个页面,让用户输入存储数据的位置,以便系统导入.

为此,我正在挂钩hook_menu来创建这样的页面:

function lbar_image_importer_menu(){
    $items = array();
    $items[] = array(
        'path' => "admin/content/lbar_image_importer",
        'title' => "Import LBar Images",
        'description' => "Innitiate an importation of LBar images from a ZIP file.",
        'page callback' => 'drupal_get_form',
    );
    return $items;
}
Run Code Online (Sandbox Code Playgroud)

我通过挂钩到hook_form_alter函数来填充它将使用的表单,如下所示:

function lbar_image_importer_form_alter(&$form, &$form_state, $form_id) {   
    $form['admin']['lbar_zip_loc'] = array(
        '#type' => 'textfield',
        '#title' => 'Location of LBar Zip file: ',
        '#description' => 'This is where one or many of the lbar zip files are located. If this is a file, it …
Run Code Online (Sandbox Code Playgroud)

drupal hook-menu hook-form-alter

0
推荐指数
1
解决办法
1410
查看次数

数组语法的Javascript对象

任何人都可以告诉我我的语法有什么问题.我有一个数组javascript对象的声明:

$.fn.eCardify.frames = {
    nonie: {
        {flip_over_envelope, flip_over_envelope},
        {open_envelope, open_envelope},
        {show_card, show_card},
        {open_card, open_card}          
    },
    ie: {
        {flip_over_envelope_ie, flip_over_envelope_ie},
        {open_envelope_ie, open_envelope_ie},
        {show_card_ie, show_card_ie},
        {open_card_ie, open_card_ie}
    }
}
Run Code Online (Sandbox Code Playgroud)

而我正试图以这种方式访问​​它:

function step(){
    if($.fn.eCardify.settings.is_ie){
        $.fn.eCardify.frames.ie[$.fn.eCardify.frame]();
    }else{
        $.fn.eCardify.frames.nonie[$.fn.eCardify.frame]();
    }
    $.fn.eCardify.frame++;
}
Run Code Online (Sandbox Code Playgroud)

但是,chrome(可能还有其他浏览器)并不喜欢我的数组声明.它给了我Uncaught SyntaxError: Unexpected token {数组声明的第二行.

我究竟做错了什么?

javascript

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