Skip to content

Instantly share code, notes, and snippets.

@js1972
js1972 / zcl_abap_benchmark_tool.abap
Created June 20, 2017 05:42
ABAP Benchmark Tool
class ZCL_ABAP_BENCHMARK_TOOL definition
public
final
create public .
public section.
class-methods START_TIMER .
class-methods STOP_TIMER .
class-methods GC .
@js1972
js1972 / infinite_streams.scala
Created June 17, 2014 01:09
Infinite Streams in Scala. Using infinite streams to efficiently calculate primes and square roots in a Scala Worksheet.
package week7
object primes {
//infinite stream builder
def from(n: Int): Stream[Int] = n #:: from(n + 1)
//> from: (n: Int)Stream[Int]
//infinte stream of all natural numbers
val nats = from(0) //> nats : Stream[Int] = Stream(0, ?)
val m4s = nats map (_ * 4) //> m4s : scala.collection.immutable.Stream[Int] = Stream(0, ?)
@js1972
js1972 / gist:9045719
Created February 17, 2014 06:32
Calculate a HASH on a STRING #ABAP
method calculate_hash.
" importing: string_data TYPE STRING
" returning: hash_value TYPE STRING
"
" Calculate the hash value for a given string and return as Base64.
"
data: lo_digest type ref to cl_abap_message_digest,
converter type ref to cl_abap_conv_out_ce,
data_as_xstring type xstring.
@js1972
js1972 / email_image_chart.abap
Created August 15, 2014 03:31
ABAP program to send email with images and charts. Not written by me, but I've tested it and it works - clean up before use (I've only added comments to clear things up)!!! This abap shows how to create a multi-part email to display inline images as well as attachments. It also shows how to generate a chart in abap (IGS) and get its image, as we…
report y_test_email_with_chart.
type-pools: abap .
tables: sflight .
constants: image_name_01 type string value 'Sailing.jpg' .
constants: image_name_02 type string value 'chart_01.jpg' .
constants: c_series_01 type string value 'series_01' .
@js1972
js1972 / ztcode.abap
Created June 20, 2017 05:54
Usage analysis of ABAP t-codes and programs
report ztcode.
parameters: month type dats default sy-datum obligatory,
user type usr02-bname obligatory default sy-uname.
types: begin of zusertcode,
operation type char30,
type type char10,
count type swncshcnt,
end of zusertcode.
@js1972
js1972 / odata_service.abap
Created July 21, 2014 04:48
Sample OData service for a basic User model. Shows how to provide filtering and sorting and also a Function Import. This uses the ODC (OData Channel) method for implementing an OData service which is the recommended approach by SAP. This sample shows two method redefinition's to get the entity by key value and to get an entity set by searching.
class zcl_zusers_dpc_ext definition
public
inheriting from zcl_zusers_dpc
create public .
public section.
methods /iwbep/if_mgw_appl_srv_runtime~execute_action redefinition.
protected section.
methods userset_get_entity redefinition.
@js1972
js1972 / CMM_InvoiceReplication_V01_to_ProConInvoiceActivityMessage.xsl
Last active July 20, 2017 06:06
Example #XSLT #PI #mapping working with a SAP #Invoice message
<?xml version="1.0" encoding="UTF-8"?>
<!--
Name: ProCon Invoice Mapping
Author: Chris Mills
Details: Mapping implemented as an XSL as single SAP Invoice message needs to be split to mutliple ProCon messages, 1 per PO
and financials calculated by unique PO. i.e. if invoice has 3 line items which relate to two PO's then need to split to
two output messages and calculate the tax and net amounts by PO, recursion much easier in XSL
NOTE: This will only send items from the invoice that relate to a contract, the business rules are meant to be no multi-contract
invoices and no mix of 1 item against a contract and another not but if it happens ProCon will only see parts of the invoice
@js1972
js1972 / VIDEO-QA with Tensorflow 1.2RC0.ipynb
Created June 20, 2017 06:13 — forked from Kjeanclaude/VIDEO-QA with Tensorflow 1.2RC0.ipynb
EXAMPLE OF VIDEO-QA IMPLEMENTATION WITH TENSORFLOW 1.2RC0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@js1972
js1972 / types_testing.scala
Created September 16, 2014 07:27
Example of solving problems using Types (using shapeless 2). Won't compile in eclipse nor SBT!
package shapeless.stuff
import shapeless._
import nat._
import ops.nat._
import ops.hlist._
/**
* The goal is to determine whether a list of numbers is the appropriate length
* (nine) and has a valid checksum, which is calculated by taking the sum of
import sys, cv2
# Refactored https://realpython.com/blog/python/face-recognition-with-python/
def cascade_detect(cascade, image):
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
return cascade.detectMultiScale(
gray_image,
scaleFactor = 1.15,
minNeighbors = 5,