Skip to content

Instantly share code, notes, and snippets.

from datetime import timedelta
from datetime import datetime
#### testing data
raw_set = [
{"begin": "20231201", "end": "20240101", "content": "a"},
{"begin": "20231217", "end": "20240101", "content": "a1"},
{"begin": "20231204", "end": "20231206", "content": "b"},
{"begin": "20231101", "end": "20231215", "content": "c"},
{"begin": "20231101", "end": "20231214", "content": "c1"},
import decimal
from decimal import Decimal
a = ['23.17', '3.2', '1.22', '0.32']
b = ['7.36', '4.16', '3.2', '1.69', '1.28', '1.28', '0.96', '0.96', '0.90', '0.64', '0.64', '0.64', '0.50', '0.50', '0.32', '0.32', '0.32', '0.32', '0.32', '0.32', '0.32', '0.32', '0.32', '0.32']
a = ["52.7", "8.96"]
b = ["21.44", "6.72", "5.44", "5.12", "4.48", "3.20", "2.24", "1.92", "1.92", "1.92", "1.28", "1.28", "1.00", "0.96", "0.50", "0.32", "0.32", "0.32", "0.32", "0.32", "0.32", "0.32"]
a = ['17.76','62.13','26.67'] #'62.13','17.76',]
@quxiaowei
quxiaowei / alv.md
Last active February 13, 2018 06:53
[ALV] #ABAP

避免不同的同一个 ALV 显示不同数据时,layout variant 混淆

  DATA: ls_variant TYPE disvariant.
  ls_variant-report = sy-repid.
  IF ... .
    ls_variant-handle = 'YS'.
  ELSE.
    ls_variant-handle = ''.
  ENDIF.
@quxiaowei
quxiaowei / 批量搜索程序.txt
Created February 13, 2018 06:41
[批量搜索程序] RPR_ABAP_SOURCE_SCAN #ABAP
批量搜索程序 RPR_ABAP_SOURCE_SCAN
@quxiaowei
quxiaowei / Simple_ALV_Class.txt
Last active February 13, 2018 06:42
[CL_SALV_TABLE] Simple ALV Class #ABAP
" 通常
DEMO:SALV_DEMO_TABLE_SIMPLE
" 双击单击事件
DEMO:SALV_TEST_TABLE_EVENTS
@quxiaowei
quxiaowei / processing_mountains.py
Created December 21, 2016 15:45
processing.js
width, height = 600, 600
w, h = 300, 600
lines, cols = 40, 20
xspace, yspace = 5, 10
moving = 0.0
bg_color = color(50, 55, 100)
fg_color = color(255)
def setup():
@quxiaowei
quxiaowei / async_socket.py
Last active September 29, 2016 15:48
异步 socket server
import socket
from concurrent.futures import ThreadPoolExecutor, as_completed
from collections import deque
from functools import wraps
_addr_ = ('', 50007)
_queue_ = deque()
executor = ThreadPoolExecutor(max_workers=10)
def _loop_():
@quxiaowei
quxiaowei / IF_REST_HANDLER~HANDLE.abap
Last active February 13, 2018 06:43
[Restful Handler] #ABAP
METHOD if_rest_handler~handle.
DATA: BEGIN OF wa_jsondata,
name TYPE char20,
greeting TYPE char100,
END OF wa_jsondata.
DATA str_name TYPE string.
str_name = io_request->get_uri_attribute( iv_name = 'name' ).
str_name = cl_http_utility=>if_http_utility~unescape_url( str_name ).
@quxiaowei
quxiaowei / IF_REST_APPLICATION~GET_ROOT_HANDLER.abap
Last active March 3, 2021 16:51
[IF_REST_APPLICATION~GET_ROOT_HANDLER] #ABAP
METHOD if_rest_application~get_root_handler.
*CALL METHOD SUPER->IF_REST_APPLICATION~GET_ROOT_HANDLER
* RECEIVING
* RO_ROOT_HANDLER =
* .
DATA: lo_router TYPE REF TO cl_rest_router.
IF mo_server IS BOUND.
CREATE OBJECT lo_router.
lo_router->attach( iv_template = '/GetTest' iv_handler_class = 'ZCL_REST_WS_TEST' ).
@quxiaowei
quxiaowei / abap_url_escape_decode.abap
Last active February 13, 2018 06:45
[URL Excape] #ABAP
" escape & unescape
DATA str_name TYPE string.
str_name = cl_http_utility=>if_http_utility~escape_url( str_name ).
str_name = cl_http_utility=>if_http_utility~unescape_url( str_name ).
" encode
DATA conv TYPE REF TO cl_abap_conv_out_ce.
conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
conv->convert(
EXPORTING data = v_text