пʼятниця, 22 липня 2011 р.

Visual Studio: find invalid commas in *.js

Use find with regexp:

,[:b\n]*[\]\)\}]

середа, 13 липня 2011 р.

Oracle grant execute


grant execute on aspnetuser.goods_all_get_gtitle_by_gid to pds_sales;

Anonymous PL/SQL block


DECLARE
gid NUMBER(10):=5850802;
title varchar2(80);
BEGIN
IF gid is null THEN
DBMS_OUTPUT.PUT_LINE('GID is null');
ELSE
select t.g_name
into title
from typhoon.tbl_goods_all t
where t.g_id = gid;
DBMS_OUTPUT.PUT_LINE(title);
END IF;
END;

понеділок, 4 липня 2011 р.

C#, read data from Excel (*.xls) file


var file = Server.MapPath("file.xls");
var cs = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;", file);

using(var conn = new OleDbConnection(cs))
{
using(var cmd = new OleDbCommand("SELECT * FROM [Sheet1$]", conn))
{
using(var adapter = new OleDbDataAdapter(cmd))
{
var table = new DataTable();

adapter.Fill(table);

grid.DataSource = table;
grid.DataBind();
}
}
}

пʼятниця, 1 липня 2011 р.

Ext: confirm dialog localization


if (Ext.window.MessageBox) {
Ext.window.MessageBox.prototype.buttonText = {
ok: "OK",
cancel: "Отмена",
yes: "Да",
no: "Нет"
};
Ext.MessageBox = Ext.Msg = new Ext.window.MessageBox();
}

четвер, 30 червня 2011 р.

Oracle RETURNING Clause - get identity of inserted row


PROCEDURE Ins
(pContactID OUT Contacts.ContactID%TYPE,
pFirstname IN Contacts.Firstname%TYPE,
pSurname IN Contacts.Surname%TYPE)
IS
BEGIN
INSERT INTO Contacts
(fname, sname)
VALUES
(pFirstname, pSurname)
RETURNING ContactID INTO pContactID;
END;

ExtJS 4.0 GridPanel double-click event

In ExtJS 4.0 you need to listen for events on the GridPanel’s view, via the “viewConfig”:

viewConfig: {
listeners: {
itemdblclick: function(dataview, index, item, e) {
console.log('itemdblclick');
}
}
}