text:
Q: How to get Rid of this error: not all code paths return a value? int search(string [][]mat, int n, string x){
//set indexes for top right element
    for(int i = 0; i<n; i++)
    {
        for(int j = n-1; j>=0; j--)
        {
                     if ( mat[i][j] == x )
              {
                 Debug.Log(x +""+"Found at "+i +" "+j);
                // int[] n2 = new int[] {2, 4, 6, 8};
                // int [] xyz = new int [] {i, j};
                           return i;

              }

        }
    }}

How to get Rid of this error: not all code paths return a value?
Error:
*Assets/Scripts/Chess/Bishop.cs(237,22): error CS0161: `Bishop.search(string[][], int, string)': not all code paths return a value*

A: Work out what you want to happen if you never find x, and return that at the end of the method. For example:
// Fixed naming conventions and indentation...
// Why do we need n here at all? Why not just use the length of the array?
int Search(string[][] mat, int n, string x)
{
    //set indexes for top right element
    for (int i = 0; i < n; i++)
    {
        // Why are we looking backwards here?
        for (int j = n - 1; j >= 0; j--)
        {
            if (mat[i][j] == x)
            {
                // More readable formatting...
                Debug.Log(string.Format("{0} found at {1}, {2}", x, i, j));
                return i;
            }
        }
    }
    // Not found: return -1 to indicate failure. Or you could throw an exception
    return -1;
}

More generally: the compiler error message was reasonably clear here - there was a way that you could get to the end of the method without returning anything. It's worth taking a step back and trying to think about why you couldn't work this out yourself. Did you pay enough attention to the compiler error message? Had you though through everything the method might do, in all situations? How could you handle this better next time?

A: You need to add a return outside of the loop.
Think about it: What if you would pass in -1 for n? The loop would never execute, hence the currently existing return would never be reached. The same happens if the mat array doesn't contain x.
int search(string [][]mat, int n, string x)
{
    for(int i = 0; i<n; i++)
    {
        for(int j = n-1; j>=0; j--)
        {
            if ( mat[i][j] == x )
            {
                Debug.Log(x +""+"Found at "+i +" "+j);
                return i;
            }
        }
    }

    return -1; // <----
}

A: You not returning anything outside of your loop. This is because you getting this error message. Use it like this;
int Search(string [][]mat, int n, string x)
{
    //set indexes for top right element
    for(int i = 0; i<n; i++)
    {
        for(int j = n-1; j>=0; j--)
        {
            if (mat[i][j] == x)
            {
                Debug.Log(x +""+"Found at "+i +" "+j);
                // int[] n2 = new int[] {2, 4, 6, 8};
                // int [] xyz = new int [] {i, j};
                return i;

            }
        }
    }
    return -1;
}

A: this happens because all possible execution path of your code not returns a value.try returning some value out of for loop like this :
int search(string [][]mat, int n, string x){
        //set indexes for top right element
            for(int i = 0; i<n; i++)
            {
                for(int j = n-1; j>=0; j--)
                {
                             if ( mat[i][j] == x )
                      {
                         Debug.Log(x +""+"Found at "+i +" "+j);
                        // int[] n2 = new int[] {2, 4, 6, 8};
                        // int [] xyz = new int [] {i, j};
                                   return i;

                      }

                }
            }
      return -1;
    }


text:
Q: WPF GUI Performance with a large number of parallel tasks I developed a small client (WPF) to make some stress test on our systems. Essentially it has to call various methods on an Asp.Net WebApi endpoint in parallel.
Each time you press "Start" it generates 4000 tasks (Async - Await) in parallel with request to stress, waits until they all finish, then it does it again - until the user clicks the stop button. The GUI is decorated with a progress bar and some counters: requests in error, completed request, in progress requests. I obtain these informations because the object that makes the batch of stress requests exposes some events:
var stressTestTask = new stressTestTask(LogService, configuration);

stressTestTask.ErrorRequestCountChanged += stressTestTask_ErrorRequestCountChanged;
stressTestTask.GoodRequestCountChanged += stressTestTask_GoodRequestCountChanged;
stressTestTask.TryRequestCountChanged += stressTestTask_TryRequestCountChanged;

_executionCancellationToken = new CancellationTokenSource();

await Task.Run(
    () => stressTestTask.ApiStressTestTask(_executionCancellationToken.Token),
    _executionCancellationToken.Token);

The whole execution is started from an ICommand (MVVM):
private RelayCommand _startCommand;
public RelayCommand StartCommand
{
    get
    {
        return _startCommand ?? (_startCommand = new RelayCommand(
            async () =>
            {
                await StartStressTest();
            }));
    }
}

RelayCommand is an implementation of ICommand from the library Mvvm-Light.
What I don't understand is this behaviour: if I configure my batch of tasks with a "low" number of tasks, for example 2000, the GUI doesn't freeze while executing. If instead I choose 5000 tasks, after a while it freezes. If then I open another instance of the .exe of my client and I choose 2000 on each, the GUI is responsive in both.
My first question is: why opening one instance with x tasks is worse in terms of responsivness than opening n instances with x/n tasks? Is it something related to Windows Scheduler and the fact that in the first case I have only one process?
My second questions is: how can I address the problem to make everything work on a single GUI? I thought about making a console application with the single batch of stress tests and calling a command from the GUI for each instance I want, in order to generate a process for every batch.

A: Are you handling those API events by invoking to the UI context? If you have many invocations occurring you will flood the dispatcher with operations and cause the UI to hang and lag behind user input.
Try batching the UI updates.

A:
My first question is: why opening one instance with x tasks is worse in terms of responsivness than opening n instances with x/n tasks?

Possibly because you are getting more events to handle on the UI thread. I guess your ErrorBetCountChanged, GoodRequestCountChanged and TryRequestCountChanged event handlers are invoked on the UI thread and a lot of events being raised may flood the UI thread.
As Gusdor suggets you should probably find a way of batching the updates. Take a look at the reactive extensions (Rx): http://www.introtorx.com/content/v1.0.10621.0/01_WhyRx.html.
It has a Buffer method that may come in handy: http://www.introtorx.com/content/v1.0.10621.0/13_TimeShiftedSequences.html.
It also has en Obervable.FromEvent method that you can use to convert an event into an IObservable: https://msdn.microsoft.com/en-us/library/hh229241(v=vs.103).aspx.

My second questions is: how can I address the problem to make everything work on a single GUI?

You need to find a way - one or anoher - of updating the UI less frequently. Batching the updates and events should be a good starting point. Raising less notifications is another option. Maybe you need to both.

A:
how can I address the problem to make everything work on a single GUI?

Send API requests in "proper" async-await manner with only one thread.
private async Task SendStressRequests()
{
    var tasks = new List<Task>();
    for (int i = 0; i < 4000; i++)
    {
        var task = SendApiRequestAsync();
        tasks.Add(task);
    }

    await Task.WhenAll(tasks);
    // Update UI with results
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why qmake-builded Qt Quick app uses threaded render loop, and same CMake-builded app uses basic render loop? Created two versions of empty Qt Quick Application.
First with qmake build system.
Second with CMake build system.
Added in each application following code for logging purposes:
#include <QLoggingCategory>

int main(int argc, char *argv[])
{
    QLoggingCategory::setFilterRules(R"(
qt.scenegraph.general=true
)");

First app (qmake-builded) output:
qt.scenegraph.general: threaded render loop

Second app (CMake-builded) output:
qt.scenegraph.general: QSG: basic render loop

Why qmake-builded app uses threaded render loop, and CMake-builded app uses basic render loop?
What make difference? Are there any options add by qmake or CMake?
System environment:

*

*macOS Catalina 10.15.6 (19G2021)

*Qt 5.13.0

*Apple clang version 11.0.3 (clang-1103.0.32.62)


text:
Q: RegExp to convert inverse trigonometric funcion (e.g. sin^(-1)(x)) to proper notaion (e.g. asin(x)) I have a string:
sin^(-1)(x)*cos^(-1)(x)

I want to transfrom it into:
asin(x)*acos(x)

How can I do this with javascript RegExp, considering symbol ^ in RegExp is special?

A: If turning inverse trigonometric functions to their proper notation is what's required, you may go like that:

const str = `sin^(-1)(x)*cos^(-1)(x)/tan^(-1)(x^3)*ctg^(-1)(x^2)`,
      functions = ['sin', 'cos', 'tan', 'ctg'],
      regExp = new RegExp(`(${functions.join('|')})\\^\\(-1\\)`, 'g')

      result = str.replace(regExp, "a$1")

console.log(result)
.as-console-wrapper{min-height:100%;}


text:
Q: Django rest framework self.objects.all() as variable I have parent id in my model:
parent = models.ForeignKey("self", null=True)

and in serializer:
parent = serializers.PrimaryKeyRelatedField(queryset=Category.objects.all(), required=False)

It shows me selectbox with items: "Category object" as it saves all items like that. What I can do to show Category names?
And there is no None option in selectbox.
Another question:
How to show Categories in select with parent=None?

A: In you model Category,define __unicode__ method
class Category(models.Model):
   //your fields

    def __unicode__(self):
        return self.name


text:
Q: Webforms Ajax ASMX call 401 I have a Net 4.8 Webforms application that uses asmx webservice calls from javascript on one of our pages.  It is using forms authentication and has a session timeout of 20 minutes.
You log in to the site using a user id and password and it sets the authentication ticket and redirects to the start page.. all this works fine.. very normal web type stuff.
We have added a new page that, because of its nature, we need to keep it running indefinitely, so I created a simple 'KeepAlive' JavaScript function that calls an asmx web service to 'touch' the session so that it remains alive and so the 20 minute session timeout doesn't happen.
Here is the javascript KeepAlive function.. (there are a lot of other calls I've not included but are all of a similar type).
function KeepAlive() {
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        url: "ChartService.asmx/KeepAlive",
        success: function (json) {
            setTimeout(KeepAlive, 5 * 60 * 1000);    // every 5 mins
        },
        error: function (xhr, status, err) {
            console.log("KeepAlive AJAX ERROR",err + " " + xhr.status);
            return "";
        },
        complete: function (xhr, status) {
        }
    });
}

// in document.ready..
setTimeout(KeepAlive, 5 * 60 * 1000);    // every 5 mins

The server side code..  (again, lots of similar functions omitted)
<%@ WebService Language="VB" Class="TestService" %>

Imports System.Web.Services
Imports System.Web.Script.Services

<WebService(Namespace:="....")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
<ScriptService()>
Public Class ChartService
    Inherits WebService

    <WebMethod(EnableSession:=True)>
    <ScriptMethod()>
    Public Function KeepAlive() As String
        Try
            Return "OK"
        Catch ex As Exception
            Return GenericFunctions.ConvertToJSON(ex)
        End Try
    End Function

End Class

the ConvertToJSON just does this..
    Public Shared Function ConvertToJSON(ByVal ex As Exception) As Object
        Dim json As New Dictionary(Of String, String)

        json.Add("error_message", ex.Message)
        json.Add("error_stackTrace", ex.StackTrace)

        Return json
    End Function

On my machine everything works fine, I don't get any errors no matter how long I leave it.
I gave my code to someone else and on their machine, it's not working properly. At first everything is fine and the ajax calls work ok, but then it will start giving 401 errors..  length of time can vary from immediately to several minutes before it starts happening.
He's using the same web.config as me and using the local IIS with just an http url.
I don't know what to try as it works on mine so has to be an environmental problem I'd think.


text:
Q: How to draw a pentagon shaped graph with edges only on the outside? I've managed to find the graph below but I would like for the edges to only be between consecutive outside points (ie (1,2), (2,3), ..., (5,1))
\documentclass[border=3mm,tikz]{standalone}

\begin{document}
\begin{tikzpicture}[
 every node/.style={draw,shape=circle,fill=blue,text=white}]
 %%%% variable data data
\def\numpoly{8}%number of nodes
\def\startangle{30}%direction of the first node
\def\pradious{33mm}
%------- calculations of the positions angles
\pgfmathparse{int(\startangle+360/\numpoly)}%
    \let\nextangle=\pgfmathresult
\pgfmathparse{int(\startangle-360/\numpoly+360)}%
    \let\endtangle=\pgfmathresult
%--- nodes
    \foreach \i [count=\ii from 1] in {\startangle,\nextangle,...,\endtangle}
\path (\i:\pradious) node (p\ii) {\ii};
%--- interconnections
    \foreach \x in {1,...,\numpoly}
        \foreach \y in {\x,...,\numpoly}
\draw (p\y) -- (p\x);
    \end{tikzpicture}
\end{document}

This is my first time using latex so sorry if this is super easy and I've just missed it!

A: TikZ has these shapes predefined.
\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
 \node[regular polygon,regular polygon sides=8,draw,minimum width=6cm]
 (octagon){};
 \foreach \X [count=\Y] in {8,...,1}
 {\node[draw,shape=circle,fill=blue,text=white] at (octagon.corner \X){\Y}; }
\end{tikzpicture}
\end{document}

ADDENDUM: Just for fun, if you want to relabel the corners arbitrarily, this trick may help.
\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
 \node[regular polygon,regular polygon sides=8,draw,minimum width=6cm]
 (octagon){};
 \foreach \X [evaluate=\X as \Y using {ifthenelse(int(mod(\X+1,8))==0,8,
 int(mod(\X+1,8)))}] in {1,...,8}
 {\node[draw,shape=circle,fill=blue,text=white] at (octagon.corner \X){\Y}; }
\end{tikzpicture}
\end{document}

Instead of \X+1 you can put whatever, e.g. 5-\X.
or you could just use rotate to get the same layout as in your picture:
\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
 \node[rotate=-30,regular polygon,regular polygon sides=8,draw,minimum width=6cm]
 (octagon){};
 \foreach \X in {1,...,8}
 {\node[draw,shape=circle,fill=blue,text=white] at (octagon.corner \X){\X}; }
\end{tikzpicture}
\end{document}


text:
Q: java.time - Is there a function to find number of a specific day (day of week, or day of month) between two days? So is there a function or something which you give two dates and a day of week (ex. Saturday) and it returns the number of Saturdays between the two dates?
The problem with trying to use ChronoUnit.WEEKS.between and dividing the result by 7 is that it won't work if you have something like 4 days (because it's not a full week), or 10 days (because it'll be counted as one week).
Another idea maybe to use a loop and check if a day is Saturday, but this way is inefficient and slow for large time ranges.
What about a similar function but rather than a day of week, it counts the occurrences of a day of month (ex. 15th of any month), or a day of year (ex. April 4th of any year).
If there are no such functions, what may be an efficient way to do this?

A: As others commented, you need to write your own code. But java.time and Java Streams get you most of the way.
The LocalDate::datesUntil method generates a stream of LocalDate objects. Test each for its DayOfWeek. Collect the hits.
Something like this untested example code.
ZoneId z = ZoneId.of( "America/Montreal" ) ;
LocalDate start = LocalDate.now( z ) ;
LocalDate then = today.plusDays( 177 ) ;
Stream < LocalDate > dates = start.datesUntil( then ) ;
List < LocalDate > saturdays =
        dates
        .filter(
            date ->
                date
                .getDayOfWeek()
                .equals( DayOfWeek.SATURDAY )
        )
        .collect(
            Collectors.toList()
        )
;

You expressed a concern about efficiency. I suspect you are falling into the trap of premature optimization. Is your app really performing this operation thousands of times per minute all day? If not, performance is likely not a problem.
Always write simple straightforward code first. Then test empirically with the Microbenchmarks Suite and with a profiler to see if your concerns are valid.


text:
Q: Android BLE disconnect every 40 seconds and reconnects again after 20 seconds I am implementing an Android app the connects to BLE device. Every time the device is connected to the mobile, it automatically disconnects after 40 seconds and then auto-reconnect after 20 seconds. This issue is very significant on Samsung Galaxy Tab 4 running Android 4.4.2.
Why this auto-disconnect happens? and how to fix it?


text:
Q: docker Container command '/hello' not found or does not exist after switching hard drive I have changed my hard drive and before switching I copied all data from old hard drive to new one using rsync. Everything is working fine in the new SSD. However, I wasn't able to run docker containers. I tried uninstalling and reinstalling and tried the example command in the docs:
sudo docker run hello-world

But I am getting this error:
docker: Error response from daemon: Container command '/hello' not found or does not exist..

Not sure if it is related to storage drivers since it was working fine on my old HDD. I tried changing the storage drivers in the /etc/default/docker file by modifying the line:
# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 --storage-driver=devicemapper"

It switches to devicemapper but I am still getting the same error

A: try to change "build: ." to "image hello-world" in .yml file


text:
Q: How to process FLT_MAX in GLSL for Vulkan I have an algorithm which I try to implement in GLSL for Vulkan. That algorithm uses FLT_MAX.
Now I could define that to an arbitrary high float value but I really would be interested in how to actually e.g. process that value on runtime in GLSL.

A: Vulkan shaders are required to support single-precision IEEE-754 representation, with a few exceptions detailed in the Vulkan SPIR-V environment spec. So FLT_MAX should work the way you expect it to in C/C++.


text:
Q: Category Search in magento I'm using magento 1.9. I'm trying to implement category search. My form is simple checkbox where users can enter categories they want with comma separated values and the next page will display products of both category (OR condition).
Currently default catalog search will display all products have category name is any of their attributes.
I googled a lot but did not find any proper solution for my problem. Is there any built in script which I can use? Or any function in catalogsearch module I should edit to make it work?
Thank you.

A: Multiple category searches does not work in default Magento. But, you can always use single category search using the below-mentioned code
www.domain.com/catalogsearch/result/?q=abc&catid=1

in URL


text:
Q: NSSavePanel can't change file name In my mac app I'm using NSSavePanel - but it's behaving very strange. Sometimes I can't change the default name of the file.
I'm using it like this:
NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setAllowedFileTypes:@[@"jpg"]];
[savePanel setLevel:CGShieldingWindowLevel()];

if([savePanel runModal] == NSFileHandlingPanelOKButton)
{
    //saving file
}

I can't find why sometimes it lets me change the file name and other times no, I can save a file but a changing name in save panel is blocked

A: Have you tried providing a default name?
[savePanel setNameFieldStringValue:@"New File.txt"];

A: Swift 4
let panel = NSSavePanel()
panel.nameFieldStringValue = "filename.txt" // <-- user editable prompt

if panel.runModal() == NSApplication.ModalResponse.OK, let url = panel.url {
    // use url path here
}

A: This is so strange but I would like to share my solution. As @Rupert Pupkin described, I already used nameFieldStringValue but there was strange behaviour of NSSavePanel, it was not changing the name sometimes, and sometimes was changing. So I see I did not describe level of my NSSavePanel
savePanel.nameFieldStringValue = "YourFileName"
savePanel.level = NSWindow.Level.modalPanel

This two lines of code with together worked for me.
My current NSSavePanel code is like that:
let savePanel = NSSavePanel()
savePanel.title = "Download File"
savePanel.prompt = "Download"
savePanel.message = "Choose a directory to save your scanned document"
savePanel.nameFieldStringValue = "myfile"
savePanel.level = NSWindow.Level.modalPanel

savePanel.showsTagField = false
savePanel.isExtensionHidden = false
savePanel.canCreateDirectories = true

Hope that helps!

A: This is not a proper answer, but may shed some light on the issue (which I'm struggling with as well).
What I have found so far, is that if you do not have an active window when you call
result = panel.runModal() // swift
NSModalResponse result = [panel runModal]; // Obj-C

Then the behavior of NSSavePanel is broken, and although you can click in the name field you can't type there (beeps if you try).
I also found an ugly little workaround. If you allow creating new directories,
    panel.canCreateDirectories = YES;  // Obj-C

and press the button in the save panel to do this - a small sheet (yet another window...) appears on top of the NSSavePanel and if you cancel and dismiss this sheet - you regain ability to type in the name field.
Since OP did not provide any description of the programmatic scenario and environment for his issue, but it seems related since forcing the window-level to be "modal" fixed the issue for him.
In my case (I'm opening NSSavePanel from a menu-bar item pop-over window. Alas the popover closes BEFORE my NSSavePanel manages "to attach to it". Manually setting the level
panel.level = NSWindow.Level.modalPanel // Swift
panel.level = NSModalPanelWindowLevel;  // Obj-C

did NOT help resolve the issue.


text:
Q: Count elements in each sub array in php An example from php.net provides the following
<?php
$food = array('fruits' => array('orange', 'banana', 'apple'),
          'veggie' => array('carrot', 'collard', 'pea'));

// recursive count
echo count($food, COUNT_RECURSIVE); // output 8

// normal count
echo count($food); // output 2
?>

How can I get the number of fruits and the number veggies independently from the $food array (output 3)?

A: Could you be a little lazy, rather than a foreach with a running count twice and take away the parents.
// recursive count
$all_nodes = count($food, COUNT_RECURSIVE); // output 8

// normal count
$parent_nodes count($food); // output 2

echo $all_nodes - $parent_nodes; // output 6

A: You can use this function count the non-empty array values recursively.
function count_recursive($array)
{
    if (!is_array($array)) {
       return 1;
    }

    $count = 0;
    foreach($array as $sub_array) {
        $count += count_recursive($sub_array);
    }

    return $count;
}

Example:
$array = Array(1,2,Array(3,4,Array(5,Array(Array(6))),Array(7)),Array(8,9));
var_dump(count_recursive($array)); // Outputs "int(9)"

A: You can do this:
echo count($food['fruits']);
echo count($food['veggie']);

If you want a more general solution, you can use a foreach loop:
foreach ($food as $type => $list) {
    echo $type." has ".count($list). " elements\n";
}

A: Just call count() on those keys.
count($food['fruit']); // 3
count($food['veggie']); // 3


text:
Q: Java - Background song to my game (How can I add it) I'm trying to create a game and I'm currently trying to add sounds to it but due to lack of experience I failed to do so so I'm asking for your help.
How can I add a background song to my game?

A: start a separate thread for playing sound. In this thread play it. In this way your game will be running and at same time you can run the sound.
public static synchronized void playSound(final String url) {
  new Thread(new Runnable() {
  // The wrapper thread is unnecessary, unless it blocks on the
  // Clip finishing; see comments.
    public void run() {
      try {
        Clip clip = AudioSystem.getClip();
        AudioInputStream inputStream = AudioSystem.getAudioInputStream(
          Main.class.getResourceAsStream("/path/to/sounds/" + url));
        clip.open(inputStream);
        clip.start();
      } catch (Exception e) {
        System.err.println(e.getMessage());
      }
    }
  }).start();
}

A: public static void music() {
            AudioPlayer MGP = AudioPlayer.player;
            AudioStream BGM;
            AudioData MD;
            ContinuousAudioDataStream loop = null;

            try {
                BGM = new AudioStream(new FileInputStream("som.wav"));
                MD = BGM.getData();
                loop = new ContinuousAudioDataStream(MD);
            } catch(IOException error)  {
                System.out.println("Error!!!");

            }
            MGP.start(loop);
        }


text:
Q: Java Web Start NumberFormatException while running Jar application While trying to run Jar application using JWS (JNLP) launch. It has been giving me this error. Can't even find where is the mistake. Any directions would help.
If someone could tell me where is the potential location of this error, I could find post that code here.
java.lang.NumberFormatException: For input string: "\Tools_Dev\TestApp\dist"
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at com.sun.deploy.security.DeployManifestChecker.verifyCodebaseEx(Unknown Source)
    at com.sun.deploy.security.DeployManifestChecker.verifyCodebase(Unknown Source)
    at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
    at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
    at com.sun.javaws.security.AppPolicy.grantUnrestrictedAccess(Unknown Source)
    at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
    at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
    at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
    at com.sun.javaws.Launcher.launch(Unknown Source)
    at com.sun.javaws.Main.launchApp(Unknown Source)
    at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
    at com.sun.javaws.Main.access$000(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Note: I have the latest Java 8 installed and working on Netbeans.
The jar file works well if called manually, java -jar testTool.jar
Update:
JNLP File Content:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="file:/C:/Tools_Dev/TestApp/dist/" href="launch.jnlp" spec="1.0+">
    <information>
        <title>Java Tool Update Test</title>
        <vendor>Local</vendor>
        <description>Test Tool</description>
        <offline-allowed/>
    </information>
    <security>
        <all-permissions/>
    </security>
    <update check="background"/>
    <resources>
        <j2se version="1.7+"/>
        <jar href="Java-Tool-Update-Test.jar" main="true"/>
        <jar href="lib/sqlite-jdbc-3.7.15-M1.jar"/>
        <jar href="lib/poi-3.10-FINAL-20140208.jar"/>
        <jar href="lib/poi-ooxml-3.10-FINAL-20140208.jar"/>
        <jar href="lib/poi-ooxml-schemas-3.10-FINAL-20140208.jar"/>
        <jar href="lib/dom4j-1.6.1.jar"/>
        <jar href="lib/xmlbeans-2.3.0.jar"/>
        <jar href="lib/jaxen-1.1.6.jar"/>
    </resources>
    <application-desc main-class="Tool.Test.Main">
    </application-desc>
</jnlp>

Errors prompted in JaNeLa tool excluding warnings and optimizations:
JaNeLA Report - version 11.05.17
cvc-complex-type.2.4.a: Invalid content was found starting with element 'security'. One of '{resources, application-desc, applet-desc, component-desc, installer-desc}' is expected.
cvc-complex-type.2.4.a: Invalid content was found starting with element 'security'. One of '{resources, application-desc, applet-desc, component-desc, installer-desc}' is expected.
Lazy downloads might not work as expected for lib/sqlite-jdbc-3.7.15-M1.jar unless the download 'part' is specified.
Lazy downloads might not work as expected for lib/poi-3.10-FINAL-20140208.jar unless the download 'part' is specified.
Lazy downloads might not work as expected for lib/poi-ooxml-3.10-FINAL-20140208.jar unless the download 'part' is specified.
Lazy downloads might not work as expected for lib/poi-ooxml-schemas-3.10-FINAL-20140208.jar unless the download 'part' is specified.
Lazy downloads might not work as expected for lib/dom4j-1.6.1.jar unless the download 'part' is specified.
Lazy downloads might not work as expected for lib/xmlbeans-2.3.0.jar unless the download 'part' is specified.
Lazy downloads might not work as expected for lib/jaxen-1.1.6.jar unless the download 'part' is specified.

A: Posting this here in case someone has that very same error, even with java 8 Update 101:
In our specific case, after a few hours of digging, the problem ended up being  that NetBeans version 7.4 was putting some useless junk on the Codebase property of the jar's MANIFEST.MF; by going into the project properties, Application -> Web Start and then changing Codebase  to User defined and Codebase Preview to *, the application started working correctly.
Please do keep in mind that we're using an applet instead of a JNLP application, so your mileage may vary.

A: Looks like a known issue... See Bug #236765
Upgrading your Java version as specified in the bug.

Not a NB issue, javaws problem. I've tested
  https://netbeans.org/kb/73/java/javase-jws.html with JDK 1.7.0_45 and
  works fine.Please update JDK   JRE.


text:
Q: How to get notification on the dashboard? I have articles section in my application , and I want to show a flash notification on the dashboard for all the users who in my application if they are logged in or when they log in , when a user post a new article ?
How can I do so ? and I need an explain because I asked before and I didn't get any answers.
i need something like this !

A: Instead of flash messages, you seem to be looking for "One-off announcements" or "Side-wide annoucements".
Two great resources, all here listed Plugingeek, might help you.

*

*paul_revere by thoughtbot: Simple announcement plugin to include "one off" style announcements in Rails web apps.

*Site-wide annoucements RailsCast (pro)


text:
Q: Will a cable HDMI to M1-DA work? My laptop (Dell XPS l502x) has only HDMI. And a couple of days ago I bought an used projector, without cables. It was said it accept DVI, so before it arrive I bought an HDMI to DVI cable, but when it came here I noticed that it was not DVI but M1-DA(P&D) instead (which is visually similar).
So now I need an adpter from HMDI or DVI to M1-DA (I am thinking of buying this). But after that I remember that to  connect my laptop to VGA I have a converter, not adapter, cause it is digital to analogue signal. Will it be the same with the M1-DA

A: If it will be helpful for anyone else, yes it works.
I was just not sure whether M1-DA is digital or not, cause I found some people saying that this  kind of adapters do not work just like I saw some dumb people complaining about HDMI to VGA cables which don't work.
But I I bought one anyway to see (the link in the question) and it works perfectly.


text:
Q: Alternative to using Webclient to get HTML output A product I've inherited is using WebClient to read HTML from a MVC based site. Each page is a different type of e-mail, so in order to compose and send an e-mail they use WebClient to request a URL and download the string.
            var outputHtml = string.Empty;
            using (WebClient client = new WebClient())
            {
                client.Encoding = Encoding.UTF8;
                outputHtml = client.DownloadString(emailURL);
            }
            return outputHtml;

Is there a way to remove the need to host this email based site but retain most of this code. I guess what I need to do is pass my request to the controller and retrieve the output after the razor engine has passed the view model through the cshtml page.
Is that possible?

A: There are many ways you could render a Razor view to a string. One possibility is to use RazorEngine. Another possibility is to use some specifically designed framework for this purpose such as Postal.


text:
Q: JQuery Sortable Accordion moving to top with code I am building a sortable accordion with jquery which works perfectly fine but I want it so when someone clicks on on of the items in the accordion and it opens up that it is automatically moved to the top of the list without the person having to drag it to the top. Is that possible to code?

A: You can simply use prepend to move the element to the top of list. The HTML is taken from jQuery UI's demo page, with the addition of this line here that moves the element to the top of the list:
$("#accordion h3").click(function(event) {
    $(this).closest('div').prependTo('#accordion');
});

Have a look at the live demo here: http://jsfiddle.net/4jkvg/1/


text:
Q: regex matching a pattern but only replacing a part of the match in R I am trying to understand backreferences, and I think a simple example would help me.
Say I have the string "$1 per kayak + 40k + $10 per kite sold" and want it to be "$1 per kayak + 40000 + $10 per kite sold"
How can I do this in REGEX in R?  I clearly don't just want to replace "k" with "000".  I also can't just use sub() because the match might not be the first occurrence in the string.

A: Edit: Adding ignore.case based on @WiktorStribiżew 's comment
string  = "$1 per kayak + 40k + $10 per kite sold"
gsub("(\\b\\d+)k\\b", "\\1000", string,  ignore.case=TRUE)
[1] "$1 per kayak + 40000 + $10 per kite sold"


text:
Q: Outlook, VBA macro, Connection string to SQL Server Express I am new in VBA via Outlook, so ...
I use Outlook 2016, and SQL Server 2017, and I try to connect a macro to SQL Server Express 2017 via ADODB.
Here is my code
    On Error GoTo ErrorHandler

    Dim cnnStr As String

    cnnStr = "Provider=SQLOLEDB;" & _
             "Server=ALTROISIEME\SQLEXPRESS;" & _
             "Initial Catalog=XX_Options;" & _
             "Trusted_Connection=SSPI;" & _
             "uid=xxxx;" & _
             "pwd=xxxxxx;"

    'GoTo Fin_99

    Dim cnn As New ADODB.Connection
    cnn.CommandTimeout = 900
    cnn.ConnectionString = cnnStr
    cnn.Open

    GoTo Fin_99

    Dim cmd As ADODB.Command
    Set cmd.ActiveConnection = cnn
    cmd.CommandType = adCmdStoredProc
    cmd.CommandText = "USP_Outlook_Add_File_Data"
    cmd.Parameters.Append cmd.CreateParameter("@Categorie", adVarWChar, adParamInput, , "IB_DailyTrade")
    cmd.Parameters.Append cmd.CreateParameter("@NomDuFichier", adVarWChar, adParamInput, , FileNameExt)
    cmd.Parameters.Append cmd.CreateParameter("@Donnee", adVarWChar, adParamInput, , HTMLTxt)

    Dim rst As New ADODB.Recordset
    rst.CursorType = adOpenStatic
    rst.CursorLocation = adUseClient
    rst.LockType = adLockOptimistic
    rst.Open cmd

    Set rst = cmd.Execute

ExitNewItem:
    GoTo Fin_99
ErrorHandler:
    MsgBox Err.Number & " - " & Err.Description
    Resume ExitNewItem

Fin_99:

On Error GoTo CloseRst
    cnn.Close
    Set cnn = Nothing

CloseRst:
    rst.Close
    Set rst = Nothing

The macro throws an error on line
Set cmd.ActiveConnection = Cnn

with a message.

91-Variable object or variable of block not defined

Could you help?
Thank you
André

A: I found all my issues. The code is not so far from my initial post:
    On Error GoTo ErrorHandler

    Dim cnnStr As String

    cnnStr = "Provider=SQLOLEDB;" & _
             "Server=?????????\SQLEXPRESS;" & _
             "Initial Catalog=???????;" & _
             "Trusted_Connection=SSPI;" & _
             "uid=???;" & _
             "pwd=???;"

    Dim cnn As New ADODB.Connection
    Set cnn = New ADODB.Connection
    cnn.CommandTimeout = 900
    cnn.ConnectionString = cnnStr
    cnn.Open

    Dim cmd As ADODB.Command
    Set cmd = New ADODB.Command
    cmd.ActiveConnection = cnn
    cmd.CommandType = adCmdStoredProc
    cmd.CommandText = "USP_Outlook_Add_File_Data"
    cmd.Parameters.Append cmd.CreateParameter("@Categorie", adVarWChar, adParamInput, 50, "IB_DailyTrade")
    cmd.Parameters.Append cmd.CreateParameter("@NomDuFichier", adLongVarWChar, adParamInput, -1, FileNameExt)
    cmd.Parameters.Append cmd.CreateParameter("@Donnee", adLongVarWChar, adParamInput, -1, HTMLTxt)

    Dim rst As New ADODB.Recordset
    Set rst = New ADODB.Recordset
    rst.CursorType = adOpenStatic
    rst.CursorLocation = adUseClient
    rst.LockType = adLockOptimistic
    rst.Open cmd

    Set rst = cmd.Execute

ExitNewItem:
    GoTo Fin_99
ErrorHandler:
    MsgBox Err.Number & " - " & Err.Description
    Resume ExitNewItem

Fin_99:

    If cnn.State = 1 Then
       cnn.Close
       Set cnn = Nothing
    End If

    If rst.State = 1 Then
       rst.Close
       Set rst = Nothing
    End If


text:
Q: Find Amount of Values in an Array Problem
So, this is pretty straight forward; I am making a program that asks for some information (favorite numbers), and you separate the numbers by spaces, and that is sent to an array. Then, I need to find how many values are in the array.
Example
print "What is your favorite number? (if you have more than one, seperate by spaces)"
favoriteNumbersUnformat = gets.chomp
favoriteNumbers = favoriteNumbersUnformat.split(' ').map(&:to_i)

Explanation & End
So, that block of code above will take some numbers, and send them to an array with it adding a new value for each space e.g 2 8 21 → [2, 8, 21]. That works just dandy but I want some way to have the program find how many values are in the array. That way, I could find out how many favorite numbers they have (for example).
I imagine this is a pretty simple problem and I thought something like this would have been asked before on Stackoverflow but I put in my title and I found nothing, over and over again. Even when I altered it a dozen times, it still didn't come up with what I want.
Any ideas? Thanks in advance!

A: favoriteNumbers.count

is the method you are looking for!


text:
Q: defining a new command with variable name in a loop I was trying to not write 26 redundant lines; \magic works on its own; but the loop breaks it
\usepackage{pgffor,amsfonts}
\newcommand{\magic}[1]{
  \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}
  \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}
  \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}   }
\foreach \x in {A,...,Z}{\magic{\x} }

A: Inside the pgffor loop, two things need to occur: you need to expand the \x before it gets to \magic; and the definitions inside \magic need to be global, to break out of the scope of the for loop.
I also removed a lot of stray spaces.
\documentclass{article}
\usepackage{pgffor,amsfonts}
\newcommand{\magic}[1]{%
  \expandafter\gdef\csname b#1\endcsname{\mathbb{#1}}%
  \expandafter\gdef\csname c#1\endcsname{\mathcal{#1}}%
  \expandafter\gdef\csname f#1\endcsname{\mathfrak{#1}}}
\begin{document}
\foreach \x in {A,...,Z}{\expandafter\magic\expandafter{\x}}

$\bX \cB \fH$
\end{document}

A: not perfect, but makes it short..
\usepackage{amsfonts,dowith}
\newcommand{\magic}[1]{
  \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}
  \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}
  \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}   }
\DoWith\magic ABCDEFGHIJKLMNOPQRSTUVWXYZ\StopDoing

A: With pgffor it could be made work in principle by adding an \expandafter but the definitions are local and done in a group so it would not achieve what you want. So just use a plain \loop.
\documentclass{article}
\usepackage{amsfonts}
\newcommand{\magic}[1]{%
  \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}%
  \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}%
  \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}%
}
\newcounter{iloop}
\setcounter{iloop}{0}%
\loop
\stepcounter{iloop}%
\edef\pft{\Alph{iloop}}%
\expandafter\magic\pft%
\ifnum\value{iloop}<26\relax
\repeat
\begin{document}

$\bB$
\end{document}

Needless to say that defining such macros is not a good idea if you ever plan to collaborate with others and share TeX files.

A: If you wish, you can accumulate calls to \magic in a scratch-macro:
\documentclass{article}
\usepackage{pgffor,amsfonts}
\newcommand\scratchmacro{}%
\newcommand\PassFirsToSecond[2]{#2{#1}}%

\newcommand{\magic}[1]{%
  \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}%
  \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}%
  \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}}%

\def\scratchmacro{}%
\foreach \x in {A,...,Z}{%
  \csname g@addto@macro%
  \expandafter\endcsname
  \expandafter\scratchmacro
  \expandafter{%
    \expandafter\magic
    \expandafter{\x}%
  }%
}%
\scratchmacro

\begin{document}
$\bX \cB \fH$
\end{document}

In this very special case you can play the \aftergroup-game—this only works as long as \x does yield exactly one token:
\documentclass{article}
\usepackage{pgffor,amsfonts}
\newcommand{\magic}[1]{%
  \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}%
  \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}%
  \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}}%

\foreach \x in {A,...,Z}{%
  \aftergroup\aftergroup
  \aftergroup           \magic
  \aftergroup\aftergroup
  \aftergroup           {%
  \aftergroup\aftergroup
  \expandafter\aftergroup\x
  \aftergroup\aftergroup
  \aftergroup           }%
}%

\begin{document}
$\bX \cB \fH$
\end{document}

If you don't mind typing the alphabet you can implement your own tail-recursive \magicloop—the \expandafter before \magicloop in the example below is needed to make the \fi go away before processing/expanding \magicloop and hereby "snapping" another non-delimited argument from the token-stream:
\documentclass{article}
\usepackage{amsfonts}
\newcommand{\magic}[1]{%
  \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}%
  \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}%
  \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}}%
\newcommand\magicloop[1]{%
  \ifx\relax#1\else\magic{#1}\expandafter\magicloop\fi
}%
\magicloop ABCDEFGHIJKLMNOPQRSTUVWXYZ\relax

\begin{document}
$\bX \cB \fH$
\end{document}

Or directly:
\documentclass{article}
\usepackage{amsfonts}
\newcommand\magicloop[1]{%
  \ifx\relax#1\else
    \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}%
    \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}%
    \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}%
  \expandafter\magicloop\fi
}%
\magicloop ABCDEFGHIJKLMNOPQRSTUVWXYZ\relax

\begin{document}
$\bX \cB \fH$
\end{document}

A:
Due to the character-limit for answers this answer is split in two parts.
This is part 1 of this answer.
Part 2 of this  answer can be found here: ⟨https://tex.stackexchange.com/a/539822/118714⟩

When putting your question on a more abstract level, then your question seems to be about iterating on a list of non-delimited macro arguments that contains an arbitrary amount of elements/arguments in order to achieve some sort of foreach-loop.
I can offer some fully expandable solutions where a marker for denoting the end of the list of arguments is not needed as the end of the list is determined by the emptiness of a macro-argument.
With all solutions actually a single macro-argument is processed iteratively which in turn consists of an arbitrary amount of non-delimited arguments.
So instead of
\DoWithEachElementOfArgumentList{⟨Argument 1⟩}{⟨Argument 2⟩}...{⟨Argument n⟩}
the pattern for arguments is:
\DoWithEachElementOfArgumentList{⟨tokens to put before each argument⟩}%
                                {⟨tokens when no (more) arguments are in list⟩}%
                                {⟨tokens to put behind each argument⟩}%
                                {% List of non-delimited macro-arguments:
                                  {⟨Argument 1⟩}%
                                  {⟨Argument 2⟩}%
                                  ...
                                  {⟨Argument n⟩}%
                                }%
This will deliver something like:
⟨tokens to put before each argument⟩{⟨Argument 1⟩}⟨tokens to put behind each argument⟩%
⟨tokens to put before each argument⟩{⟨Argument 2⟩}⟨tokens to put behind each argument⟩%
...
⟨tokens to put before each argument⟩{⟨Argument n⟩}⟨tokens to put behind each argument⟩%
⟨tokens when no (more) arguments are in list⟩
But there is one problem with macro-arguments:
Non-delimited macro-arguments can be wrapped in braces but wrapping them into braces is not necessary as long as they consist only of single tokens.
But there is one exception to that rule:
Space-tokens not wrapped into braces cannot be non-delimited arguments as TeX usually discards them when gathering a non-delimited macro-argument from the token-stream. Thus if a non-delimited macro-argument is to consist of a space-token or is to contain a leading space-token, that argument must be wrapped in braces.
The question arises how you wish space-tokens to be treated.
I suppose
\DoWithEachElementOfArgumentList{\foobar}{}{}{%
  {hello}{ }{world}{ }...
}%

should yield:
\foobar{hello}\foobar{ }\foobar{world}\foobar{ }\foobar{...

But what about:
\DoWithEachElementOfArgumentList{\foobar}{}{}{%
  {hello} {world}  ...
}%

Should that yield
\foobar{hello}\foobar{world}...

or shall it yield
\foobar{hello}\foobar{ }\foobar{world}\foobar{ }...

?
In other words:
Shall space-tokens not wrapped into braces within the list of non-delimited arguments be taken into account in the same way as if they were explicitly wrapped into braces { }? Shall such space-tokens be discarded silently?

Solution 1a—Space-tokens not wrapped into braces get silently discarded:
\documentclass{article}
\usepackage{amsfonts}

\makeatletter
%%-----------------------------------------------------------------------------
%% Paraphernalia:
%%.............................................................................
\newcommand\bracestripexchange[2]{#2#1}%
%%-----------------------------------------------------------------------------
%% Check whether argument is empty:
%% -- based on \ifempty-macro by Robert R Schneck:
%%  Newsgroup: comp.text.tex
%%  Subject: Macro puzzle: maximally general \ifempty
%%  Google-Groups-URL:
%%    <https://groups.google.com/forum/#!topic/comp.text.tex/kuOEIQIrElc>
%%.............................................................................
%% \CheckWhetherNull{<Argument which is to be checked>}%
%%                  {<Tokens to be delivered in case that
%%                    argument which is to be checked is empty>}%
%%                  {<Tokens to be delivered in case that
%%                    argument which is to be checked is not empty>}%
\long\def\CheckWhetherNull#1{%
  \romannumeral0\expandafter\@secondoftwo\string{\expandafter
  \@secondoftwo\expandafter{\expandafter{\string#1}\expandafter
  \@secondoftwo\string}\expandafter\@firstoftwo\expandafter{\expandafter
  \@secondoftwo\string}\@firstoftwo\expandafter{} \@secondoftwo}%
  {\@firstoftwo\expandafter{} \@firstoftwo}%
}%
%%-----------------------------------------------------------------------------
%% \ActOnFirstListElement{<tokens to put before each argument>}%
%%                       {<tokens when no (more) arguments are in list>}%
%%                       {<tokens to put behind each argument>}%
%%                       {{<e_k>}{<e_(k+1)>}..{<e_n>}}%
%% yields either:
%%   <tokens when no (more) arguments are in list>
%% or:
%%   <tokens to put before each argument>{<e_k>}<tokens to put behind each
%%   argument>{{<e_(k+1)>}..{<e_n>}}
%%
%%   (   The "list" in question is {<e_k>}{<e_(k+1)>}..{<e_n>}   )
%%.............................................................................
\@ifdefinable\KeepFirstTillSelDOM{%
  \long\def\KeepFirstTillSelDOM#1#2\SelDOM{{#1}}%
}%
\newcommand\ActOnFirstListElement[4]{%
  \expandafter\CheckWhetherNull\expandafter{\@secondoftwo#4.{}}%
  {#2}%
  {%
    \expandafter\expandafter
    \expandafter            \ExtractFirstListElementLoop
    \expandafter\bracestripexchange
    \expandafter{%
    \expandafter{%
    \@firstoftwo{}#4}}{{#4\SelDOM}{#1}{#3}}%
  }%
}%
\newcommand\ExtractFirstListElementLoop[3]{%
  \expandafter\CheckWhetherNull\expandafter{\@firstoftwo{}#1}%
  {#2#1#3}%
  {%
    \expandafter\ExtractFirstListElementLoop
    \expandafter{%
    \KeepFirstTillSelDOM#1}{#2}{#3}%
  }%
}%
%%---------------------------------------------------------------
%% Expandable Loop:
%% \DoWithEachElementOfArgumentList{<tokens to put before each argument>}%
%%                                 {<tokens when no (more) arguments are in list>}%
%%                                 {<tokens to put behind each argument>}%
%%                                 {{<e_k>}{<e_(k+1)>}..{<e_n>}}
%%
%%    If iteration is done/if list is empty: <tokens when no (more) arguments are in list>
%%    Else:
%%    <tokens to put before each argument>{<e_k>}<tokens to put behind each argument>%
%%    \DoWithEachElementOfArgumentList{<tokens to put before each argument>}%
%%                                    {<tokens when no (more) arguments are in list>}%
%%                                    {<tokens to put behind each argument>}%
%%                                    {{<e_(k+1)>}..{<e_n>}}%
%%...............................................................
\newcommand\DoWithEachElementOfArgumentList[3]{%
  \ActOnFirstListElement{#1}{#2}{#3\DoWithEachElementOfArgumentList{#1}{#2}{#3}}%
}
\makeatother
%%-----------------------------------------------------------------------------
%% Test the for-loop:
%%.............................................................................
\newcommand{\magic}[1]{%
  \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}%
  \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}%
  \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}%
}%
\DoWithEachElementOfArgumentList{\magic}{}{}{%
  ABCDEFGHIJKLMNOPQRSTUVWXYZ%
}%

\begin{document}

\ttfamily\selectfont

\noindent $\bX \cB \fH$

\vfill

\newcommand\callmacros[1]{%
  \hbox{%
    \hbox{\expandafter\string\csname b#1\endcsname: $\csname b#1\endcsname$} %
    \hbox{\expandafter\string\csname c#1\endcsname: $\csname c#1\endcsname$} %
    \hbox{\expandafter\string\csname f#1\endcsname: $\csname f#1\endcsname$}%
  }%
}%
\DoWithEachElementOfArgumentList{\callmacros}{\hbox{Done.}}{}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}%

\vfill

\newcommand\TokensToPutBeforeArg[1]{%
  \string\TokensToPutBeforeArg\string{#1\string}%
}%
\DoWithEachElementOfArgumentList{\par\noindent\TokensToPutBeforeArg}%
                                {\par\noindent Done.}%
                                {(TokensToPutBehindArg)}%
                                { %<-Space-Token!
                                  {Non-Space-Element01}%<-No Space-Token
                                  {Non-Space-Element02} %<- Space-Token
                                  {Non-Space-Element03}%<-No Space-Token
                                  {Non-Space-Element04} %<- Space-Token
                                  {Non-Space-Element05}%<-No Space-Token
                                  {Non-Space-Element06}%<-No Space-Token
                                  {Non-Space-Element07}%<-No Space-Token
                                  {Non-Space-Element08}%<-No Space-Token
                                  {Non-Space-Element09}%<-No Space-Token
                                  {Non-Space-Element10}%<-No Space-Token
                                  {Non-Space-Element11}%<-No Space-Token
                                  {Non-Space-Element12} %<- Space-Token
                                }%

\vfill

\end{document}

Solution 1b—Space-tokens not wrapped into braces are taken into account as if they were wrapped into braces:
\documentclass{article}
\usepackage{amsfonts}

\makeatletter
%%-----------------------------------------------------------------------------
%% Paraphernalia:
%%.............................................................................
\newcommand\bracestripexchange[2]{#2#1}%
\@ifdefinable\removespace{\@firstoftwo{\def\removespace}{} {}}%
%%-----------------------------------------------------------------------------
%% Check whether argument is empty:
%% -- based on \ifempty-macro by Robert R Schneck:
%%  Newsgroup: comp.text.tex
%%  Subject: Macro puzzle: maximally general \ifempty
%%  Google-Groups-URL:
%%    <https://groups.google.com/forum/#!topic/comp.text.tex/kuOEIQIrElc>
%%.............................................................................
%% \CheckWhetherNull{<Argument which is to be checked>}%
%%                  {<Tokens to be delivered in case that
%%                    argument which is to be checked is empty>}%
%%                  {<Tokens to be delivered in case that
%%                    argument which is to be checked is not empty>}%
\newcommand\CheckWhetherNull[1]{%
  \romannumeral0\expandafter\@secondoftwo\string{\expandafter
  \@secondoftwo\expandafter{\expandafter{\string#1}\expandafter
  \@secondoftwo\string}\expandafter\@firstoftwo\expandafter{\expandafter
  \@secondoftwo\string}\@firstoftwo\expandafter{} \@secondoftwo}%
  {\@firstoftwo\expandafter{} \@firstoftwo}%
}%
%%-----------------------------------------------------------------------------
%% Check whether brace-balanced argument starts with a space-token
%%.............................................................................
%% \CheckWhetherLeadingSpace{<Argument which is to be checked>}%
%%                          {<Tokens to be delivered in case <argument
%%                            which is to be checked>'s 1st token is a
%%                            space-token>}%
%%                          {<Tokens to be delivered in case <argument
%%                            which is to be checked>'s 1st token is not
%%                            a space-token>}%
\newcommand\CheckWhetherLeadingSpace[1]{%
  \CheckWhetherNull{#1}{\@secondoftwo}{%
  \expandafter\@secondoftwo\string{\CheckWhetherLeadingSpaceB.#1 }{}}%
}%
\@ifdefinable\CheckWhetherLeadingSpaceB{%
  \long\def\CheckWhetherLeadingSpaceB#1 {%
    \expandafter\CheckWhetherNull\expandafter{\@secondoftwo#1{}}%
    {\expandafter\expandafter\expandafter\@firstoftwo}%
    {\expandafter\expandafter\expandafter\@secondoftwo}%
    \expandafter\@secondoftwo\expandafter{\string}%
  }%
}%
%%-----------------------------------------------------------------------------
%% \ActOnFirstListElement{<tokens to put before each argument>}%
%%                       {<tokens when no (more) arguments are in list>}%
%%                       {<tokens to put behind each argument>}%
%%                       {{<e_k>}{<e_(k+1)>}..{<e_n>}}%
%% yields either: <tokens when no (more) arguments are in list>
%%            or: <tokens to put before each argument>{<e_k>}<tokens to put behind each argument>{{<e_(k+1)>}..{<e_n>}}
%%
%%   (   The "list" in question is {<e_k>}{<e_(k+1)>}..{<e_n>}   )
%%.............................................................................
\@ifdefinable\KeepFirstTillSelDOM{%
  \long\def\KeepFirstTillSelDOM#1#2\SelDOM{{#1}}%
}%
\newcommand\ActOnFirstListElement[4]{%
  \CheckWhetherNull{#4}%
  {#2}%
  {%
    \CheckWhetherLeadingSpace{#4}{%
      \expandafter\bracestripexchange
      \expandafter{%
      \expandafter{%
      \removespace#4}}{#1{ }#3}%
    }{%
      \expandafter\expandafter
      \expandafter            \ExtractFirstListElementLoop
      \expandafter\bracestripexchange
      \expandafter{%
      \expandafter{%
      \@firstoftwo{}#4}}{{#4\SelDOM}{#1}{#3}}%
    }%
  }%
}%
\newcommand\ExtractFirstListElementLoop[3]{%
  \expandafter\CheckWhetherNull\expandafter{\@firstoftwo{}#1}%
  {#2#1#3}%
  {%
    \expandafter\ExtractFirstListElementLoop
    \expandafter{%
    \KeepFirstTillSelDOM#1}{#2}{#3}%
  }%
}%
%%---------------------------------------------------------------
%% Expandable Loop:
%% \DoWithEachElementOfArgumentList{<tokens to put before each argument>}%
%%                                 {<tokens when no (more) arguments are in list>}%
%%                                 {<tokens to put behind each argument>}%
%%                                 {{<e_k>}{<e_(k+1)>}..{<e_n>}}
%%
%%    If list is empty: <tokens when no (more) arguments are in list>
%%    Else:
%%    <tokens to put before each argument>{<e_k>}<preset>%
%%    \DoWithEachElementOfArgumentList{<tokens to put before each argument>}%
%%                                    {<tokens when no (more) arguments are in list>}%
%%                                    {<tokens to put behind each argument>}
%%                                    {{<e_(k+1)>}..{<e_n>}}
%%...............................................................
\newcommand\DoWithEachElementOfArgumentList[3]{%
  \ActOnFirstListElement{#1}{#2}{#3\DoWithEachElementOfArgumentList{#1}{#2}{#3}}%
}
\makeatother
%%-----------------------------------------------------------------------------
%% Test the for-loop:
%%.............................................................................
\newcommand{\magic}[1]{%
  \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}%
  \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}%
  \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}%
}%
\DoWithEachElementOfArgumentList{\magic}{}{}{%
  ABCDEFGHIJKLMNOPQRSTUVWXYZ%
}%

\begin{document}

\ttfamily\selectfont

\noindent $\bX \cB \fH$

\vfill

\newcommand\callmacros[1]{%
  \hbox{%
    \hbox{\expandafter\string\csname b#1\endcsname: $\csname b#1\endcsname$} %
    \hbox{\expandafter\string\csname c#1\endcsname: $\csname c#1\endcsname$} %
    \hbox{\expandafter\string\csname f#1\endcsname: $\csname f#1\endcsname$}%
  }%
}%
\DoWithEachElementOfArgumentList{\callmacros}{\hbox{Done.}}{}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}%

\vfill

\newcommand\TokensToPutBeforeArg[1]{%
  \string\TokensToPutBeforeArg\string{#1\string}%
}%
\DoWithEachElementOfArgumentList{\par\noindent\TokensToPutBeforeArg}%
                                {\par\noindent Done.}%
                                {(TokensToPutBehindArg)}%
                                { %<-Space-Token!
                                  {Non-Space-Element01}%<-No Space-Token
                                  {Non-Space-Element02} %<- Space-Token
                                  {Non-Space-Element03}%<-No Space-Token
                                  {Non-Space-Element04} %<- Space-Token
                                  {Non-Space-Element05}%<-No Space-Token
                                  {Non-Space-Element06}%<-No Space-Token
                                  {Non-Space-Element07}%<-No Space-Token
                                  {Non-Space-Element08}%<-No Space-Token
                                  {Non-Space-Element09}%<-No Space-Token
                                  {Non-Space-Element10}%<-No Space-Token
                                  {Non-Space-Element11}%<-No Space-Token
                                  {Non-Space-Element12} %<- Space-Token
                                }%

\vfill

\end{document}

Due to the character-limit for answers this answer is split in two parts.
This is part 1 of this answer.
Part 2 of this answer can be found here: ⟨https://tex.stackexchange.com/a/539822/118714⟩

A: With expl3 and with a nice syntax:
\documentclass{article}
\usepackage{amsfonts}
\usepackage{xparse}

\ExplSyntaxOn

\NewDocumentCommand{\magic}{m}
 {
  \prop_set_from_keyval:Nn \l_tmpa_prop { #1 }
  \int_step_inline:nnn { `A } { `Z }
   {
    \prop_map_inline:Nn \l_tmpa_prop
     {
      \cs_new_protected:cpx { ####1 \char_generate:nn { ##1 } { 11 } }
       {
        \exp_not:N ####2 { \char_generate:nn { ##1 } { 11 } }
       }
     }
   }
 }

\ExplSyntaxOff

\magic{b=\mathbb,c=\mathcal,f=\mathfrak}

\begin{document}

$\bA+\cF+\fG$

\end{document}

We store a property list containing the properties b=\mathbb, c=\mathcal and f=\mathfrak. Then we start a loop indexed by the ASCII numbers of the uppercase letters and use the properties to define the required control sequences.
In the code ##1 stands for the current integer in the loop, ####1 for the current key and ####2 for the property (at each level we need to double the hash marks).
When ##1 is 65 (that is, the ASCII code for A), the code does
\cs_new_protected:cpx { b \char_generate:nn { 65 } { 11 } }
 {
  \exp_not:N \mathbb { \char_generate:nn { 65 } { 11 } }
 }

and similarly for c and f. This is equivalent to saying
\cs_new_protected:Npn \bA { \mathbb { A } }

Of course it's possible to do it also with pgffor; you lose the check that the commands are not yet existent.
\documentclass{article}
\usepackage{amsfonts}
\usepackage{pgffor}

\begingroup
\newcommand\makecommand[3]{%
  \expandafter\xdef\csname #1#2\endcsname{\noexpand#3{#2}}%
}
\foreach \x in {A,...,Z} {
  \makecommand{b}{\x}{\mathbb}
  \makecommand{c}{\x}{\mathcal}
  \makecommand{f}{\x}{\mathfrak}
}
\endgroup

\begin{document}

$\bA+\cF+\fG$

\end{document}

A:
Due to the character-limit for answers this answer is split in two parts.
This is part 2 of this answer.
Part 1 of this answer can be found here: ⟨https://tex.stackexchange.com/a/539821/118714⟩

Solution 2a—Space-tokens not wrapped into braces get silently discarded:
\documentclass{article}
\usepackage{amsfonts}

\makeatletter
%%-----------------------------------------------------------------------------
%% Paraphernalia:
%%.............................................................................
\newcommand\PassFirstToSecond[2]{#2{#1}}%
%%-----------------------------------------------------------------------------
%% Check whether argument is empty:
%% -- based on \ifempty-macro by Robert R Schneck:
%%  Newsgroup: comp.text.tex
%%  Subject: Macro puzzle: maximally general \ifempty
%%  Google-Groups-URL:
%%    <https://groups.google.com/forum/#!topic/comp.text.tex/kuOEIQIrElc>
%%.............................................................................
%% \CheckWhetherNull{<Argument which is to be checked>}%
%%                  {<Tokens to be delivered in case that
%%                    argument which is to be checked is empty>}%
%%                  {<Tokens to be delivered in case that
%%                    argument which is to be checked is not empty>}%
\newcommand\CheckWhetherNull[1]{%
  \romannumeral0\expandafter\@secondoftwo\string{\expandafter
  \@secondoftwo\expandafter{\expandafter{\string#1}\expandafter
  \@secondoftwo\string}\expandafter\@firstoftwo\expandafter{\expandafter
  \@secondoftwo\string}\@firstoftwo\expandafter{} \@secondoftwo}%
  {\@firstoftwo\expandafter{} \@firstoftwo}%
}%
%%-----------------------------------------------------------------------------
%% Fully expandable for-loop:
%%.............................................................................
%% \DoWithEachElementOfArgumentList{<tokens to put before each argument>}%
%%                                 {<tokens when no (more) arguments are in list>}%
%%                                 {<tokens to put behind each argument>}%
%%                                 {{<e_k>}{<e_(k+1)>}..{<e_n>}}
%%
%%  yields (after two expansion-steps) :
%%
%%  <tokens to put before each argument>{<e_k>}<tokens to put behind each argument>%
%%  <tokens to put before each argument>{<e_(k+1)>}<tokens to put behind each argument>%
%%  ...
%%  <tokens to put before each argument>{<e_n>}<tokens to put behind each argument>%
%%  <tokens when no (more) arguments are in list>%
%%
\@ifdefinable\KeepOnlyFirstBeforeSeLDoM{%
  \long\def\KeepOnlyFirstBeforeSeLDoM#1#2\SeLDoM{{#1}}%
}%
\newcommand\DoWithEachElementOfArgumentList{%
  \romannumeral0\MoveElementFromList{}{ }%
}%
\newcommand\MoveElementFromList[6]{%
  \CheckWhetherNull{#1}{%
    \expandafter\CheckWhetherNull\expandafter{\@secondoftwo#6.{}}{#2#4}{%
      \expandafter\expandafter\expandafter\MoveElementFromList
      \expandafter\PassFirstToSecond
      \expandafter{\@firstoftwo{}#6}{{#6\SeLDoM}{#2}{#3}{#4}{#5}}%
    }%
  }{%
    \expandafter\CheckWhetherNull\expandafter{\@firstoftwo{}#1}%
    {\MoveElementFromList{}{#2#3#1#5}}%
    {\expandafter\MoveElementFromList
     \expandafter{\KeepOnlyFirstBeforeSeLDoM#1}{#2}%
    }{#3}{#4}{#5}{#6}%
  }%
}%
\makeatother
%%-----------------------------------------------------------------------------
%% Test the for-loop:
%%.............................................................................
\newcommand{\magic}[1]{%
  \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}%
  \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}%
  \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}%
}%
\DoWithEachElementOfArgumentList{\magic}{}{}{%
  ABCDEFGHIJKLMNOPQRSTUVWXYZ%
}%

\begin{document}

\ttfamily\selectfont

\noindent $\bX \cB \fH$

\vfill

\newcommand\callmacros[1]{%
  \hbox{%
    \hbox{\expandafter\string\csname b#1\endcsname: $\csname b#1\endcsname$} %
    \hbox{\expandafter\string\csname c#1\endcsname: $\csname c#1\endcsname$} %
    \hbox{\expandafter\string\csname f#1\endcsname: $\csname f#1\endcsname$}%
  }%
}%
\DoWithEachElementOfArgumentList{\callmacros}{\hbox{Done.}}{}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}%

\vfill

\newcommand\TokensToPutBeforeArg[1]{%
  \string\TokensToPutBeforeArg\string{#1\string}%
}%
\DoWithEachElementOfArgumentList{\par\noindent\TokensToPutBeforeArg}%
                                {\par\noindent Done.}%
                                {(TokensToPutBehindArg)}%
                                { %<-Space-Token!
                                  {Non-Space-Element01}%<-No Space-Token
                                  {Non-Space-Element02} %<- Space-Token
                                  {Non-Space-Element03}%<-No Space-Token
                                  {Non-Space-Element04} %<- Space-Token
                                  {Non-Space-Element05}%<-No Space-Token
                                  {Non-Space-Element06}%<-No Space-Token
                                  {Non-Space-Element07}%<-No Space-Token
                                  {Non-Space-Element08}%<-No Space-Token
                                  {Non-Space-Element09}%<-No Space-Token
                                  {Non-Space-Element10}%<-No Space-Token
                                  {Non-Space-Element11}%<-No Space-Token
                                  {Non-Space-Element12} %<- Space-Token
                                }%

\vfill

\end{document}

Solution 2b—Space-tokens not wrapped into braces are taken into account as if they were wrapped into braces:
\documentclass{article}
\usepackage{amsfonts}

\makeatletter
%%-----------------------------------------------------------------------------
%% Paraphernalia:
%%.............................................................................
\newcommand\PassFirstToSecond[2]{#2{#1}}%
\@ifdefinable\removespace{\@firstoftwo{\def\removespace}{} {}}%
%%-----------------------------------------------------------------------------
%% Check whether argument is empty:
%%.............................................................................
%% \CheckWhetherNull{<Argument which is to be checked>}%
%%                  {<Tokens to be delivered in case that
%%                    argument which is to be checked is empty>}%
%%                  {<Tokens to be delivered in case that
%%                    argument which is to be checked is not empty>}%
\newcommand\CheckWhetherNull[1]{%
  \romannumeral0\expandafter\@secondoftwo\string{\expandafter
  \@secondoftwo\expandafter{\expandafter{\string#1}\expandafter
  \@secondoftwo\string}\expandafter\@firstoftwo\expandafter{\expandafter
  \@secondoftwo\string}\@firstoftwo\expandafter{} \@secondoftwo}%
  {\@firstoftwo\expandafter{} \@firstoftwo}%
}%
%%-----------------------------------------------------------------------------
%% Check whether brace-balanced argument starts with a space-token
%%.............................................................................
%% \CheckWhetherLeadingSpace{<Argument which is to be checked>}%
%%                          {<Tokens to be delivered in case <argument
%%                            which is to be checked>'s 1st token is a
%%                            space-token>}%
%%                          {<Tokens to be delivered in case <argument
%%                            which is to be checked>'s 1st token is not
%%                            a space-token>}%
\newcommand\CheckWhetherLeadingSpace[1]{%
  \CheckWhetherNull{#1}{\@secondoftwo}{%
  \expandafter\@secondoftwo\string{\CheckWhetherLeadingSpaceB.#1 }{}}%
}%
\@ifdefinable\CheckWhetherLeadingSpaceB{%
  \long\def\CheckWhetherLeadingSpaceB#1 {%
    \expandafter\CheckWhetherNull\expandafter{\@secondoftwo#1{}}%
    {\expandafter\expandafter\expandafter\@firstoftwo}%
    {\expandafter\expandafter\expandafter\@secondoftwo}%
    \expandafter\@secondoftwo\expandafter{\string}%
  }%
}%
%%-----------------------------------------------------------------------------
%% Fully expandable for-loop:
%%.............................................................................
%% \DoWithEachElementOfArgumentList{<tokens to put before each argument>}%
%%                                 {<tokens when no (more) arguments are in list>}%
%%                                 {<tokens to put behind each argument>}%
%%                                 {{<e_k>}{<e_(k+1)>}..{<e_n>}}
%%
%%  yields (after two expansion-steps) :
%%
%%  <tokens to put before each argument>{<e_k>}<tokens to put behind each argument>%
%%  <tokens to put before each argument>{<e_(k+1)>}<tokens to put behind each argument>%
%%  ...
%%  <tokens to put before each argument>{<e_n>}<tokens to put behind each argument>%
%%  <tokens when no (more) arguments are in list>%
%%
\@ifdefinable\KeepOnlyFirstBeforeSeLDoM{%
  \long\def\KeepOnlyFirstBeforeSeLDoM#1#2\SeLDoM{{#1}}%
}%
\newcommand\DoWithEachElementOfArgumentList{%
  \romannumeral0\MoveElementFromList{}{ }%
}%
\newcommand\MoveElementFromList[6]{%
  \CheckWhetherNull{#1}{%
    \CheckWhetherNull{#6}{#2#4}{%
      \CheckWhetherLeadingSpace{#6}{%
        \expandafter\PassFirstToSecond
        \expandafter{\removespace#6}{\MoveElementFromList{}{#2#3{ }#5}{#3}{#4}{#5}}%
      }{%
        \expandafter\expandafter\expandafter\MoveElementFromList
        \expandafter\PassFirstToSecond
        \expandafter{\@firstoftwo{}#6}{{#6\SeLDoM}{#2}{#3}{#4}{#5}}%
      }%
    }%
  }{%
    \expandafter\CheckWhetherNull\expandafter{\@firstoftwo{}#1}%
    {\MoveElementFromList{}{#2#3#1#5}}%
    {\expandafter\MoveElementFromList
     \expandafter{\KeepOnlyFirstBeforeSeLDoM#1}{#2}%
    }{#3}{#4}{#5}{#6}%
  }%
}%
\makeatother
%%-----------------------------------------------------------------------------
%% Test the for-loop:
%%.............................................................................
\newcommand{\magic}[1]{%
  \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}%
  \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}%
  \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}%
}%
\DoWithEachElementOfArgumentList{\magic}{}{}{%
  ABCDEFGHIJKLMNOPQRSTUVWXYZ%
}%

\begin{document}

\ttfamily\selectfont

\noindent $\bX \cB \fH$

\vfill

\newcommand\callmacros[1]{%
  \hbox{%
    \hbox{\expandafter\string\csname b#1\endcsname: $\csname b#1\endcsname$} %
    \hbox{\expandafter\string\csname c#1\endcsname: $\csname c#1\endcsname$} %
    \hbox{\expandafter\string\csname f#1\endcsname: $\csname f#1\endcsname$}%
  }%
}%
\DoWithEachElementOfArgumentList{\callmacros}{\hbox{Done.}}{}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}%

\vfill

\newcommand\TokensToPutBeforeArg[1]{%
  \string\TokensToPutBeforeArg\string{#1\string}%
}%
\DoWithEachElementOfArgumentList{\par\noindent\TokensToPutBeforeArg}%
                                {\par\noindent Done.}%
                                {(TokensToPutBehindArg)}%
                                { %<-Space-Token!
                                  {Non-Space-Element01}%<-No Space-Token
                                  {Non-Space-Element02} %<- Space-Token
                                  {Non-Space-Element03}%<-No Space-Token
                                  {Non-Space-Element04} %<- Space-Token
                                  {Non-Space-Element05}%<-No Space-Token
                                  {Non-Space-Element06}%<-No Space-Token
                                  {Non-Space-Element07}%<-No Space-Token
                                  {Non-Space-Element08}%<-No Space-Token
                                  {Non-Space-Element09}%<-No Space-Token
                                  {Non-Space-Element10}%<-No Space-Token
                                  {Non-Space-Element11}%<-No Space-Token
                                  {Non-Space-Element12} %<- Space-Token
                                }%

\vfill

\end{document}

Difference between the a-solutions and the b-solutions:
With the a-solutions (i.e., with solution 1a and solution 2a) space-tokens within the list of non-delimited macro-arguments that are not explicitly wrapped into braces will not be taken into account while with the b-solutions (i.e., with solution 1b and solution 2b) these will be taken into account as if they were wrapped into braces.

Difference between the 1-solutions and the 2-solutions:
Above it was said that with all solutions you can do
\DoWithEachElementOfArgumentList{⟨tokens to put before each argument⟩}%
                                {⟨tokens when no (more) arguments are in list⟩}%
                                {⟨tokens to put behind each argument⟩}%
                                {% List of non-delimited macro-arguments:
                                  {⟨Argument 1⟩}%
                                  {⟨Argument 2⟩}%
                                  ...
                                  {⟨Argument n⟩}%
                                }%
and that this will deliver something like
⟨tokens to put before each argument⟩{⟨Argument 1⟩}⟨tokens to put behind each argument⟩%
⟨tokens to put before each argument⟩{⟨Argument 2⟩}⟨tokens to put behind each argument⟩%
...
⟨tokens to put before each argument⟩{⟨Argument n⟩}⟨tokens to put behind each argument⟩%
⟨tokens when no (more) arguments are in list⟩
The gist of the difference between solutions 1a/b and solutions 2a/b is about the order in time in which the processes

*

*of splicing the next element from the ⟨list of non-delimited macro-arguments⟩ and forming a ⟨tokens to put before each argument⟩{⟨Argument k⟩}⟨tokens to put behind each argument⟩-instance

*of carrying out the ⟨tokens to put before each argument⟩{⟨Argument k⟩}⟨tokens to put behind each argument⟩-instances

take place:

*

*With solutions 1a/b the tokens that form the next call to \DoWithEachElementOfArgumentList are inserted into the token-stream right behind the tokens that form an ⟨tokens to put before each argument⟩{⟨Argument k⟩}⟨tokens to put behind each argument⟩-instance.
I.e., in the first iteration you get:
⟨tokens to put before each argument⟩{⟨Argument 1⟩}⟨tokens to put behind each argument⟩%
\DoWithEachElementOfArgumentList{⟨tokens to put before each argument⟩}%
                                {⟨tokens when no (more) arguments are in list⟩}%
                                {⟨tokens to put behind each argument⟩}%
                                {% (remaining) list of non-delimited macro-arguments:
                                  {⟨Argument 2⟩}%
                                  ...
                                  {⟨Argument n⟩}%
                                }%
With solutions 1a/b the ⟨tokens to put before each argument⟩ and/or the ⟨tokens to put behind each argument⟩ can also be used for affecting the way in which subsequent ⟨tokens to put before each argument⟩{⟨Argument k⟩}⟨tokens to put behind each argument⟩-instances will be created:
With solutions 1a/b ⟨tokens to put before each argument⟩ and/or ⟨tokens to put behind each argument⟩ can contain a macros for changing/replacing/removing those arguments/tokens that belong to the following instance(s) of the \DoWithEachElementOfArgumentList-macro.
Thus you can, e.g., use the ⟨tokens to put before each argument⟩-argument and/or the ⟨tokens to put behind each argument⟩-argument of \DoWithEachElementOfArgumentList in order to under some circumstances change the arguments of \DoWithEachElementOfArgumentList in the following iteration-step(s).
Thus you can, e.g., use macros within the ⟨tokens to put before each argument⟩-argument and/or within the ⟨tokens to put behind each argument⟩-argument for successively changing within each iteration-step the ⟨tokens when no (more) arguments are in list⟩.
Thus you can also use the ⟨tokens to put before each argument⟩-argument and/or the ⟨tokens to put behind each argument⟩-argument to under some circumstances have those tokens gobbled that form the subsequent \DoWithEachElementOfArgumentList-iteration-step. This way iteration can be terminated prematurely, i.e., before the entire list of arguments was processed.

*With solutions 2a/b splitting the list is done completely before a sequence of ⟨tokens to put before each argument⟩{⟨Argument k⟩}⟨tokens to put behind each argument⟩-instances is delivered. Due to \romannumeral0-expansion splitting and delivering requires two expansion-steps/two "hits" by \expandafter.
I.e., after two expansion-steps/after two "hits" by \expandafter you get at once:
⟨tokens to put before each argument⟩{⟨Argument 1⟩}⟨tokens to put behind each argument⟩%
⟨tokens to put before each argument⟩{⟨Argument 2⟩}⟨tokens to put behind each argument⟩%
...
⟨tokens to put before each argument⟩{⟨Argument n⟩}⟨tokens to put behind each argument⟩%
⟨tokens when no (more) arguments are in list⟩
With solutions 2a/b \romannumeral0-expansion takes place for tail-recursively collecting all ⟨tokens to put before each argument⟩{⟨Argument k⟩}⟨tokens to put behind each argument⟩-instances and the trailing ⟨tokens when no (more) arguments are in list⟩ within a macro-argument. When iteration/tail-recursion is done, all the collected instances will be delivered at once.
With solutions 2a/b both the ⟨tokens to put before each argument⟩-argument and the ⟨tokens to put behind each argument⟩-argument cannot be used for affecting the generation of subsequent ⟨tokens to put before each argument⟩{⟨Argument k⟩}⟨tokens to put behind each argument⟩-instances:
Any ⟨tokens to put before each argument⟩{⟨Argument k⟩}⟨tokens to put behind each argument⟩-instance will be expanded/will be carried out when the process of collecting/creating ⟨tokens to put before each argument⟩{⟨Argument k⟩}⟨tokens to put behind each argument⟩-instances is already terminated.

Due to the character-limit for answers this answer is split in two parts.
This is part 2 of this  answer.
Part 1 of this  answer can be found here: ⟨https://tex.stackexchange.com/a/539821/118714⟩

A: A simple solution using \pgfkeys:
\documentclass{article}
\usepackage{amsfonts}
\usepackage{pgffor}
\pgfkeys{
  @magic/.code={
    \expandafter\newcommand\csname b#1\endcsname{\mathbb{#1}}%
    \expandafter\newcommand\csname c#1\endcsname{\mathcal{#1}}%
    \expandafter\newcommand\csname f#1\endcsname{\mathfrak{#1}}%
  },
  @magic/.list={A,...,Z},
}
\begin{document}
$\bB \cF \fZ$
\end{document}


text:
Q: Finding all non-conflicting combinations of values from multiple lists of values I have the following array which contains arrays of values:
$array = array(
    array('1', '2'),
    array('a', 'b', 'c'),
    array('x', 'y'),
);

There can be any number of arrays and an array can contain any number of values. I currently have a piece of code which will generate all combinations where one value is taken from each array. eg:
1ax, 1ay, 1bx, 1by, 1cx, 1cy, 2ax, 2ay, 2bx, 2by, 2cx, 2cy

However what I actually want is only the combinations where only one value sits in each  column, ie. 1ax is no good because all three values 1, a and x sit in the first column, 1by is no good because b and y sit in the second column. So from the above example only these combinations would be valid:
1cy, 2cx

I originally planned to just generate all combinations and then filter out the ones with conflicts, but that doesn't scale as this is an oversimplified example, in the real application there's going to be situations where there are potentially millions of combinations (including conflicting ones).
Can anyone help with a better way to solve this? I'm working in PHP, but any code sample that clearly demonstrates the logic would be helpful.
Thanks in advance.

Update:
I've tested the solutions that work against a bigger dataset, to get some benchmarks, these are the results so far:
$array = array(
    array('1', '2', '3', '1', '2', '3', '1', '2', '3', '1', '2', '3', '1', '2', '3'),
    array('a', 'b', 'c', 'd', 'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd'),
    array('x', 'y', 'z', 'x', 'y', 'z', 'x', 'y', 'z'),
    array('1', '2', '3', '1', '2', '3', '1', '2', '3'),
    array('a', 'b', 'c', 'd', 'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd'),
    array('x', 'y', 'z'),
);

Josh Davis 2nd Solution:
Combinations:      249480
Time:              0.3180251121521 secs
Memory Usage:      22.012168884277 mb
Peak Memory Usage: 22.03059387207 mb

Josh Davis:
Combinations:      249480
Time:              1.1172790527344 secs
Memory Usage:      22.004837036133 mb
Peak Memory Usage: 22.017387390137 mb

Tom Haigh:
Combinations:      249480
Time:              5.7098741531372 secs
Memory Usage:      39.145843505859 mb
Peak Memory Usage: 39.145843505859 mb

A: Interesting problem! This turned out to be more complex than I thought, but it seems to work.
Basic strategy is to first order the arrays smallest to largest (keeping track of what order they were in, so I can output the answers in the correct order).
I keep answers in the form of an array of indexes into this sorted array of input lists.
Now that the lists are sorted, I can store the first correct answer as array(0,1,2,...,n);
Then I recurse into a function for trying all values in the first slot there (the 0 above) by swapping it with other values in that answer array (all the ones that aren't too big for that slot). Since I've got it sorted by size, I can move any value to the right when I'm swapping, without worrying about it being to big for that right slot.
outputting each valid slot has some crazy indirection to undo all the sorting.
Sorry if this looks confusing. I didn't spend much time cleaning it up.
<?php
# $lists is an array of arrays
function noconfcombos($lists) {
    $lengths = array();
    foreach($lists as $list) {
        $lengths[] = count($list);
    }

    # find one solution (and make sure there is one)
    $answer = array();
    $sorted_lengths = $lengths;
    asort($sorted_lengths);
    $answer_order_lists = array();
    $answer_order_lengths = array();
    $output_order = array();
    $min = 1;
    $max_list_length = 0;
    foreach($sorted_lengths as $lists_key => $list_max) {
        if($list_max < $min) {
            # no possible combos
            return array();
        }
        $answer[] = $min - 1; # min-1 is lowest possible value (handing out colums starting with smallest rows)
        $output_order[$lists_key] = $min - 1; # min-1 is which slot in $answers corresponds to this list
        $answer_order_lists[] = $lists[$lists_key];
        $answer_order_lengths[] = $lengths[$lists_key];
        ++$min;
    }
    ksort($output_order);
    $number_of_lists = count($lists);
    $max_list_length = end($sorted_lengths);
    if($max_list_length > $number_of_lists) {
       for($i = $number_of_lists; $i < $max_list_length; ++$i) {
          $answer[] = $i;
       }
       $stop_at = $number_of_lists;
    } else {
       $stop_at = $number_of_lists - 1;
    }

    # now $answer is valid (it has the keys into the arrays in $list for the
    # answer), and we can find the others by swapping around the values in
    # $answer.

    $ret = array();
    $ret[] = noconfcombos_convert($answer, $answer_order_lists, $output_order);
    noconfcombos_recurse($ret, $max_list_length, $stop_at, $answer_order_lengths, $answer_order_lists, $output_order, $answer, 0);

    return $ret;
}

# try swapping in different indexes into position $index, from the positions
# higher, then recurse
function noconfcombos_recurse(&$ret, $max_list_length, $stop_at, &$lengths, &$lists, &$output_order, $answer, $index) {
    if($index < $stop_at) {
        noconfcombos_recurse($ret, $max_list_length, $stop_at, $lengths, $lists, $output_order, $answer, $index + 1);
    }
    for($other = $index + 1; $other < $max_list_length; ++$other) {
        if($answer[$other] < $lengths[$index]) { # && $answer[$index] < $lengths[$other]) {
            $tmp = $answer[$index];
            $answer[$index] = $answer[$other];
            $answer[$other] = $tmp;
            $ret[] = noconfcombos_convert($answer, $lists, $output_order);
            if($index < $stop_at) {
                noconfcombos_recurse($ret, $max_list_length, $stop_at, $lengths, $lists, $output_order, $answer, $index + 1);
            }
        }
    }
}

function noconfcombos_convert(&$indexes, &$lists, &$order) {
    $ret = '';
    foreach($order as $i) {
        $ret .= $lists[$i][$indexes[$i]];
    }
    return $ret;
}

function noconfcombos_test() {
    $a = array('1', '2', '3', '4');
    $b = array('a', 'b', 'c', 'd', 'e');
    $c = array('x', 'y', 'z');
    $all = array($a, $b, $c);
    print_r(noconfcombos($all));
}

noconfcombos_test();

A: I think this works. It is using recursion to go over the structure like a tree. For each branch it keeps track of which columns are already taken. It is probably slow because it is a brute force approach.
<?php

$array = array(
    array('1', '2'),
    array('a', 'b', 'c'),
    array('x', 'y'),
);

function f($array, & $result, $colsToIgnore = array(), $currentPath = array()) {
    $row = array_shift($array);
    $length = count($row);
    $isMoreRows = !! count($array);

    for ($col = 0; $col < $length; $col++) {
        //check whether column has already been used
        if (in_array($col, $colsToIgnore)) {
            continue;
        }

        $item = $row[$col];

        $tmpPath = $currentPath;
        $tmpPath[] = $item;

        if ($isMoreRows) {
            $tmpIgnoreCols = $colsToIgnore;
            $tmpIgnoreCols[] = $col;
            f($array, $result, $tmpIgnoreCols, $tmpPath);
        } else {
            $result[] = implode('', $tmpPath);
        }

    }
}

$result = array();
f($array, $result);
print_r($result);

A: This is one of those cases where self-generated code and brute force will beat most algorithms on simplicity and performance. In previous answers I've seen lots of recursion, array manipulation and computations, when in actuality what you'd want to do is:
foreach ($array[0] as $k0 => $v0)
{
    foreach ($array[1] as $k1 => $v1)
    {
        if ($k1 == $k0)
        {
            continue;
        }
        foreach ($array[2] as $k2 => $v2)
        {
            if ($k2 == $k1 || $k2 == $k0)
            {
                continue;
            }
            $result[] = $v0.$v1.$v2;
        }
    }
}

Of course, you cannot write this unless you know how many arrays are in $array. That's where generated code comes handy:
$array = array(
    array('1', '2'),
    array('a', 'b', 'c'),
    array('x', 'y')
);
$result = array();

$php = '';
foreach ($array as $i => $arr)
{
    $php .= 'foreach ($array[' . $i . '] as $k' . $i . ' => $v' . $i . '){';

    if ($i > 0)
    {
        $sep  = 'if (';
        $j    = $i - 1;
        do
        {
            $php .= $sep . '$k' . $i . ' == $k' . $j;
            $sep  = ' || ';
        }
        while (--$j >= 0);

        $php .= ') { continue; } ';
    }
}

$php .= '$result[] = $v' . implode('.$v', array_keys($array)) . ';' . str_repeat('}', count($array));

eval($php);
print_r($result);

Note that this routine assumes that $array is a zero-based numerically indexed array, as in your example. It will generate the code quoted above, adjusted for an arbitrary number of arrays.

Update
Here's an alternative algorithm. It's still self-generated, but less bruteforce. We still have nested loops, except that each loop works on a copy of the array where keys that are currently used by outer loops have been removed from this loop's array. For example, if the values should be (a,b,c) but the outer loops are using the indices 0 and 2, we remove "a" (index 0) and "c" (index 2) and all we have left is "b". It means that loops work only on possible combinations and we don't need a if condition anymore.
Furthermore, and this part can be applied to the previous algorithm as well, we process the arrays of values in order from the smallest to the largest so that we guarantee that used indices exist in current array. The downside is it doesn't generate the combinations in the same order. It generates the same combinations, just not in the same order. The code looks like this:
$a0 = $array[0];
foreach ($a0 as $k0 => $v0)
{
    $a2 = $array[2];
    unset($a2[$k0]);
    foreach ($a2 as $k2 => $v2)
    {
        $a1 = $array[1];
        unset($a1[$k0], $a1[$k2]);
        foreach ($a1 as $k1 => $v1)
        {
            $result[] = "$v0$v1$v2";
        }
    }
}

The above routine sets up a copy of the values at the beginning of every loop, then removes values that are used by outer loops. You can improve this process by setting up a copy of the values only once at the beginning, remove the keys as they are used (at the beginning of each loop) and put them back as they are freed (at the end of each loop). The routine then looks like this:
list($a0,$a1,$a2) = $array;
foreach ($a0 as $k0 => $v0)
{
    unset($a1[$k0], $a2[$k0]);
    foreach ($a2 as $k2 => $v2)
    {
        unset($a1[$k2]);
        foreach ($a1 as $k1 => $v1)
        {
            $result[] = "$v0$v1$v2";
        }
        $a1[$k2] = $array[1][$k2];
    }
    $a1[$k0] = $array[1][$k0];
    $a2[$k0] = $array[2][$k0];
}

The actual code that generates the source above is:
$keys = array_map('count', $array);
arsort($keys);

$inner_keys = array();
foreach ($keys as $k => $cnt)
{
    $keys[$k] = $inner_keys;
    $inner_keys[] = $k;
}

$result = array();

$php = 'list($a' . implode(',$a', array_keys($array)) . ')=$array;';
foreach (array_reverse($keys, true) as $i => $inner_keys)
{
    $php .= 'foreach ($a' . $i . ' as $k' . $i . ' => $v' . $i . '){';

    if ($inner_keys)
    {
        $php .= 'unset($a' . implode('[$k' . $i . '],$a', $inner_keys) . '[$k' . $i . ']);';
    }
}

$php .= '$result[] = "$v' . implode('$v', array_keys($array)) . '";';

foreach ($keys as $i => $inner_keys)
{
    foreach ($inner_keys as $j)
    {
        $php .= '$a' . $j . '[$k' . $i . ']=$array[' . $j . '][$k' . $i . "];\n";
    }
    $php .= '}';
}
eval($php);

A: probably not the most elegant way, but does the trick
(javascript)
var result = [];

for(i=0;i<arr1.length;i++)
{
  for(j=0;j<arr2.length;j++)
  {
    if(j==i)
      continue;
    else
    {
      for(k=0;k<arr3.length;k++)
      {
        if(k==i||k==j)
          continue;
        else
        {
          result.push(arr1[i]+arr2[j]+arr3[k]);
        }
      }
    }
  }
}

A: This can be refactored using recursion making it work with any arbitrary amount of arrays. If I find the time, I'll give it a try myself.
ps. I don't know php, the example is written in Delphi.
Edit: recursive solution with arbitrary # arrays
type
  TSingleArray = array of string;
  TMasterArray = array of TSingleArray;
var
  solutions: array of integer; // Q&D container to hold currently used indexes of SingleArrays

procedure WriteSolution(const masterArray: TMasterArray);
var
  I: Integer;
  indexes: string;
  solution: string;
begin
  for I := 0 to High(solutions) do
  begin
    indexes := indexes + IntToStr(solutions[I]) + ' ';
    solution := solution + masterArray[I][solutions[I]];
  end;
  Writeln('Solution: ' + solution + ' Using indexes: ' + indexes);
end;

procedure FindSolution(const masterArray: TMasterArray; const singleArrayIndex: Integer; var bits: Integer);
var
  I: Integer;
begin
  for I := 0 to High(masterArray[singleArrayIndex]) do
  begin
    //***** Use bit manipulation to check if current index is already in use
    if bits and (1 shl I)  = (1 shl I ) then continue;
    solutions[singleArrayIndex] := I;
    Inc(bits, 1 shl I);
    //***** If it is not the last array in our masterArray, continue by calling RecursArrays recursivly.
    if singleArrayIndex <> High(masterArray) then FindSolution(masterArray, Succ(singleArrayIndex), bits)
    else WriteSolution(masterArray);
    Dec(bits, 1 shl I);
  end;
end;

//***************
// Initialization
//***************
var
  I, J: Integer;
  bits: Integer;
  singleArrayString: string;
  masterArray: TMasterArray;
begin
  I := 10;
  SetLength(masterArray, I);
  for I := 0 to High(masterArray) do
  begin
    SetLength(masterArray[I], High(masterArray) + Succ(I));
    singleArrayString := EmptyStr;
    for J := 0 to High(masterArray[I]) do
    begin
      masterArray[I][J] := IntToStr(J);
      singleArrayString := singleArrayString + masterArray[I][J];
    end;
    WriteLn(singleArrayString)
  end;
  ReadLn;

  //****** Start solving the problem using recursion
  bits := 0;
  SetLength(solutions, Succ(High(masterArray)));
  FindSolution(masterArray, 0, bits);
end.

A: Look at it from a different angle: in order to compose a result row, you need to pick a value for each column.  Each value should be picked from a different source row.  The problem is know as "pick N out of M", or more mathematically, a Combination.
This means that a result row corresponds to an array of source-row indices.
You can build all possible pickings by starting to build an index-array like this (pseudo-code)
function combinations( $source ) {
  if( count( $source ) == 0 ) return $source;
  $result=array();
  // build one row
  foreach( $source as $index=>$value ) {
    $newsource = array_splice( $source, $index, 1 );

    $reduced_combinations=combinations( $newsource  );
    foreach( $reduced_combinations as $reduced_combi ) {
      $newrow=array_unshift( $reduced_combi, $value );
      $result[]=$newrow;
    }

  }
  return $result;
}

function retrieve_indices( $indices, $arrays ) {
   $result=array();
   foreach( $indices as $column=>$index ) {
     $result[]=$arrays[$index][$column];
   }
   return $result;
}

$source_arrays = array(
  array( "1", "2", "3" ),
  array( "a", "b", "c" ),
  array( "x", "y", "z" )
);

$index_combinations = combinations( range(0,2) );
$result=array();
foreach( $index_combinations as $combination ) {
  $result[]=retrieve_indices( $combination, $source_arrays );
}

A: Another option:
    $arr = array(
        array('1', '2'),
        array('a', 'b', 'c'),
        array('x', 'y'),
    );
    //-----
    //assuming $arr consists of non empty sub-arrays
    function array_combinations($arr){
        $max = 1;
        for ($i = 0; $i < count($arr); $i ++){
            $max *= count($arr[$i]);
        }
        $matrix = array();
        for ($i = 0; $i < $max; $i ++){
            $matrix = array();
        }
        $c_rep = 1;
        for ($i = count($arr) - 1; $i >= 0; $i --){
            $c_rep *= ($i < count($arr) - 1)//last sub-array
                ? count($arr[$i + 1])
                : 1;
            $k = 0;
            while ($k < $max){
                for ($t = 0; $t < count($arr[$i]); $t ++){
                    for ($j = 0; $j < $c_rep; $j ++){
                        $matrix[$i][$k ++] = $arr[$i][$t];
                    }
                }
            }
        }
        return $matrix;
    }
    //-----
    $matrix = array_combinations($arr);

A: Your problem is similar to that of finding a determinant of a matrix. The best way imho would be to fill smaller arrays with some symbol, say '0', so they all have equal number of values, in your example
$array = array(
    array('1', '2', '0'),
    array('a', 'b', 'c'),
    array('x', 'y', '0'),
);

then loop through each of the first array values and for each increment the index of array by 1 and check the next array and the next column (on the first loop it will be '1' and index will be 0 incremented - 1, then get $array1 - 'b' and so on) if you reach '0', break, if you reach right border, reset first index to 0. Then do the same with decrementing and you'll have all the combinations. It is probably unclear, check the image I linked to

A: try this :
function algorithmToCalculateCombinations($n, $elems) {
        if ($n > 0) {
            $tmp_set = array();
            $res = algorithmToCalculateCombinations($n - 1, $elems);
            foreach ($res as $ce) {
                foreach ($elems as $e) {
                    array_push($tmp_set, $ce . $e);
                }
            }
            return $tmp_set;
        } else {
            return array('');
        }
    }

$Elemen = array(range(0,9),range('a','z'));
$Length = 3;
$combinations = algorithmToCalculateCombinations($Length, $Elemen);