Skip to content

Instantly share code, notes, and snippets.

@eppsteve
eppsteve / t-sql_foreach_cursor
Last active March 13, 2021 12:28
T-SQL ForEach style loop
declare @Enumerator CURSOR
SET @Enumerator = CURSOR LOCAL FAST_FORWARD FOR
select UserId
from Users
where IsActive = 1
OPEN @Enumerator
declare @id int
@eppsteve
eppsteve / BaseModel.cs
Created October 29, 2017 14:22
EF Database First Template to implement INotifyPropertyChanged in generated POCO classes.
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace InvoiceWorks.Model
{
public abstract class BaseModel : INotifyPropertyChanged
{
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
{
var express = require('express');
var app = express();
var sql = require("mssql"); //load the driver
// config for your database
var config = {
user: 'sa',
password: 'mypassword',
server: 'localhost',
database: 'SchoolDB'
};
@eppsteve
eppsteve / get_json.java
Created September 23, 2015 18:27
Get JSON from rest web service in android
DefaultHttpClient httpclient = new DefaultHttpClient(new BasicHttpParams());
HttpPost httppost = new HttpPost(http://someJSONUrl/jsonWebService);
// Depends on your web service
httppost.setHeader("Content-type", "application/json");
InputStream inputStream = null;
String result = null;
try {
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();