WordPress-Post2Qzone 1.2.2: 同步每一次更新到QZone

Categories: Development NotesWordPress; Tagged with: ; @ January 19th, 2013 14:02

上一周,  收到一条关于Post2Qzone的评论:

你好,我想问一下,我用了你的post2Qzone插件后,更新了一篇文章,同步到了我设置好的空间日志里,然后我又设置了个另一个QQ号码,然后又更新了这篇文章,结果没同步到另一个QQ空间日志里呢?然后我把数据库postmeta表里post_id列为该日志id并且meta_key为postToQzone这一列中的meta_value手动改成false后再更新此文章,结果还是没有同步到我另一个QQ空间里,我想知道这是为什么。

一开始我没太理解, 我想可能是他的第二个账户没有设置妥当. 于是发邮件去让他从新测试.

我又测试了下:

我发布一篇新的文章,可以同步到我的QQ空间里,如果我发布了这篇文章后,我又重新设置了一个QQ号码,然后编辑数据库postmeta表里post_id列为该日志id并且meta_key为posttoqzone这一列中的meta_value修改成false后,然后编辑这篇文章,更新这篇文章的时候,就不会同步到我现在设置的QQ号的空间里了,QQ号码设置没问题,邮箱的pop3/smtp服务我也打开了。

如果发布新文章的话,我重新设置的这个QQ号码也可以发布的。不知道为什么。

我想做的事情是,发布新文章的时候该文章会同步到我一个QQ空间里,我又设置了一个别的QQ号码,更新这篇文章的时候,会自动同步到我这个QQ空间里。

就是想要同一篇文章没一次更新的时候都会同步到设置的QQ空间里。不知道这个功能好不好实现呢。

 

最后一句话点明了需求:同一篇文章没(每)一次更新的时候都会同步到设置的QQ空间里.

 

所以有两点:

1. Metadata的更新/检查 有bug.

2. 增加新功能: 同步每次更新(暂时没有配置页面, 需要手动修改代码).

 

开启同步每次更新的方法:

编辑插件:post2qzone/post2qzone.php

image

C#: Update DatagridView Cell style based on row data

Categories: Development Notes; Tagged with: ; @ January 16th, 2013 17:58

Requirement

Change the cell background colour to red when the data…

image

Solution

Listening to the DataGridView.CellFormatting Event, based on the data, update the cell style in runtime.

Details

1. Add Listener:

 this.dataGridViewForLogs.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dataGridViewForLogs_CellFormatting);

2. The hanlder:

        private void dataGridViewForLogs_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value == null)
            {
                return;
            }

            if (dataGridViewForLogs.Columns[e.ColumnIndex].Name.Equals("result"))
            {
                String logResult = e.Value.ToString();
                if (logResult != null && logResult.Contains("FAIL"))
                {
                    e.CellStyle.BackColor = Color.Red;
                    e.CellStyle.ForeColor = Color.White;
                    e.CellStyle.SelectionBackColor = Color.Navy;
                    return;
                }
            } 
            e.CellStyle.BackColor = Color.White;

        }

 

links:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellformatting.aspx

C#: Using DataGridView

Categories: Development Notes; Tagged with: ; @ January 16th, 2013 17:34

Requirement:

Display data in datagrid.

image

Solution:

Use C# DataGridView, and put all objects in one list, assign the list as the datagrid’s DataSource.

Details

 

0. Prepare the Class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SSISHelper.com.liguoliang.ssis.util
{

    class LogResult
    {
        public LogResult(String result, TimeSpan timeSpan, DateTime dateTime, String logName)
        {
            this.result = result;
            this.timeSpan = timeSpan;
            this.dateTime = dateTime;
            this.logName = logName;
        }
            
        public String result { get; set; }
        public TimeSpan timeSpan { get; set; }
        public DateTime dateTime { get; set; }
        public String logName { get; set; }
    }
}

1.  Drag one DataGridView, create columns:

            this.tabPage2.Controls.Add(this.dataGridViewForLogs);
this.dataGridViewForLogs.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.result,
            this.TimeSpan,
            this.DateTime,
            this.LogFile});

this.dataGridViewForLogs.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.result,
            this.TimeSpan,
            this.DateTime,
            this.LogFile});

2. Set the datasource:

        private void btnAnalysisLogs_Click(object sender, EventArgs e)
        {
            dataGridViewForLogs.DataSource = LogUtils.analysisLogs(textBoxPath.Text);
        }

// Generate the list
 public static ArrayList analysisLogs(String rootPath)
 {
            ArrayList listLogResults = new ArrayList();

            
            foreach (String pathLogFile in logFiles)
            {
              LogResult logResult = new LogResult(strLogResult, span, File.GetLastWriteTime(pathLogFile), diLog.Name);
                listLogResults.Add(logResult);
            }

            return listLogResults;
        }

How to get exit code in CDM

Categories: Scripts; Tagged with: ; @ January 14th, 2013 15:18

Requirement:

Need to catch the exit code, handle the Error based on the exit code.

Solution:

Use %ErrorLevel% – Almost all applications will set an exit code when complete (by conversion, 0 means successful).

 

Example 1:
copy file1.txt file3.txt
ECHO ...%ErrorLevel%

copy fileNotExisting.txt f.txt
ECHO %ErrorLevel%

Output:

“1 file(s) copied”
0

“The system cannot find the file specified.”
1

 

Example 2:

SET SSIS_EXIT_CODE=%ErrorLevel%
copy "%PKG_PATH%\Logs\….dtsx.log" ..
IF %SSIS_EXIT_CODE% NEQ 0 (
    EXIT /B %SSIS_EXIT_CODE%
)

 

Links:

http://ss64.com/nt/errorlevel.html
http://ss64.com/nt/exit.html

How to check the exit code of the last command in batch file?

AutoSys Job multiple dependencies issue: s(1) & s(2) & s(3) job triggered multiple time

Categories: Development Notes; Tagged with: ; @ January 4th, 2013 19:15

Problem:

I got 4 jobs: 1, 2, 3, 4.

2’s condition: s(1); 3’s condition: s(2); 4’s condition: s(1) & s(2) & s(3)

all these jobs are daily jobs

the first day is ok. the second day, the 4th job triggered mutilple times:

I think when 1 success, because the status of 2 and 3 are still ‘success'(the last days status), so the job 4 triggered,

then 2 success, 4 triggered again…

but I only want these jobs run in the same period.

Solution:

1. the first solution I can found is using ‘Look-Back Dependencies’:

Example: Define Starting Conditions Based on Job Success in a Given Duration
This example (specified in the job definition for JobA) runs JobA if JobB has completed successfully in the last 12 hours:
condition: success(JobB,12)
Example: Define Starting Conditions Based on the Status of Multiple Jobs in a Given Duration
This example (specified in the job definition of JobA) runs JobA if JobB has failed in the last 30 minutes and JobC has completed successfully on external instance XYZ in the last 90 minutes:
condition: failure(JobA,00.30) AND success(JobC^XYZ,01.30)

This should can work, but I based on my test, seems still cannot fix my issue.

http://stackoverflow.com/questions/10825544/autosys-r11-job-dependency-with-dependent-job-run-time-condition

2.  Using Box.

Put all these jobs in one Box, and when the Box is triggered, all the jobs’s status  in this box will be reset. 

Newer Posts <-> Older Posts



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.