Skip to content

Instantly share code, notes, and snippets.

View tfoldi's full-sized avatar

Földi Tamás tfoldi

View GitHub Profile
@tfoldi
tfoldi / WebServiceClient.java
Created May 14, 2015 14:09
Trigger Schedule from Java
/**
*
*/
package tableauSrvrWebservice.Auth;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
@tfoldi
tfoldi / MakeOrder.java
Created May 4, 2015 11:15
Compare Java and Clojure Tableau TDE API
// -----------------------------------------------------------------------
// The information in this file is the property of Tableau Software and
// is confidential.
//
// Copyright (C) 2012 Tableau Software.
// Patents Pending.
// -----------------------------------------------------------------------
// externalapi/samples/com/tableausoftware/demos/MakeOrder.java
// -----------------------------------------------------------------------
package com.tableausoftware.demos;
# CoffeeScript version of Google Spreadsheet Driver for Tableau Data Web Connector
init = ->
if !tableau
alert 'init- tableau NOT defined!'
return
tableau.scriptVersion = '1.0'
tableau.log 'init'
tableau.initCallback()
@tfoldi
tfoldi / pgpydl.sql
Created April 1, 2015 17:22
Python example of getting files and parsing them inside postgres database
CREATE OR REPLACE FUNCTION from_url(
-- The URL to download.
IN url text,
-- The maximum number of bytes to download.
-- If 0 then the whole response is returned.
IN max_bytes integer DEFAULT 0,
-- Should any errors (like HTTP transport errors)
-- throw an exception or simply return default_response
IN should_throw boolean DEFAULT true,
-- The default response if any errors are found.
@tfoldi
tfoldi / tableau.clj
Created March 20, 2015 22:52
Tableau Server Rest API from Clojure - Example
(ns tabsync.tableau
(:require [clj-http.client :as client]
[clojure.zip :refer [xml-zip]]
[clojure.data.zip.xml :refer [xml-> xml1-> attr ]]
[clojure.data.xml :as xml])
)
(defn tableau-url-for
"Constructs server API url. Target can be hostname or session returned from logon-to-server"
[target api-path]
# put this file to the apache\conf directory
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module modules/mod_jk.so
# Declare the module for <IfModule directive> (remove this line on Apache 2.x)
#AddModule mod_jk.c
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
@tfoldi
tfoldi / tableau.rb
Created April 24, 2013 07:56
This ruby class can logon and invoke REST API URLs in Tableau server. Authentication is done by using RSA crpyto stuff.
require 'httpclient'
module TableauLDAPSync
class Tableau
def initialize(server_url)
proxy = ENV['HTTP_PROXY']
@http_client = HTTPClient.new(proxy)
@http_client.set_cookie_store("cookie.dat")
CREATE TABLE emp (
name text,
age integer,
salary numeric(10,2)
);
CREATE OR REPLACE FUNCTION get_emps(float8) RETURNS SETOF emp AS '
names <- c("Joe","Jim","Jon")
ages <- c(41,25,35)
salaries <- c(250000,120000,50000)
@tfoldi
tfoldi / dim_cndn_abap.abap
Created December 6, 2011 09:28
KONV extract SAP Download
REPORT ZAL_ABAP message-id 26 line-size 255
no standard page heading.
* Y_XI_G00D_KONV_FASTFULL_2.
PARAMETER $PARAM1 TYPE I.
PARAMETER DOWNLOAD(1) DEFAULT 'N' lower case. "N-svr,Y-clnt
PARAMETER EXECMODE(1) DEFAULT 'B' lower case. "D-dlg,B-btch
PARAMETER OUT_DIR(48) DEFAULT "output file dir
'/dwacta/out/LD2' lower case.
PARAMETER IN_DIR(48) DEFAULT "input file dir
'/dwacta/out/LD2' lower case.
@tfoldi
tfoldi / geomean.sql
Created October 7, 2010 14:53
Aggregate function for geometric mean (GEOMEAN) for Oracle RDBMS
ALTER SESSION SET plsql_compiler_flags = 'NATIVE';
--
ALTER TYPE geomean_impl COMPILE;
--
CREATE FUNCTION geomean( input NUMBER )
RETURN NUMBER
PARALLEL_ENABLE
AGGREGATE USING geomean_impl;