Skip to content

Instantly share code, notes, and snippets.

@shiranGinige
shiranGinige / cordova-android-setup-steps
Last active August 29, 2015 14:12
Cordova Android setup steps
1. Setting up SDK tools
> Download the Android Studio http://developer.android.com/sdk/index.html
> Configure -> SDK Manager
> Make sure following are installed under Tools
- Android SDK Tools
- Android SDK Platform-tools
- Android SDK Build-tools
> Make sure required API tools are (21 is the current)
@shiranGinige
shiranGinige / Node IDEs
Last active August 29, 2015 14:10
Node IDEs
ATOM
Pros :
Fast - Ok, I've seen people complaning about the slowness of ATOM. But if I were to compare it with Sublime and WebStorm it would be Sublime > ATOM > WebStorm with Sublime being fastest.
Looks matter - and ATOM is the best
Cons :
Less GIT features - can't compare the working version with that of GIT
Sublime
@shiranGinige
shiranGinige / branchingandmerging
Last active August 29, 2015 14:09
branching and merging
work in a dev branch
when done, commit all changes and merge the master to dev (retaining all changes done in dev)
> git merge -s ours masater
when the merging is success in the branch, swith to master
> git checkout master
@shiranGinige
shiranGinige / gist:1336f7d0ce359e6c1e8c
Created June 23, 2014 03:31
Azure ADFS configuration error : Value cannot be null. Parameter name: certificate
Note to self : Identity configuration is throwing the above error in the RsaEncryptionCookieTransform(e.FederationConfiguration.ServiceCertificate) init process.
For some reason, the certificateValidation is to be set to None for it to get pass this error.
<system.identityModel>
<identityConfiguration>
<audienceUris>
<add value="spn:b8550cb0-510c-4713-9695-73e6d1280372"/>
</audienceUris>
@shiranGinige
shiranGinige / gist:9aae6b590cebf5c32a6e
Last active August 29, 2015 14:01
MS SQL : Copying data across different DB Servers
INSERT INTO [DestServer].[DestDB].[dbo].DestTable (column list)
SELECT column list
FROM [SourceServer].[SourceDB].[dbo].SourceTable
WHERE some condition
@shiranGinige
shiranGinige / gist:cff4f8a67b12ade8dd88
Last active August 29, 2015 14:01
Adding a user to Azure databases
Ok, here is our scenario. Create a database on an existing server, and 'sometimes' the applications are not able to access the database using the 'default' credentials assigned to the server. Following script can be used to do that manually.
CREATE USER theuser without login with default_schema=[dbo]
EXEC sp_addrolemember N'db_owner', N'theuser'
@shiranGinige
shiranGinige / gist:7927421
Created December 12, 2013 12:47
Storage comparison
Dropbox - 100 GB / 99 / year
Google drive 100 GB/ 180/ year
Skydrive 100GB/ 50 /year
https://skydrive.live.com/options/Upgrade
http://www.google.com/intx/en_au/enterprise/apps/business/products.html#product-drive-prices
https://www.dropbox.com/business/pricing
@shiranGinige
shiranGinige / Returning a file in a HTTP stream , without having a physical file
Last active December 26, 2015 15:38
I just want to save a file temporarily and return it as a stream for a HTTP response. Azure don't like me writing things to the file system? Here's how to get around.
var data = getData();
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine("Header");
foreach (var item in data)
{
stringBuilder.AppendLine(data.Stuff)
}
var response = new HttpResponseMessage(HttpStatusCode.OK);
@shiranGinige
shiranGinige / gist:5102758
Last active December 14, 2015 14:48
Ef4 Code First - collections in entities
If i do this with code first,
var entityA = new EntityA();
entityA.ItemCollection.Add(new Item());
entityA.ItemCollection.Add(new Item());
service.Save(entityA);
Everything works fine, until you go and check for the two records that should have been inserted
@shiranGinige
shiranGinige / gist:4726934
Created February 6, 2013 23:39
SQL script to restore a database courtesy : @adipa Gunasekara
USE MASTER
GO
declare @restoreSql nvarchar(500);
declare @dbName nvarchar(50);
declare @dbBackupFile nvarchar(100);
set @dbName = 'test';
set @dbBackupFile = 'test.bak';