2015-04-06

JavaScript - How to remove a property from an existing object

var myObject = { };
myObject["myProperty"] = {};
myObject["myProperty"]["mySubProperty"] = "mySubProperty value here.";

console.log( 'Before: ');
console.log( myObject );

console.log( 'After removing myProperty.mySubProperty:' );
delete myObject.myProperty.mySubProperty;
console.log( myObject );

Javascript - How to add properties to an existing object

var myObject = { };
myObject["myProperty"] = {};
myObject["myProperty"]["mySubProperty"] = "mySubProperty value.";
console.log( myObject );

2015-03-13

TSQL - How to add multiple columns to a table at once (and how to drop them too)


-- Add
alter table [DATABASE_NAME].[SCHEMA_NAME].[TABLE_NAME]
add
       [FIELD_NAME_1] varchar(4) null
       , [FIELD_NAME_2] tinyint null
       , [FIELD_NAME_3] varchar(3) null
       , [FIELD_NAME_4] tinyint null
;


-- Drop
alter table STRESSTEST.dbo.TransactionStressed
drop column
       [FIELD_NAME_1]
       , [FIELD_NAME_2]
       , [FIELD_NAME_3]
       , [FIELD_NAME_4]
;



2015-03-03

Teradata - How to list all views (with their SQL definition)

select
       *
from
       dbc.tables
where
       1=1
       and tablekind='V'
       and databasename='CFDW2_RDL_ERIDL_CFS_VWS'
;


2015-02-17

RegEx - Specific string/character count in javascript

// This returns 1
'aasdf'.match(/a+/g).length;

// This returns 2
'aasdf'.match(/a/g).length;

2015-01-05

LINUX - How to mount an apple hard drive in read-write mode

sudo apt-get install hfsprogs
sudo mount -t hfsplus -o remount,force,rw /CURRENT_READ_MOUNT/LOCATION_HERE


LINUX - How to retrieve the group a given username belongs to

groups USERNAME_HERE