stored procedures – What C# type is the correct representation for DB2 UDB boolean?

The project that I work on uses IBM.Data.DB2 nuget package for its data layer.

I need to call into utl_mail.send_attach_varchar2 stored procedure on the DB2 side. It has a boolean parameter att_inline for which I initially tried to supply DB2Type.Boolean data type. This does not work due to this error when adding it:

{"Specified argument was out of the range of valid values.rnParameter name: Invalid DB2 Type enumeration value=1015."}

The value 1015 corresponds to DB2Type.Boolean. I also tried DB2Type.Integer and supplied 0 for the value, or DB2Type.Char and supplied '0', but there is this error that I get in both cases when executing the command:

{"ERROR (22018) (IBM)(DB2/NT64) SQL0420N  Invalid character found in a character string argument of the function "DECIMAL"."}

Now, I am thinking that I have covered the parameters that are common with SEND procedure because I used it from the same code and it worked. The difference is in the attachment handling, so I am assuming that it is the att_inline parameter that is causing it.

There does not seem to be anything DECIMAL in the command that I supply to DB2Command.Text

"call utl_mail.send_attach_varchar2 (@sender, @recipients, @cc, @bcc, @subject, @message, @mime_type, @attachment, @att_inline, @att_mime_type, @att_filename)"

I tested with the SEND procedure by omitting @attachment and all parameters that follow, and it worked fine, so the command seems Okay to me, unless I am missing something.

functional programming – What are the implications of Homotopy Type Theory?

I’ve recently come across the topic of homotopy type theory and I’m interested to learn more. I have a very limited background in type theory.

Can anyone tell me, in functional programming terms or through practical examples, how exactly is HoTT going to change the way we view mathematics, and what are the implications of HoTT on proof assistants? Thanks!

VLOOKUP type functionality in MS Flow and Sharepoint

It may be a simple question, but I want to use VLOOKUP-type functionality in my Sharepoint but I can’t figure it out on my own and hours of browsing didn’t help me as well.

I have a Document Library with lots of files and metadata, these are the files that are received from customers. One of the metadata fields is “CustomerEmail”. Using this column I may group by and filter out the view by customers email. However, in order to make it more user friendly I want to have an automatically updating metadata field “CustomerName” which update file properties according to the “CustomerEmail” value. Doc Library looks like this:

FileName CustomerEmail CustomerName


In order to make it I’ve created a Task List with names and emails of all customers. Task List looks like this:

CustomerName2 CustomerEmail2

John Doe

Mary Williams

Then I wanted to create a Power Automate flow to trigger when the file is modified > loop through the Task List > find the matching value > update file properties (CustomerName: CustomerName2).

For this I’ve tried using ODATA filter (both using Get Items and Get files (properties only)), looping through the Get Items value and checking it with Condition control, but none of it worked.

If it would be only John and Mary (two customers), I would probably not think too much and just create two conditions in my flow (if CustomerEmail eq ‘’, then update file CustomerName to ‘John Doe’, etc.). But since I have tens of customer emails and names, that’s not an option and I’m looking for the way to make it possible since it doesn’t look difficult…

dnd 3.5e – What happens when a creature with Racial Hit Dice changes creature type?

The specific example I’m working with is a creature with RHD who takes the Human Heritage feat… and then advances by HD.

The creature retains all the traits of its previous type (so far so good), but what happens to its existing RHD? Do they change to the new type, or stay the same? The SRD says:

…but most templates that change Hit Dice change only the creature’s original HD and leave class Hit Dice unchanged.

However, this is in the context of whether class HD change when there is already an HD change happening, so I don’t know if it should generalize to “HD changing is the default”.

If the creature then advances by gaining more HD, I assume that all the new HD would be of the new type, but I’m open to peoples’ opinions on this as well.

Bridging the two questions, there’s also an argument to be made that since Human Heritage is a 1st level only feat, all RHD are acquired after it is taken, and should thus be of the Humanoid type.

2019 – External Content Type ( BDC ) From MS SQL – Fill multiple Columns from one selection?

SharePoint 2019 on-prem. I have a list with an external column that populates customer numbers from a SQL table. Works great. The lookup column is on customer number and that is populated on the list. The same SQL table also has customer name.

Is there a way to get it to auto populate another column with the name where the customer number = what was chosen in the previous column ?

Hopefully I explained myself well.

Thanks in advance.

graph traversal – Counting paths by their type

An edge-labelled directed graph is the data of $G = (V, E, l)$ where $(V, E)$ is a directed graph, and $l colon E to mathbb{P}$ is some function. (For the graph I am considering, labels take values in $mathbb{P} = {1, 2, 3, ldots}$). To any path $v_0 to v_1 to ldots to v_n$ in $G$, we can associate a type $alpha = (alpha_1, ldots, alpha_n) in mathbb{P}^n$, where $alpha_i = l(v_{i-1}, v_i)$. For a fixed source vertex $s$, destination vertex $t$, and type $alpha in mathbb{P}^n$, let $P(s, alpha, t) in mathbb{N}$ be the number of $s rightsquigarrow t$ paths of type $alpha$.

I have two counting problems, the first of which I can solve fairly efficiently, and the second of which I am hoping for some assistance. In the problem I am considering, the directed graph is acyclic, and satisfies other interesting properties: for example $P(s, alpha, t) = P(s, beta, t)$ whenever $alpha$ is a permutation of $beta$. Furthermore, in the problem I am consdiering $G$ is an infinite graph, but each of the following problems is finite.

Problem 1: Fix a source $s in V$ and a type $alpha$, and determine all of the numbers $P(s, alpha, -)$.

Problem 2: Fix a source $s in V$ and a destination $t in V$, and determine all of the numbers $P(s, -, t)$.

For problem 1, we can take an approach very similar to counting paths in a DAG. Initialise an array $mathtt{D}$ indexed by $V$ to zero, and set $mathtt{D}(s) = 1$. Then perform a breadth-first search, at the first layer following all edges of type $alpha_1$, and for each $s xrightarrow{alpha_1} v$ increment $mathtt{D}(v)$ by $mathtt{D}(s)$. Repeat for all the $alpha_2, ldots, alpha_n$. At the end, the last layer contains all vertices $t$ reachable from $s$ via an $alpha$-path, and $mathtt{D}(t)$ is equal to $P(s, alpha, t)$.

Problem 2 is more tricky, and the best strategy I have at the moment is essentially to iterate over the potential allowed types $alpha$ and compute each $P(s, alpha, t)$ individually. Another approach would be to do a breadth-first-search from $s$, but storing at each vertex the path type leading there, together with multiplicity – but this doesn’t seem to be faster.

recursion – A recursive_transform Function For Various Type Nested Iterable With std::variant Implementation in C++

This is a follow-up question for A TransformAll Function For Various Type Arbitrary Nested Iterable Implementation in C++. The following code is the improved version based on G. Sliepen’s answer. In order to match the conventions of the STL, the function named recursive_transform here uses the is_iterable concept and the is_element_iterable concept. Moreover, the copy operation of the input is avoided by updating (_Func)(auto element)->auto into (_Func)(auto& element) and the redundant part in this lambda function ->auto has been removed. Although the code is improved, I found that there are some cases which the previous version TransformAll function is hard to deal with. One of those cases is the nested iterable ranges with std::variant. I want to focus on this case, such as std::vector<std::variant<long double>>. First of all, the additional concept is_element_variant is included for determining the type of elements in iterable container is std::variant or not. I think there may be another better implementation to this is_element_variant concept. However, the method I surveyed How to check if template argument is std::variant? isn’t deal with this with c++-concepts. I prefer to work with concept here and the experimental code is as below. If there is any suggestion about how to improve this is_element_variant concept, please let me know.

template<typename T>
concept is_element_variant = requires(T x)

The part of the template function recursive_transform which handle the std::variant structure:

template<class T, class _Fn> requires is_iterable<T> && is_element_variant<T>
static T recursive_transform(const T _input, _Fn _Func);       //  Deal with the iterable case which its element is std::variant

template<class T, class _Fn> requires is_iterable<T> && is_element_variant<T>
static inline T recursive_transform(const T _input, _Fn _Func)
    T returnObject = _input;
    std::transform(_input.begin(), _input.end(), returnObject.begin(), 
        (_Func)(typename std::iterator_traits<typename T::iterator>::value_type x)->
        typename std::iterator_traits<typename T::iterator>::value_type
            return std::visit((_Func)(auto&& arg) -> typename std::iterator_traits<typename T::iterator>::value_type
                        return _Func(arg);
                    }, x);
    return returnObject;

The other parts:

template<typename T>
concept is_iterable = requires(T x)
    x.begin();      // must have `x.begin()` 
    x.end();        // and `x.end()` 

template<typename T>
concept is_element_iterable = requires(T x)

template<class T, class _Fn> requires is_iterable<T>
static T recursive_transform(const T _input, _Fn _Func);       //  Deal with the iterable case like "std::vector<long double>"

template<class T, class _Fn> requires is_iterable<T>
static inline T recursive_transform(const T _input, _Fn _Func)
    T returnObject = _input;

    std::transform(_input.begin(), _input.end(), returnObject.begin(), _Func);
    return returnObject;

template<class T, class _Fn> requires is_iterable<T> && is_element_iterable<T>
static T recursive_transform(const T _input, _Fn _Func);

template<class T, class _Fn> requires is_iterable<T> && is_element_iterable<T>
static inline T recursive_transform(const T _input, _Fn _Func)
    T returnObject = _input;
    std::transform(_input.begin(), _input.end(), returnObject.begin(),
        (_Func)(auto& element)
            return recursive_transform(element, _Func);
    return returnObject;

int main()
    std::vector<long double> testVector1;
    std::cout << recursive_transform(testVector1, ()(long double x)->long double { return x + 1; }).at(0) << std::endl;

    std::vector<long double> testVector2;

    std::vector<std::vector<long double>> testVector3;
    std::cout << recursive_transform(testVector3, ()(long double x)->long double { return x + 1; }).at(1).at(1) << std::endl;
    std::vector<std::variant<long double>> testVector4;

    auto operation_to_element = ()(long double number) { return number + 2; };

    std::visit(()(auto&& arg) {std::cout << arg; },         //  For printing
        recursive_transform(testVector4, operation_to_element).at(0)

    return 0;   

All suggestions are welcome.

The summary information:

  • Which question it is a follow-up to?

    A TransformAll Function For Various Type Arbitrary Nested Iterable Implementation in C++

  • What changes has been made in the code since last question?

    • Rename function to recursive_transform to match the conventions of the STL.
    • The copy operation of the input is avoided by updating auto &element.
    • Remove the redundant part in lambda function ->auto
  • Why a new review is being asked for?

    I think the concept is_element_variant may be improved and I am looking forward to any suggestion for possible improvement ways. Moreover, in my opinion of the part of the template function recursive_transform which handle the std::variant structure, implementation here is complex, there are two nested lambda function. If there is any possible to simplify this, please let me know.

Display category filters for custom post type when category is shared by multiple post types

I already have a solution to this problem but I’m wondering if there’s a more efficient way to do it. I have a custom post type called “galleries” that uses the same taxonomy as blog posts. So if a user creates a category named “Animals” when making a blog post, that category will show up as an option when creating a new gallery.

On the gallery display page, I want to output a list of categories in a select element which are used to filter the galleries. However, if no galleries are using the category “Animals”, that category shouldn’t be displayed, since selecting it will return no results.

Here’s how I solved this so far:

  // 1. Get all the categories
  $categories = get_categories( array(
     'orderby'   => 'name',
     'order'     => 'ASC'
  ) );


// 2. Loop through the categories
foreach($categories as $cat) {

  // 3. Get the ID of the current category
  $category_id= get_cat_id($cat->name);

  // 4. Query the galleries post type for posts using the current category
  $args = array(
    'post_type' => 'galleries',
    'category' => $category_id
  $posts = get_posts($args);

   // 5. Count the number of posts using the current category
   $count = count($posts);

   // 6. Display the option if that number is greater than 0
   if($count > 0) { ?>

     <option value="<?php echo $cat->slug; ?>"><?php echo $cat->name; ?></option>

   <?php } ?>


It seems like that’s a lot of steps and maybe I’m doing this in a roundabout kind of way. Is there a more efficient way to do this? Thanks in advance.

application design – Android app development (daily journal type)

I want to get help from you all about building an android app that is capable of logging daily journal type data. I want to have these feature primarily in the app:

  1. Capable of logging the daily logs.
  2. Some way to save data to some cloud storage app like, Google drive
  3. Login with eMail feature for password recovery
  4. In built App lock
  5. Backup could have been done as a text file
  6. Search possible by date, by keywords (keywords are something like hashtags or labels so that user can tag days as happy days, sad days etc (like people do in their blogs sometimes))
  7. Last but not least, having some nice UI

I’m really newbie so I don’t know where to start and what all things I need to learn in order to make this project.
All you people have to do is list down the things I should learn to make this project into reality


  • I am doing this for my own curiosity and fun.
  • It would be even more good if you suggest some things from your experience.

I would be really thankful to you all.

How do you speficy the type of variable from python to C in Ctypes?

Currently I’m learning about C types. I have a piece of C code. It is not the whole code, but I think the rest is not relevant to share. The sin and cos function are defined above in the original code.


double tan(f) double f;
       return sin(f)/cos(f); 


import ctypes

testlib = ctypes.CDLL('./')

testlib.tan.argtypes = ctypes.c_double
teslib.tan.restype = ctypes.c_double


First I didn’t use the lines:

testlib.tan.argtypes = ctypes.c_double
teslib.tan.restype = ctypes.c_double

I got an output, but the ouput was 0. I thought that the double value was downcasted to an int.

What I want to achieve is that I send an double from python to C, and C will return me a double.

I’m already familiar with this documentation, but I didn’t manage to find the right answer:

Question: How should I modify my code to get the good output?