PayPal
Klarna
![Klarna Klarna Logo](https://upload.wikimedia.org/wikipedia/commons/thumb/4/40/Klarna_Payment_Badge.svg/1024px-Klarna_Payment_Badge.svg.png)
Common images in western societies from social and economic point of view:
At least one or both parents work most of the year and gain income for family. Family might get money from the state for the children to help getting them educated in public or private school and later an education to get a paid job in our economy.
A pair in a kind of love or sexual relation lives together, because they cannot reproduce or don't want to have children. Normally both work (maybe not fulltime) and earn money.
Hi, I implemented SUPU (SUdoku PUzzle), idea & design by Georg Toth for Windows Desktop.
You can order Supu on Georg Toth Webshop here:
https://www.georg-toth.com/supu
so a little fun project "frogA- frogger Android" is taking some little progress.
https://www.youtube.com/shorts/4FAhYn2c5oU
Orginal posting can be fount here: http://blog.darkstar.work/2012/05/flex-fast-lexical-analyzer-generator.html
Who remember flex: fast lexical analyzer generator?
Here is a short sample, I have written it under gnu linux and ported it to win32 using gnuwin32 flex and getoptwin:
We have this simple c modified code from stack overflow called funcptrtest.c:
include <stdio.h> /* C code for program funcptrtest.c => https://pastebin.com/rUtXfgSG */ const int b = 23; // A normal function with an int parameter and void return type void fun(int a) { if (a < b) printf("Value of a (%d) is lesser then value of b (%d)\n", a, b); else if (a == b) printf("Value of a (%d) is equal value of b (%d)\n", a, b); else if (a > b) printf("Value of a (%d) is greater than value of b (%d)\n", a, b); } // main => NO KNR style int main(argc, argv) int argc; char **argv int main(int argc, char **argv) { int i = 0; /* fun_ptr is a pointer to function fun() void (*fun_ptr)(int) = &fun; is equivalent of following two void (*fun_ptr)(int); fun_ptr = &fun; */ void (*fun_ptr)(int) = &fun; // call once with static int (*fun_ptr)(b); // iterate through for loop for (i = 1; i < 101; i+=11) { // Invoking fun() using fun_ptr (*fun_ptr)(i); } return 0; }
We compile it now with gnu c compiler with gcc option -S and generate an assembler file:
gcc -S funcptrtest.c -o funcptrtest.asm
Result will be something like this:
.file "funcptrtest.c" .text .globl b .section .rodata .align 4 .type b, @object .size b, 4 b: .long 23 .align 8 .LC0: .string "Value of a (%d) is lesser then value of b (%d)\n" .align 8 .LC1: .string "Value of a (%d) is equal value of b (%d)\n" .align 8 .LC2: .string "Value of a (%d) is greater than value of b (%d)\n" .text .globl fun .type fun, @function fun: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl %edi, -4(%rbp) movl $23, %eax cmpl %eax, -4(%rbp) jge .L2.L2: movl $23, %eax cmpl %eax, -4(%rbp) jne .L4 movl $23, %edx movl -4(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT jmp .L5 .L2: movl $23, %eax cmpl %eax, -4(%rbp) jne .L4 movl $23, %edx movl -4(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L2: movl $23, %eax cmpl %eax, -4(%rbp) jne .L4 movl $23, %edx movl -4(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT jmp .L5 .L4: movl $23, %eax cmpl %eax, -4(%rbp) jle .L5 movl $23, %edx movl -4(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L5: nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size fun, .-fun .globl main .type main, @function main: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movq %rsi, -32(%rbp) movl $0, -12(%rbp) leaq fun(%rip), %rax movq %rax, -8(%rbp) movl $23, %edx movq -8(%rbp), %rax movl %edx, %edi call *%rax movl $1, -12(%rbp) jmp .L7 .L8: movl -12(%rbp), %eax movq -8(%rbp), %rdx movl %eax, %edi call *%rdx addl $11, -12(%rbp) .L7: cmpl $100, -12(%rbp) jle .L8 movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size main, .-main .ident "GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4:
Lets look, if a simple loop is faster than a function pointer delegate call:
/* program looptest.c */ include <stdio.h> const int b = 23; // main int main(int argc, char **argv) { int i = 0; int a = 23; /* if (a < b) printf("Value of a (%d) is lesser then value of b (%d)\n", a, b); else if (a == b) printf("Value of a (%d) is equal value of b (%d)\n", a, b); else if (a > b) printf("Value of a (%d) is greater than value of b (%d)\n", a, b); */ // iterate through for loop for (i = 1; i < 4194304; i+=11) { a = i; if (a < b) printf("Value of a (%d) is lesser then value of b (%d)\n", a, b); else if (a == b) printf("Value of a (%d) is equal value of b (%d)\n", a, b); else if (a > b) printf("Value of a (%d) is greater than value of b (%d)\n", a, b); } return 0; }
/* program funcptrtest.c */ include <stdio.h> const int b = 23; // A normal function with an int parameter and void return type void fun(int a) { if (a < b) printf("Value of a (%d) is lesser then value of b (%d)\n", a, b); else if (a == b) printf("Value of a (%d) is equal value of b (%d)\n", a, b); else if (a > b) printf("Value of a (%d) is greater than value of b (%d)\n", a, b); } // main int main(int argc, char **argv) { int i = 0; /* fun_ptr is a pointer to function fun() void (*fun_ptr)(int) = &fun; is equivalent of following two void (*fun_ptr)(int); fun_ptr = &fun; */ void (*fun_ptr)(int) = &fun; // call once with static int // (*fun_ptr)(b); // iterate through for loop for (i = 1; i < 4194304; i+=11) { // Invoking fun() using fun_ptr (*fun_ptr)(i); } return 0; }
Well, that's not so deterministic, of course our simple looptest.asm has a shorter assembler.
But execution time is not so huge difference, we have to simulate, that in many scenarios.
[To be continued ...]
Most complete Identity of a person is defined / determined by different public, restricted or private accessible spheres.
Attention:
This article isn't about daily standard electronic communications via network protocols (e.g. email services or shared network folders), neither about user authentication / authorization nor groupware.
It's about:
Implementing or consuming customizable reliable distributed services;
by choosing & implementing a programmable extensible scalable, easily portable, standardized inter-compatible fail-safe resilient communication middleware, that's financially essential for most critical business processes.
For what kind of companies is that useful, important or relevant?
It's relevant for all companies, that consume many crtical data from external partners / service providers;
then process received & own data inside different departments (maybe in different locations) with different areas of responsibility (e.g. fraud detection, critical real-time scaling of dynamic hardware (memory, harddisks and available CPUs, permanent risk adjustment and last but not least anonymized [General Data Protection Regulation] precise reporting for legal reasons);
finally and ultimately share processed data to maybe different external organisations with very deviating requirements, like government fraud reporting agency on one side and partners inside a foundation or joint umbrella organization however.
[ to be continued ... ]
-
I'm left liberal atheist, but I want to show thou, that I like some church music very much.
using System;
using System.Reflection;
namespace work.darkstar.blog
{
/// <summary>
/// abstract class BaseSets
/// </summary>
[Serializable]
public abstract class BaseSets
{
public string AssemblyName { get => Assembly.GetExecutingAssembly().GetName().ToString(); }
public string Copyright { get => "GNU LIGHT GENERAL PUBLIC LICENSE 2.0 LGPL"; }
public virtual string AssemblyCom { get => "darkstar.work"; }
public virtual int AppId { get; protected set; }
public virtual string AppName { get; protected set; }
/// <summary>
/// protected empty constructor for inheritable singelton
/// </summary>
protected BaseSets() { }
/// <summary>
/// protected parameterized constructor for inheritable singelton
/// </summary>
protected BaseSets(int appId, string appName)
{
AppId = appId; AppName = appName;
}
}
}
using Microsoft.Win32;
using System;
using System.Reflection;
using System.Windows.Forms;
namespace work.darkstar.blog
{
public interface IAppSetsDomain : IAppDomainSetup
{
System.AppDomain AppCurrentDomain { get; }
}
/// <summary>
/// application settings singelton
/// </summary>
[Serializable] public class AppSets : BaseSets, IAppDomainSetup
{
private static AppSets _appSets;
private static object _initLock, _sndLock;
protected static AppSets DoubleLockInstance {
get {
_sndLock = new System.Object();
lock (_sndLock) {
if (_initLock != null) _initLock = null;
if (_initLock == null) _initLock = new System.Object();
lock (_initLock) {
if (_appSets == null)
_appSets = new AppSets();
}
return _appSets;
}
}
}
public string CodeBase { get => Assembly.GetExecutingAssembly().CodeBase; }
public string BaseDirectory { get => AppDomain.CurrentDomain.BaseDirectory; }
public string AppDataPath { get => Application.CommonAppDataPath; }
public RegistryKey AppDataRegistry { get => Application.CommonAppDataRegistry; }
#region implementing interface IAppSetsDomain, IAppDomainSetup public AppDomain AppCurrentDomain { get => AppDomain.CurrentDomain; } public string ApplicationBase { get ; set; } public string ApplicationName{ get ; set; }
public string CachePath{ get ; set; } public string ConfigurationFile{ get ; set; }
public string DynamicBase { get ; set; }
public string LicenseFile { get ; set; }
public string PrivateBinPath { get ; set; }
public string PrivateBinPathProbe { get ; set; }
public string ShadowCopyDirectories { get ; set; }
public string [] ShadowCopyDirectoryArray {
get => ShadowCopyDirectories.Split(';'); } public bool FilesShadowCopy { get ; set; } public string ShadowCopyFiles { get => FilesShadowCopy.ToString().ToLower(); set { FilesShadowCopy = Boolean.Parse(value); } } public bool FilesShadowCopy{ get ; set; } public string ShadowCopyFiles{ get => FilesShadowCopy.ToString() ; set; } #endregion implementing interface IAppSetsDomain, IAppDomainSetup
/// <summary>
/// static constructor
/// </summary>
static AppSets() {
_initLock = new System.Object();
lock (_initLock) { _appSets = new AppSets(); }
}
/// <summary>
/// private empty constructor
/// </summary>
private AppSets() {
AppId = AppDomain.CurrentDomain.Id;
AppName = Assembly.GetExecutingAssembly().FullName;
}
/// <summary>
/// protected parameter constructor
/// </summary>
protected AppSets(int appId, string appName) : base(appId, appName) { }
}
}
using System;
using System.IO; using System.Security;/* ... */
using Microsoft.Win32;
/* ... */
using Windows.Forms;
namespace work.darkstar.blog { /// <summary> /// my application settings singelton /// </summary> [Serializable] public sealed class MyAppSets : AppSets { /// <summary> /// private static readonly Lazy<T> self containing private real singelton unique instance /// </summary> private static readonly Lazy<MyAppSets> _instance = new Lazy<MyAppSets>(() => new MyAppSets(AppDomain.CurrentDomain.Id, "LazyApp")); /// <summary> /// static instance getter for Singeltion /// </summary> public static MyAppSets Instance { get => _instance.Value; } public string UserAppDataPath { get => Application.UserAppDataPath; } public RegistryKey UserAppDataRegistry { get => Application.UserAppDataRegistry; } /// <summary> /// private constructor with partameters for sealed unique singelton /// </summary> private MyAppSets(int appId, string appName) : base(appId, appName) { } /// <summary> /// Gets name value pair for application registry key saved in registry scope for current user /// </summary> /// <param name="regName">registry name identifier</param> /// <param name="subKey">subKey in scope of current user</param> /// <returns>object value</returns> /// <exception cref="ApplicationException">application exception with detailed inner exception</exception> public object GetUserRegValuey(string regName, string subKey = null) { object o = null; RegistryKey key = null; Exception ex = null; try { key = (subKey == null) ? UserAppDataRegistry : UserAppDataRegistry.OpenSubKey(subKey, false); o = key.GetValue(regName); } catch (SecurityException sex) { ex = sex; } catch (ObjectDisposedException odEx) { ex = odEx; } catch (UnauthorizedAccessException uaEx) { ex = uaEx; } catch (IOException ioeEx) { ex = ioeEx; } finally { if (key != null && subKey != null) key.Close(); if (ex != null) throw (new ApplicationException("Error accessing registy key: " + $"{UserAppDataRegistry}\t name: {regName}\t subkey: {subKey}", ex));
} return o; } /// <summary> /// Set Value for UserAppDataRegistry /// </summary> /// <param name="regName">registry name </param> /// <param name="value"value to set></param> /// <param name="subKey">subKey</param> /// <returns>void means nothing</returns> /// <exception cref="ApplicationException">application exception with detailed inner exception</exception> public void SetUserReg(string regName, object value, string subKey = null) { RegistryKey key = null; Exception ex = null; try { key = (subKey == null) ? UserAppDataRegistry : UserAppDataRegistry.OpenSubKey(subKey, true); key.SetValue(regName, value); } catch (Exception anyEx) { ex = new ApplicationException($"Error setting value=" + $"{value} for name={regName} inside registry key: {key.Name}", anyEx); } finally { if (key != null && subKey != null) key.Close(); if (ex != null) throw ex; } } } }
using System; /* ... */
using work.darkstar.blog;
public class MyEntity : IAppSetsDomain {
/* [ ... ] */
/* [Inject] */
/* [ ... ] */
public AppDomain AppCurrentDomain {
get => MyAppSets.Instance.AppCurrentDomain;
set => MyAppSets.Instance.AppCurrentDomain = value;
}
/* ... */
}