Skip to content

Instantly share code, notes, and snippets.

View chathurawidanage's full-sized avatar
🏠
Working from home

Chathura Widanage chathurawidanage

🏠
Working from home
View GitHub Profile
javascript: (function() {
var host = location.host;
var params = location.href.substr(location.href.indexOf("tei"), location.href.length);
var win = window.open("http://" + host + "/api/apps/tracker-charts/index.html#/trackerEndPoint?" + params, "", "width=800,height=600");
win.focus();
}());
{
"version": "0.0.2",
"name": "Longitudinal Charts",
"description": "Responsive Web application for easy visualization of longitudinal data",
"icons": {
"16": "/img/icons/chart-36.png",
"48": "/img/icons/chart-48.png",
"128": "/img/icons/chart-192.png"
},
"developer": {
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* @author Chathura Widanage
*/
public class GenerateR {
public static void main(String[] args) throws IOException {
String pathToTrainCSV = "F:\\\\engineering\\\\Semester 7_8\\\\ML\\\\keggle\\\\train.csv";//4 backward slashes required
library(data.table)
print('Reading data')
train <-fread('F:\\engineering\\Semester 7_8\\ML\\keggle\\train.csv',select = c('Cliente_ID', 'Producto_ID', 'Agencia_ID', 'Ruta_SAK', 'Demanda_uni_equil','Canal_ID'))
mean_Can <- train[, .(mean_Can = mean(Demanda_uni_equil)), by = .(Canal_ID)]
train <- merge(train, mean_Can, all.x = TRUE, by = c("Canal_ID"))
print(paste(cor(train$Demanda_uni_equil,train$mean_Can,method="spearman")," -> Canal_ID"))
train$mean_Can <- NULL
mean_Can <- NULL
gc()
mean_Rut <- train[, .(mean_Rut = mean(Demanda_uni_equil)), by = .(Ruta_SAK)]
import java.util.*;
/**
* @author Chathura Widanage
*/
public class SortR {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
String line;
Map<Float,String> mapping=new HashMap<>();//assuming there won't be any similar cor coefficients
package com.cwidanage.algo.ds;
import java.util.Arrays;
import java.util.Random;
/**
* @author Chathura Widanage
*/
public class DataStructure {
public Object[] arrays = new Object[0];
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import java.io.IOException;
/**
* @author Chathura Widanage
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import java.io.IOException;
import java.io.InputStream;
@RequestMapping( value = "/{id}", method = RequestMethod.DELETE )
@PreAuthorize( "hasRole('ALL') or hasRole('F_TRACKED_ENTITY_INSTANCE_ADD')" )
@ResponseStatus( HttpStatus.NO_CONTENT )
public void deleteTrackedEntityInstance( @PathVariable String id ) throws WebMessageException
{
if ( !instanceService.trackedEntityInstanceExists( id ) )
{
throw new WebMessageException( WebMessageUtils.notFound( "Tracked entity instance not found for ID " + id ) );
}
@RequestMapping( value = "/{uid}", method = RequestMethod.DELETE )
@PreAuthorize( "hasRole('ALL') or hasRole('F_TRACKED_ENTITY_DATAVALUE_DELETE')" )
public void deleteEvent( HttpServletResponse response, HttpServletRequest request,
@PathVariable( "uid" ) String uid ) throws WebMessageException
{
if ( !programStageInstanceService.programStageInstanceExists( uid ) )
{
throw new WebMessageException( WebMessageUtils.notFound( "Event not found for ID " + uid ) );
}