Adobe Released AIR 3.6 beta, Flash Player 11.6 beta,AIR SDK with ASC 2.0

Categories: Flex; Tagged with: ; @ January 17th, 2013 11:25

Updates to AIR 3.6 beta, Flash Player 11.6 beta, and AIR SDK with ASC 2.0 have been released to Adobe Labs for download:

AIR 3.6 beta – Deliver games, content and apps to multiple platforms using a common codebase. This update adds packaging and loading for multiple SWFs.

Flash Player 11.6 beta – This update includes graphics data query and full screen permission dialog UI improvements. Access a preview of the Stage3D extended profile

AIR SDK with ASC 2.0 – Preview 5 versions of AIR 3.4 SDK with ASC 2.0, AIR 3.5 SDK with ASC 2.0, and a pre-release version of AIR 3.6 SDK with ASC 2.0 Preview 5 are now available. These previews contain bug fixes as outlined in the updated release notes.

Here is a good post about ASC 2.0 : Introducing ASC 2.0

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;
        }

TSQL: Converting/Casting String between Unicode and Non-Unicode

Categories: Database; Tagged with: ; @ January 16th, 2013 12:04

I got an Error in a SSIS package:

 cannot convert between unicode and non-unicode string data types.

We can use one component called ‘DataConversion’, but I think directly convert the type in SQL will be better.

SQL:

DECLARE @str_unicode NVARCHAR(32);
SET @str_unicode = NCHAR(9734);
SELECT @str_unicode

— Using CAST
SELECT CAST(@str_unicode AS VARCHAR(32))

— Using Convert
SELECT CONVERT(VARCHAR(32), @str_unicode)

Result:

image

TSQL: Get the length of String including/excluding trailing spaces

Categories: Database; Tagged with: ; @ January 16th, 2013 11:53

LEN (Transact-SQL)
Returns the number of characters of the specified string expression, excluding trailing blanks.
Note: To return the number of bytes used to represent an expression, use the DATALENGTH function.

http://msdn.microsoft.com/en-us/library/ms190329(SQL.90).aspx

DATALENGTH (Transact-SQL)

Returns the number of bytes used to represent any expression.

 

SQLs:

DECLARE @STR VARCHAR(32);
SET @STR = ’12    ‘
SELECT LEN(@STR)  — 2
SELECT DATALENGTH(@STR); –6

Newer Posts <-> Older Posts



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