text:
Q: Is this a valid proof of surjectivity and bijectivity? Given a function $F \colon \mathbb{Z} \to \mathbb{Z}$ defined by $F(n) = (-1)^n n + 3$ proof that it is surjective.
Since the definition of surjectivity says that $\forall k \in \mathbb{Z}, \ \exists n \in \mathbb{Z} \ \colon k = F(n) = (-1)^n n + 3$ I need to find an expression for $k$ in terms of $n$ and check that $n$ is an integer if $k$ is also an integer.
$k = (-1)^n n + 3 \Longleftrightarrow k - 3 = (-1)^n n$
If $n$ is even I get: $k - 3 = (-1)^n n \Longleftrightarrow k - 3 = n$
If $n$ is odd I get: $k - 3 = (-1)^n n \Longleftrightarrow -(k - 3) = n$
So, in general, $n = (-1)^{k + 1} (k - 3)$.
Since I've found and expression for $n$ in terms of $k$ and, clearly if $k$ is an integer so is $n$ this implies that $F$ is surjective.
Furthermore since this final expression gives for every $k$ an unique $n$ I can say that $F$ is bijective.
Is this argument valid?
How do you prove surjectivity in general?


text:
Q: Getting C1001 Internal compiler error when building pytorch on windows I'm trying to build Pytorch on windows using visual studio, but it seems it faces some internal compiler error which I have not been able to figure out its cause.
out of 46 targets, 35 gets built successfully until it ultimately fails with the following errors.
Before I list the errors this is how I went about building it :
git clone --branch v1.6.0 https://github.com/pytorch/pytorch.git pytorch-1.6.0
cd pytorch-1.6.0
git submodule update --init --recursive
set CUDAHOSTCXX=
set DISTUTILS_USE_SDK=1
for /f "usebackq tokens=*" %i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [15^,16^) -products * -latest -property installationPath`) do call "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.27
python setup.py build --cmake-only
cmake-gui

and this is what I did afterward:

build outout:
1>------ Build started: Project: defs.bzl, Configuration: Release x64 ------
2>------ Build started: Project: ATEN_CPU_FILES_GEN_TARGET, Configuration: Release x64 ------
3>------ Build started: Project: dnnl_cpu, Configuration: Release x64 ------
4>------ Build started: Project: generate-torch-sources, Configuration: Release x64 ------
5>------ Build started: Project: python_copy_files, Configuration: Release x64 ------
6>------ Build started: Project: gen_onnx_proto, Configuration: Release x64 ------
4>Generating ../../torch/csrc/autograd/generated/Functions.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_0.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_1.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_2.cpp, ../../torch/csrc/autograd/generated/VariableType_0.cpp, ../../torch/csrc/autograd/generated/VariableType_1.cpp, ../../torch/csrc/autograd/generated/VariableType_2.cpp, ../../torch/csrc/autograd/generated/VariableType_3.cpp, ../../torch/csrc/autograd/generated/VariableType_4.cpp, ../../torch/csrc/autograd/generated/ProfiledType_0.cpp, ../../torch/csrc/autograd/generated/ProfiledType_1.cpp, ../../torch/csrc/autograd/generated/ProfiledType_2.cpp, ../../torch/csrc/autograd/generated/ProfiledType_3.cpp, ../../torch/csrc/autograd/generated/ProfiledType_4.cpp, ../../torch/csrc/autograd/generated/TraceType_0.cpp, ../../torch/csrc/autograd/generated/TraceType_1.cpp, ../../torch/csrc/autograd/generated/TraceType_2.cpp, ../../torch/csrc/autograd/generated/TraceType_3.cpp, ../../torch/csrc/autograd/generated/TraceType_4.cpp, ../../torch/csrc/autograd/generated/Functions.h, ../../torch/csrc/autograd/generated/variable_factories.h, ../../torch/csrc/autograd/generated/VariableType.h, ../../torch/csrc/autograd/generated/python_functions.cpp, ../../torch/csrc/autograd/generated/python_variable_methods.cpp, ../../torch/csrc/autograd/generated/python_torch_functions.cpp, ../../torch/csrc/autograd/generated/python_nn_functions.cpp, ../../torch/csrc/autograd/generated/python_functions.h
7>------ Build started: Project: __aten_op_header_gen, Configuration: Release x64 ------
8>------ Build started: Project: torch_python_stubs, Configuration: Release x64 ------
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>cpu_concat.cpp
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>cpu_layer_normalization_list.cpp
3>cpu_shuffle_list.cpp
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>gemm_convolution_utils.cpp
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>ref_convolution.cpp
3>ref_deconvolution.cpp
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>ref_eltwise.cpp
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>ref_inner_product.cpp
3>ref_layer_normalization.cpp
3>ref_lrn.cpp
3>ref_pooling.cpp
3>ref_resampling.cpp
3>ref_shuffle.cpp
3>ref_softmax.cpp
3>D:\Codes\pytorch-1.6.0\third_party\ideep\mkl-dnn\src\cpu\gemm_convolution_utils.cpp(401): fatal error C1001: Internal compiler error.
3>(compiler file 'd:\agent\_work\7\s\src\vctools\Compiler\Utc\src\p2\main.c', line 195)
3> To work around this problem, try simplifying or changing the program near the locations listed above.
3>If possible please provide a repro here: https://developercommunity.visualstudio.com
3>Please choose the Technical Support command on the Visual C++
3> Help menu, or open the Technical Support help file for more information
3>  CL!RaiseException()+0x69
3>  CL!RaiseException()+0x69
3>  CL!CloseTypeServerPDB()+0x22e6b
3>  CL!CloseTypeServerPDB()+0xcd30a
3>simple_concat.cpp
3>simple_layer_normalization.cpp
3>simple_layer_normalization_kernels.cpp
3>simple_resampling.cpp
3>simple_sum.cpp
3>gemm_utils_f32.cpp
3>ref_gemm_f32.cpp
3>gemm.cpp
3>gemm_pack.cpp
3>ref_gemm_s8x8s32.cpp
3>simple_gemm_s8s8s32.cpp
3>cpu_matmul_list.cpp
3>cl : command line error D8040: error creating or communicating with child process
3>Done building project "dnnl_cpu.vcxproj" -- FAILED.
9>------ Build started: Project: dnnl, Configuration: Release x64 ------
9>Microsoft (R) Library Manager Version 14.27.29111.0
9>Copyright (C) Microsoft Corporation.  All rights reserved.
9>
9>"/OUT:D:\Codes\pytorch-1.6.0\build_dir\lib\Release\dnnl.lib" /NOLOGO /MACHINE:X64 /machine:x64 /ignore:4049 /ignore:4217 dnnl.dir\Release\version.res
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\batch_normalization.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\binary.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\concat.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\convolution.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\convolution_pd.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\deconvolution.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\dnnl_debug.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\dnnl_debug_autogenerated.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\eltwise.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\engine.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\inner_product.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\layer_normalization.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\lrn.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\matmul.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\memory.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\memory_debug.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\memory_desc_wrapper.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\memory_storage.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\memory_zero_pad.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\pooling.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_attr.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_cache.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_desc.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_exec_types.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_hashing.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_iterator.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\query.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\reorder.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\resampling.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\rnn.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\rw_mutex.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\scratchpad.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\scratchpad_debug.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\shuffle.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\softmax.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\stream.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\stream_attr.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\sum.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\utils.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\verbose.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\bfloat16.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_batch_normalization_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_batch_normalization_utils.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_binary_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_concat.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_convolution_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_deconvolution_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_eltwise_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_engine.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_inner_product_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_layer_normalization_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_lrn_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_pooling_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_reorder.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_resampling_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_rnn_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_shuffle_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_softmax_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_sum.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\gemm_convolution.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\gemm_convolution_utils.obj"
9>D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\gemm_convolution_utils.obj : fatal error LNK1136: invalid or corrupt file
9>Done building project "dnnl.vcxproj" -- FAILED.
10>------ Build started: Project: torch_cpu, Configuration: Release x64 ------
11>------ Build started: Project: compat_libs, Configuration: Release x64 ------
11>Error copying file "D:/Codes/pytorch-1.6.0/build_dir/lib/Release/dnnl.lib" to "D:/Codes/pytorch-1.6.0/build_dir/lib/Release/mkldnn.lib".
11>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6006: "cmd.exe" exited with code 1.
11>Done building project "compat_libs.vcxproj" -- FAILED.
10>Generating ../../torch/csrc/autograd/generated/Functions.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_0.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_1.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_2.cpp, ../../torch/csrc/autograd/generated/VariableType_0.cpp, ../../torch/csrc/autograd/generated/VariableType_1.cpp, ../../torch/csrc/autograd/generated/VariableType_2.cpp, ../../torch/csrc/autograd/generated/VariableType_3.cpp, ../../torch/csrc/autograd/generated/VariableType_4.cpp, ../../torch/csrc/autograd/generated/ProfiledType_0.cpp, ../../torch/csrc/autograd/generated/ProfiledType_1.cpp, ../../torch/csrc/autograd/generated/ProfiledType_2.cpp, ../../torch/csrc/autograd/generated/ProfiledType_3.cpp, ../../torch/csrc/autograd/generated/ProfiledType_4.cpp, ../../torch/csrc/autograd/generated/TraceType_0.cpp, ../../torch/csrc/autograd/generated/TraceType_1.cpp, ../../torch/csrc/autograd/generated/TraceType_2.cpp, ../../torch/csrc/autograd/generated/TraceType_3.cpp, ../../torch/csrc/autograd/generated/TraceType_4.cpp, ../../torch/csrc/autograd/generated/Functions.h, ../../torch/csrc/autograd/generated/variable_factories.h, ../../torch/csrc/autograd/generated/VariableType.h, ../../torch/csrc/autograd/generated/python_functions.cpp, ../../torch/csrc/autograd/generated/python_variable_methods.cpp, ../../torch/csrc/autograd/generated/python_torch_functions.cpp, ../../torch/csrc/autograd/generated/python_nn_functions.cpp, ../../torch/csrc/autograd/generated/python_functions.h
4>Skipped writing torch/csrc\autograd\generated\python_functions.h
4>Skipped writing torch/csrc\autograd\generated\python_functions.cpp
4>Skipped writing torch/csrc\autograd\generated\python_variable_methods.cpp
4>Skipped writing torch/csrc\autograd\generated\python_torch_functions.cpp
4>Skipped writing torch/csrc\autograd\generated\python_nn_functions.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableType.h
4>Skipped writing torch/csrc\autograd\generated\VariableType_0.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledType_0.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceType_0.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableType_1.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledType_1.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceType_1.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableType_2.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledType_2.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceType_2.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableType_3.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledType_3.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceType_3.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableType_4.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledType_4.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceType_4.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableTypeEverything.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledTypeEverything.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceTypeEverything.cpp
4>Skipped writing torch/csrc\autograd\generated\RegistrationDeclarations.h
4>Skipped writing torch/csrc\autograd\generated\Functions.h
4>Skipped writing torch/csrc\autograd\generated\Functions.cpp
4>Skipped writing torch/csrc\autograd\generated\variable_factories.h
4>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_0.cpp
4>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_1.cpp
4>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_2.cpp
10>Skipped writing torch/csrc\autograd\generated\python_functions.h
10>Skipped writing torch/csrc\autograd\generated\python_functions.cpp
10>Skipped writing torch/csrc\autograd\generated\python_variable_methods.cpp
10>Skipped writing torch/csrc\autograd\generated\python_torch_functions.cpp
10>Skipped writing torch/csrc\autograd\generated\python_nn_functions.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableType.h
10>Skipped writing torch/csrc\autograd\generated\VariableType_0.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledType_0.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceType_0.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableType_1.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledType_1.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceType_1.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableType_2.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledType_2.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceType_2.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableType_3.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledType_3.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceType_3.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableType_4.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledType_4.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceType_4.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableTypeEverything.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledTypeEverything.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceTypeEverything.cpp
10>Skipped writing torch/csrc\autograd\generated\RegistrationDeclarations.h
10>Skipped writing torch/csrc\autograd\generated\Functions.h
10>Skipped writing torch/csrc\autograd\generated\Functions.cpp
10>Skipped writing torch/csrc\autograd\generated\variable_factories.h
10>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_0.cpp
10>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_1.cpp
10>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_2.cpp
10>LINK : fatal error LNK1181: cannot open input file '..\lib\Release\dnnl.lib'
10>Done building project "torch_cpu.vcxproj" -- FAILED.
12>------ Build started: Project: torch, Configuration: Release x64 ------
12>LINK : fatal error LNK1181: cannot open input file '..\lib\Release\torch_cpu.lib'
12>Done building project "torch.vcxproj" -- FAILED.
13>------ Build started: Project: caffe2_pybind11_state, Configuration: Release x64 ------
14>------ Build started: Project: shm, Configuration: Release x64 ------
15>------ Build started: Project: caffe2_observers, Configuration: Release x64 ------
16>------ Build started: Project: caffe2_detectron_ops, Configuration: Release x64 ------
15>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\torch.lib'
15>Done building project "caffe2_observers.vcxproj" -- FAILED.
14>LINK : fatal error LNK1181: cannot open input file '..\..\..\..\lib\Release\torch.lib'
14>Done building project "shm.vcxproj" -- FAILED.
17>------ Build started: Project: torch_python, Configuration: Release x64 ------
18>------ Build started: Project: windows_python_copy_lib, Configuration: Release x64 ------
16>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\torch.lib'
16>Done building project "caffe2_detectron_ops.vcxproj" -- FAILED.
18>Error copying file "D:/Codes/pytorch-1.6.0/build_dir/caffe2/python/Release/caffe2_pybind11_state.cp37-win_amd64.pyd" to "D:/Codes/pytorch-1.6.0/build_dir/caffe2/python".
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: The command "setlocal
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -E copy D:/Codes/pytorch-1.6.0/build_dir/caffe2/python/Release/caffe2_pybind11_state.cp37-win_amd64.pyd D:/Codes/pytorch-1.6.0/build_dir/caffe2/python
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmEnd
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmErrorLevel
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: exit /b %1
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmDone
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :VCEnd" exited with code 1.
18>Done building project "windows_python_copy_lib.vcxproj" -- FAILED.
17>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\shm.lib'
17>Done building project "torch_python.vcxproj" -- FAILED.
========== Build: 7 succeeded, 11 failed, 28 up-to-date, 0 skipped ==========

Linker errrors:
Severity    Code    Description Project File    Line    Suppression State
Error   C1001   Internal compiler error.    dnnl_cpu    D:\Codes\pytorch-1.6.0\third_party\ideep\mkl-dnn\src\cpu\gemm_convolution_utils.cpp 401
Error   D8040   error creating or communicating with child process  dnnl_cpu    D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\cl   1
Error   LNK1136 invalid or corrupt file dnnl    D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\gemm_convolution_utils.obj  1
Error   MSB6006 "cmd.exe" exited with code 1.   compat_libs C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets    234
Error   LNK1181 cannot open input file '..\lib\Release\dnnl.lib'    torch_cpu   D:\Codes\pytorch-1.6.0\build_dir\caffe2\LINK    1
Error   LNK1181 cannot open input file '..\lib\Release\torch_cpu.lib'   torch   D:\Codes\pytorch-1.6.0\build_dir\caffe2\LINK    1
Error   LNK1181 cannot open input file '..\..\lib\Release\torch.lib'    caffe2_observers    D:\Codes\pytorch-1.6.0\build_dir\modules\observers\LINK 1
Error   LNK1181 cannot open input file '..\..\..\..\lib\Release\torch.lib'  shm D:\Codes\pytorch-1.6.0\build_dir\caffe2\torch\lib\libshm_windows\LINK   1
Error   LNK1181 cannot open input file '..\..\lib\Release\torch.lib'    caffe2_detectron_ops    D:\Codes\pytorch-1.6.0\build_dir\modules\detectron\LINK 1
Error   MSB3073 The command "setlocal
"C:\Program Files\CMake\bin\cmake.exe" -E copy D:/Codes/pytorch-1.6.0/build_dir/caffe2/python/Release/caffe2_pybind11_state.cp37-win_amd64.pyd D:/Codes/pytorch-1.6.0/build_dir/caffe2/python
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1. windows_python_copy_lib C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets    149
Error   LNK1181 cannot open input file '..\..\lib\Release\shm.lib'  torch_python    D:\Codes\pytorch-1.6.0\build_dir\caffe2\torch\LINK  1

What am I missing here?

A: You are not the first to encounter this issue:

Moving from Visual Studio v16.6.4 to v16.7.1, we now see the following
error when compiling oneDNN:
[path]src\cpu\gemm_convolution_utils.cpp(401) : fatal error C1001:
Internal compiler error.

A fix for your issue is included in Pytorch 1.6.2.
The compiler bug itself is still under investigation and has not been solved as of today.

A: An Internal compiler error is always a bug with the compiler. In this case, it's prevented building of a library that is needed later in the build process.
Your options are limited. I suggest trying a different version of Visual Studio.
You should also report this to Microsoft.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Having a subview inside Unity for native IOS apps For my iOS app built with unity engine, I have a use case where I would want to direct the user to settings page from within the app itself. I am using objectiveC to create a custom plugin for iOS that directs user to settings page. But it backgrounds the app and brings up the settings page. I would like to be able to achieve this from within the app itself if its possible to show settings in some kind of subview popup in the app? I have seen this somewhere for example where the app brings up a mail subview or a google map subview inside the app itself but not sure if its possible for doing something similar with iOS native settings page?
Currently i am using openURL to simply direct user to settings URL page but I would like this to be embedded in some subview from within the app itself
 NSURL *url = [NSURL URLWithString:@"prefs:root=NOTIFICATIONS_ID"];
 [[UIApplication sharedApplication] openURL:url];

Any ideas?

A: It's not possible to show a portion of the Settings app in your own app like you can do with mail or maps. However, you can build your own UI within your app to edit settings.


text:
Q: Help in writing Asynchronous Batch Apex to avoid governor limit of 150 records I have a function that has the DML operation inside the for loop due to which I am running into governor limit exception of 150 records. I read about batch apex on Salesforce discussion about not sure how to implement it given the function I already have working. Can someone guide me please? Thanks.
void RunObjectPermissions(String val1, String val2, String testname, String testType, String testDescription)
{
List<Temp_TestResults__c> resList= [select id from Temp_TestResults__c];
//delete resList;
string qry = 'SELECT Parent.Profile.Name, Parent.ProfileID, ParentID, Parent.Label, Parent.Name FROM ObjectPermissions WHERE SObjectType = :val1 AND  ' + val2 + ' = True';
    List<ObjectPermissions> permSetSR = New List<ObjectPermissions>();
    permSetSR = Database.query(qry);
for(ObjectPermissions psr : permSetSR)
{
            Temp_TestResults__c results = new Temp_TestResults__c();
            {
            If (psr.Parent.ProfileID == null )
            {
                        results.Reference_Name__c =psr.Parent.Name;
                        results.Reference_Type__c = 'Permission Set';
                        results.Reference_ID__c = psr.ParentID;
                        results.Test_Name__c = testname;
                        results.Test_Type__c = testType;
                        results.Test_Description__c = testDescription;
                        insert results;
}

        else if(psr.Parent.ProfileID !=null && psr.Parent.Profile.Name != Null)
            {
                    results.Reference_Name__c = psr.Parent.Profile.Name;
                    results.Reference_Type__c = 'Profile';
                    results.Reference_ID__c = psr.ParentID;
                    results.Test_Name__c = testname;
                    results.Test_Type__c = testType;
                    results.Test_Description__c = testDescription;
                    insert results;
            }
}

}
}

A: Even in Batch Apex, you're responsible for writing bulkified code that uses governor limits efficiently. But you don't need Batch Apex here, and it's not a solution to this problem.
Here, you simply need to create a List<Temp_TestResults__c> resultsList variable and add each object you create to that list. Then, outside your for loop, do
insert resultsList;

to insert all of these objects in a batch.
This is a standard Apex pattern that you will see and use everywhere. If you're not familiar with it, taking some time to work through the excellent Trailhead materials that cover this topic will pay off as you continue to develop your code - it is absolutely critical to doing development on the Salesforce platform.


text:
Q: How To Use Mesibo on My WordPress Website I'm new here and not a programmer. However, I have a wordpress website which I love to install mesibo on, how can I install Mesibo on wordpress website for chat, voice and video conferencing?
Thanks

A: You have to use an API to use it on WordPress. Here is the documentation:
https://mesibo.com/documentation/tutorials/get-started/


text:
Q: Abelian Group Extension I have the following group:
$$A = \mathbb{Z}/p_1^{r_1} \times \mathbb{Z}/p_2^{r_2} \mathbb{Z} \times \cdots \times \mathbb{Z}/p_n^{r_n} \mathbb{Z}$$
each $p_i$ being a prime, but they need not be distinct primes.
I want to solve the following isomorphism of abelian groups,
$$\frac{X}{\mathbb{Z}/p\mathbb{Z}} \cong A$$
I think there are only two types of possibility:

*

*Direct product $X = \mathbb{Z}/p\mathbb{Z} \times A$

*If $p = p_i$ we could have $\mathbb{Z}/p_1^{r_1} \times \mathbb{Z}/p_2^{r_2} \mathbb{Z} \times \cdots \times \mathbb{Z}/p_i^{r_n+1} \mathbb{Z} \times \cdots \times \mathbb{Z}/p_n^{r_n} \mathbb{Z}$

But how could I prove these are the only possibility? thanks a lot!

A: There are various ways to approach this (and more general problems of the same flavour), but maybe the easiest in this context is to use the classification of finite abelian groups:
The abelian group $X$ has order equal to $p \times$ the order of $A$,
and contains a subgroup of order $p$ such that the quotient is isomorphic to $A$.
If you think about the possible elementary divisors of $X$ which are compatible
with these two statements, you will get the result you want.

A: If you don't know the fundamental theorem of finitely generated abelian groups (which seems like it might be the case given that you don't know what an "elementary divisor" is, unless this is simply a problem of language which is certanly possible), here is another approach.
Suppose $X$ is such a group. Consider the collection of all elements of order $p$ in $X$; it is not empty, since $p$ divides the order of $X$, so by Cauchy's Theorem there is such an element. If there exists $x\in X$ of order $p$ such that $\langle x\rangle \cap A = \{0\}$, then let $B=\langle x\rangle$. Then $A\cap B=\{0\}$, and $|A+B| = |X|$, hence $A+B=X$, and therefore $X=A\oplus B$, proving that $X\cong A \times C_p$, as desired (I use $C_n$ for the cyclic group of order $n$).
The only other possibility is that every element of order $p$ in $X$ is contained in $A$. Let $x\in X$ be an element of order a power of $p$ that maps to a generator of $X/A$ (it exists, because if you pick any preimage of one generator, and ther order is not a $p$-power, you can pick an adequate multiple to get another element that maps to perhaps a different generator and is a prime power. Note also that $x\notin A$ and $px\in A$. So now we are working inside the $p$-parts of $X$ and $A$, and so we may assume that $X$ and $A$ are both abelian $p$-groups. So $A=C_{p^{a_1}}\oplus\cdots\oplus C_{p^{a_k}}$ with $a_1\leq\cdots\leq a_k$. Write $px$ as an element of $A$; by adding suitable elements of $A$ to $x$ you can ensure that any component of $px$ that is a multiple of $p$ is actually equal to $0$: for example, if the $i$th component is $p^{\ell}ky_i$, where $y_i$ is the generator, $\ell\gt 0$ and $\gcd(k,p)=1$, then adding $-p^{\ell-1}ky_i$ to $x$ still keeps it an element that maps to a generator of $X/A$, but now the $i$th component of $px$ is $0$. Then replacing any generators by suitable powers, you may assume that the "vector" that describes $px$ has all components equal to either $0$ or $1$. Doing an easy change of basis for $A$ gives you the description of $X$ that you want in this situation.


text:
Q: PHP script, SQL insert error I'm running a wamp server and created a series of html webpages the data being put in by the user is then being submitted to a SQL database through a PHP script. I created a database table with Id. set to INT auto increment Crime. and Suspect. set as VARCHAR(40). I can connect to the database but now when I try to insert I get the error:

'Problem with insert: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'case (Id, Case, Suspect) VALUES('NULL', 'test', 'test12')' at line 1'

So I know its an issue with the insert function however cannot fix it!
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$db = 'fid';

$case = (isset($_POST['case'])? $_POST['case']:"None");
$suspect= (isset($_POST['suspect'])? $_POST['suspect']:"None");

$conn = mysql_connect($dbhost,$dbuser,$dbpass);
if (!$conn)
die('Could not connect: ' . mysql_error());
mysql_select_db($db);
mysql_query("INSERT INTO case
(Id, Case, Suspect) VALUES('NULL', '$case', '$suspect') ")
or die(' Problem with insert: ' . mysql_error());
echo 'Connected successfully';
mysql_close($conn);
?>

A: case is a reserved keyword. If you're going to have a table and columnj  named case you need to put it in ticks:
INSERT INTO `case` (Id, `Case`, Suspect) VALUES('NULL', '$case', '$suspect')

Also,
Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.


text:
Q: Log query to get a value from a log message and get the average I have some log messages in my Loki:
2023-02-13 12:20:08.675  INFO 30937 --- [lettuce-epollEventLoop-5-1] c.g.poc.Filter.AuthenticationFilter      : [ requestId : 904c1292-66, AuthFilterTime : 15 ms ]
2023-02-13 12:16:32.100  INFO 30937 --- [lettuce-epollEventLoop-5-1] c.g.poc.Filter.AuthenticationFilter      : [ requestId : f84a572f-65, AuthFilterTime : 4 ms ]
2023-02-13 12:16:31.427  INFO 30937 --- [lettuce-epollEventLoop-5-1] c.g.poc.Filter.AuthenticationFilter      : [ requestId : 904c1292-64, AuthFilterTime : 10 ms ]

I want to get the average value of AuthFilterTime.
I'm getting the error:

"parse error at line 5, col 6: syntax error: unexpected NUMBER"

when i run the query,
sum by (filename)(
  avg_over_time(
    {filename="/path/to/the/log/file"} |= "AuthFilterTime.*ms" |
    regexp `AuthFilterTime\s*:\s*(\d+) ms` |
    $1
  )[24h]
)

Can somebody help what is it that i've been doing wrong??
I'm actually new to grafana.

A: try this
avg_over_time({filename="/path/to/the/log/file"} |
  regexp "(?m)AuthFilterTime\s*:\s*([0-9]+) ms" |
  float |
  mean() [24h])

This query uses regular expressions to extract the AuthFilterTime value from each log message and then calculates the average value over a 24-hour period. The float function is used to convert the extracted value from a string to a floating-point number.


text:
Q: Redis pubsub and scaling? For communication between the various services used pubsub. If you create multiple workers

, they both accept data both to process them. What are some methods
  that have worked in the same message, only one of the workers

.
PS Perhaps there are some layers, so-called message brokers


text:
Q: Rails: Has Many... Through Syntax Issue With Where Scope So I have two models, users and services. Users that check a service basically bookmarks it, so I want to access them via user.checks.  Now there can be different relationships between a user and service, that's why I placed the where clause to make sure the relationship_type is check.
The Code
 has_many :checks, through: :user_services, source: :service, dependent: :destroy, -> { where relationship_type: 'check' }

The Error
/app/models/user.rb:21: syntax error, unexpected '\n', expecting =>

It's a syntax issue and I can't figure it out!

A: When you pass a hash as parameter to a method, you can suppress the {} only when the hash is the last (or only) parameter passed. In this case, you pass a lamba after it, so you must explicitly write the hash as
has_many :checks, { through: :user_services, source: :service, dependent: :destroy }, -> { where relationship_type: 'check' }


text:
Q: WPML translate without duplicating post This seems hard to explain, I don't seem to be able to come up with a google search that will give me what I need. I think the concept of the question is quite simple though:
I'm building a site with a product catalog (no e-commerce, just a browsable catalog), the catalog uses custom post types ('products'), with custom taxonomies (e.g. 'type', 'collection', 'audience', 'regions-available' etc.).
The front end needs to display the site in various languages, WPML seems to be the industry standard way of doing this, but I'm confused at how it seems to work.
Conceptually, I want 1 set of products, and I want to display different names (labels) for things depending on which language the user is accessing the site through, but they should be viewing/editing the same underlying product (same database item).

The way WPML seems to want to work is when I change language, say from English to French, it expects me to create a duplicate of the product for each language. This is obviously not what I want, as it would mean each change to a single product would need to be updated across all languages.
It may be possible this just isn't the way WPML works, in which case I need recommending a different solution/plugin.

Note how in the 2nd screenshot "Toy Story Literie" is my French translation of "Toy Story Bedding", and I've been able to change which Regions they're available in, independently of each other.
To me it seems like, all I should really have is 1 product, then translate the labels for my custom taxonomy terms.
This has kind of worked, the 'Bedding' collection name becomes 'Literie' in the French tab.
I thought I'd done this following the instructions on translating taxonomy terms at the bottom of here: https://wpml.org/documentation/translating-your-contents/using-the-translation-editor/
But it seems no matter what I do, WPML wants to create a new 'product' for each language, each with individual settings that can diverge.
I don't want my client to have to manage a separate version of their catalog for each language.
Long winded explanation - I'm sure there must be a simple answer, or what advantage does WPML have over just building a multi-site? I must be missing something!

A: The way WPML works is that you have a translation or a duplication across all languages of your content, that way each language has access to all content. You can duplicate or better yet batch duplicate any content that you need for all languages. WPML makes it easy to maintain that content across all languages. When you update your posts in the default language, all languages will get updated automatically. Make sure to get everything set up properly first though. For example, in order to make sure your images for a post change in all languages when changed in the default, you'll need the media module installed and set up. Also make sure to check the custom fields that you want copied. Spending the time setting up properly initially is worth it.
When you've done your set up and are ready to batch duplicate content, go to "translation dashboard" and depending on what content you have, select the post type or category to batch duplicate. Then all you have to do is update the original/default and your duplicates will also get the update.

A: If you still need help the best way is to ask in WPML forum. (Client can make special account for you, so you can ask question in WPML forum)
First check if all necessary plugins are installed:

Probably they buy one simple version and this is not enough to translate all what you need.
Also, this will be useful for you.
The Extra options when you edit the main post before you will translate something:

As you can see here is alot of oprions to make some parts of your product to not translate, copy, etc.
I hope you can finish the job, but this plugin is very good and powerful.


text:
Q: Query not producing what its supposed to I have the following two tables:
Table Authors:
AuthorID  Name
A         John
B         Alex
C         Carl

Table AuthorsCompatibility:
AuthorID1    AuthorID2    Compatibility
A            B            5.0
A            C            4.0
B            C            4.5

I want to produce the following:
AuthorID1   Name1    AuthorID2   Name2   Compatibility
A           John     B           Alex    5.0
A           John     C           Carl    4.0
B           Alex     C           Carl    4.5

This is what I tried, but I know it's not working:
select AuthorID1, A.Name, AuthorID2, B.Name, Compatibility
from AuthorsCompatibility, Authors as A, Authors as B
where AuthorID1=A.AuthorID and AuthorID2=B.AuthorID

A: SELECT ac.AuthorID1, a.Name, ac.AuthorID2, b.Name, ac.Compatibility
FROM AuthorsCompatibility ac
INNER JOIN AUTHORS a ON ac.AuthorID1 = a.AuthorID
INNER JOIN AUTHORS b ON ac.AuthorID2 = b.AuthorID

A: You're not joining correctly (you're using the very old style joins). Try joins like this below;
SELECT
    ac.AuthorID1
    ,a1.Name AS Name1
    ,ac.AuthorID2
    ,a2.Name AS Name2
    ,ac.Compatibility
FROM AuthorsCompatibility ac
INNER JOIN Authors a1
    ON ac.AuthorID1 = a1.AuthorID
INNER JOIN Authors a2
    ON ac.AuthorID2 = a2.AuthorID

Using this sample data;
CREATE TABLE Authors (AuthorID nvarchar(1), Name nvarchar(10))
INSERT INTO Authors
VALUES
('A', 'John')
,('B', 'Alex')
,('C', 'Carl')

CREATE TABLE AuthorsCompatibility (AuthorID1 nvarchar(1), AuthorID2 nvarchar(1), Compatibility money)
INSERT INTO AuthorsCompatibility (AuthorID1, AuthorID2, Compatibility)
VALUES
('A', 'B', 5.0)
,('A', 'C', 4.0)
,('B', 'C', 4.5)

Gives this result;
AuthorID1   Name1   AuthorID2   Name2   Compatibility
A           John    B           Alex    5.00
A           John    C           Carl    4.00
B           Alex    C           Carl    4.50

A: You can rewrite it in JOIN-form like this
select ac.AuthorID1, A.Name, ac.AuthorID2, B.Name, ac.Compatibility
  from AuthorsCompatibility ac
  join Authors as A
    on ac.AuthorID1 = A.AuthorID
  join Authors as B
    on ac.AuthorID2 = B.AuthorID

A: I have tried your query and it works properly:
CREATE TABLE #Authors (AuthorID nvarchar(1), Name nvarchar(10))
INSERT INTO #Authors
VALUES
('A', 'John')
,('B', 'Alex')
,('C', 'Carl')

CREATE TABLE #AuthorsCompatibility (AuthorID1 nvarchar(1), AuthorID2 nvarchar(1), Compatibility money)
INSERT INTO #AuthorsCompatibility (AuthorID1, AuthorID2, Compatibility)
VALUES
('A', 'B', 5.0)
,('A', 'C', 4.0)
,('B', 'C', 4.5)

select
    AuthorID1, A.Name, AuthorID2, B.Name, Compatibility
from #AuthorsCompatibility, #Authors as A, #Authors as B
where AuthorID1=A.AuthorID and AuthorID2=B.AuthorID

drop table #AuthorsCompatibility,#Authors


text:
Q: Getting zeros with SSE Shift I have this code:
#include <immintrin.h>
#include <stdio.h>

void main(){
    int i;
    __m128 x_v, y_v, e_v;
    __m128i mask_v;

    float x[8]={1.0f,2.0f,3.0f,4.0f};
    float y[8]={1.0f,2.0f,3.0f,4.0f};
    int exp0mask = 0xFFFFFFFF;

    for(i=0; i+3<4; i+=4) {
        x_v = _mm_loadu_ps(x+i);
        y_v =  _mm_loadu_ps(y+i);
        mask_v = _mm_set1_epi32(exp0mask);
        e_v = _mm_and_ps(x_v,  _mm_castsi128_ps(mask_v));
        e_v = _mm_castsi128_ps(_mm_srli_epi32(_mm_castps_si128(e_v), 23));
        _mm_storeu_ps(y+i, e_v);
        printf("%f\n", y[i]);
        printf("%f\n", y[i+1]);
        printf("%f\n", y[i+2]);
        printf("%f\n", y[i+3]);
    }
}

And this is the result:
0.000000
0.000000
0.000000
0.000000

The values in x[i] (a float array) are not zero. I have observed, that the zero-result happens after the shift-operation _mm_srli_epi32. But why is that so and what can I do?


text:
Q: Compilar y solucionar el error JAVA Me piden que se corrija el error de manera que se pueda ejecutar el código e indique donde se encuentra el mismo. No logro averiguar el error. Estoy trabajando con Netbeans, y no me apaño muy bien todavia. Agradezco de antemano la ayuda. Gracias.
public class Error {
  public static void main(String[] name) {
    int x = 300;
    int y = 200;
    int z;
    int w = x + y + z;
    System.out.print(w);
  }
}

A: Debes inicializar la variable z, para inicializarlo se le da un valor, en este caso asigne 0 para inicializarla, a reserva de que desees darle otro.
public class Error {
  public static void main(String[] name) {
    int x = 300;
    int y = 200;
    int z = 0;
    int w = x + y + z;
    System.out.print(w);
  }
}

Es importante tener en cuenta que las variables deben recibir un valor inicial antes de poder leer los datos que contienen. Si se trata de leer los datos del valor de una variable que no ha sido inicializada, los compiladores normalmente reportan un error y no compilan el programa.

A: La respuesta de nuestro compañero es correcta si defines una variable dentro de un método en una clase de java, hay que instanciarla si o sí. también recalcar que si la variable es definida como atributo de la clase directamente, no es necesario instanciarla puesto que java instancia automáticamente las variables de clase, con lo que le hubiera dado un valor de 0 automáticamente por ser un int. Solo era como aclaración, ciertamente es una muy buena practica asignar valor a cualquier variable ya sea dentro de un método o de una variable de clase, para evitar fallos de este tipo por descuido.


text:
Q: Unexpected output from "mimic" function exercise from Google Python Class First of all, apologies if some stupid error lies ahead: I have just started to ("re")learn Python (I am using Python 2.7).
I have completed one exercise from the Google Python Class, called "mimic", but I'm sometimes getting some strange results and I would like to understand why this is happening.
The exercise asks the following things:
1) Read in the file specified on the command line.
2) Build a "mimic" dict that maps each word that appears in the file to a list of all the words that immediately follow that word in the file. The list of words can be be in any order and should include duplicates. So for example the key "and" might have the list ["then", "best", "then", "after", ...] listing all the words which came after "and" in the text. We'll say that the empty string is what comes before the first word in the file.
3) With the mimic dict, it's fairly easy to emit random text that mimics the original. Print a word, then look up what words might come next and pick one at random as the next work. Use the empty string as the first word to prime things.
If we ever get stuck with a word that is not in the dict, go back to the empty string to keep things moving.
This is my code:
import random
import sys

def mimic_dict(filename):
  """Returns mimic dict mapping each word to list of words which follow it."""
  d = {}
  with open(filename) as f:
    text = f.read()
    words = text.split()
  i = 0
  for i in range(len(words) - 1):
    if words[i] not in d:
      d[words[i]] = [words[i + 1]]
    else:
      d[words[i]].append(words[i+1])
    i += 1
  d[''] = words[0]
  return d

def print_mimic(d, word):
  """Given mimic dict and start word, prints 200 random words."""
  mimic_text = []
  while len(mimic_text) < 200:
    if word in d:
      next_word = random.choice(d[word])
      mimic_text.append(next_word)
      word = next_word
    else:
      word = ''
  print ' '.join(mimic_text)

# Provided main(), calls mimic_dict() and mimic()
def main():
  if len(sys.argv) != 2:
    print 'usage: ./mimic.py file-to-read'
    sys.exit(1)

  dict = mimic_dict(sys.argv[1])
  print_mimic(dict, '')

if __name__ == '__main__':
  main()

Now, the problem is that if I feed this mimic function with a very simple text file, small.txt, which contains this:
We are not what we should be
We are not what we need to be
But at least we are not what we used to be
  -- Football Coach

the output looks like this:
e W e W W W W W e e e e e W e W [...]

That is, a random sequence of the letters of the first word.
But, if I run it on a much longer file (alice.txt, that contains the whole text from Alice in Wonderland), I get some random letters at the beginning (and sometimes not even those letters), but then somehow it works, here are some examples:
Run 1 output (truncated):
l i ' s l e ' ' i ' e s e c s ' A large flower-pot that the next[...]

Run 2 output (truncated):
i i i A little door, staring at all,' said in fact, [...]

Run 3 output (truncated):
 A Caucus-Race and she found out of Hearts,[...]

It seems that once it gets to the letter "A" it starts working as expected, but I really can't understand what's going on before getting to that letter.
I am sure there is just a stupid bug somewhere, but I can't find it, and I would be really thankful if some gentle soul could take some time to help me understand what's going on here.
Thank you very much!

A: You missed two characters.
d[''] = words[0] should be d[''] = [words[0]].


text:
Q: Only animate on last loaded items (ajax loadmore) I got a page which shows some items, when you press a button more items are loaded. The entire div wrapping the items has a class to it that makes it animate.
My problem:
When you press the button, the entire script is loaded again through ajax (with an added limit in the query) so all of them animate again.
Is it possible to only make the newly loaded items animate? Maybe by counting what new items are loaded or something.
I can't really wrap my head around on how to do this, maybe someone can help me on the way.
The animate class is called: FadeIn
My php script:
<?PHP
class Connection {
    // Configure Database Vars
    private $host     = 'localhost';
    private $username = 'name';
    private $password = 'pass';
    private $db_name  = 'db';
    public $dbase;

    function __construct() {
        // Create connection
        $db = new mysqli($this->host, $this->username, $this->password, $this->db_name);

        // Check connection
        if ($db->connect_errno > 0) {
            die('Unable to connect to the database: '.$db->connect_error);
        }

        $this->db = $db;
    }

    public function query($query) {
        $db = $this->db;
        $this->db->query('SET NAMES utf8');
        if (!$result = $this->db->query($query)) {
            die('There was an error running the query ['.$db->error.']');
        } else {
            return $result;
        }
    }

    public function multi_query($query) {
        $db = $this->db;
        if (!$result = $this->db->multi_query($query)) {
            die('There was an error running the multi query ['.$db->error.']');
        } else {
            return $result;
        }

    }

    public function real_escape_string($value) {
        return $this->db->real_escape_string($value);
    }

    public function inserted_id() {
        return $this->db->insert_id;
    }
}

$conn = new Connection;

//  Websites
$web                = "SELECT * FROM `name` WHERE catid = 9 AND state = 1 ORDER BY ordering LIMIT 0,".$_POST['limit']."";
$webcon             = $conn->query($web);
$webcr              = array();
while ($webcr[]     = $webcon->fetch_array());

foreach($webcr as $website){
    $web_images = $website['images'];
    $web_imgs = json_decode($web_images);

    if($website['title'] != ''){
        if($web_imgs->{'image_intro'}){
            $weboverzicht .= '

                            {'image_intro'}.'" class=""  alt="post" />

'.$website['title'].'

'.strip_tags($website['introtext']).'

Bekijk project

';
        }else{
            $weboverzicht .= '

'.$website['title'].'

'.strip_tags($website['introtext']).'

Bekijk project

';
        }
    }
}
echo $weboverzicht;
?>

My ajax file:
(function(){
/*
Meer websites laden
*/
var limit = 3;

$('#loadmore').click(function() {
    limit += 3;

    ajax();

});

var posts = document.getElementById('loadnews');

function ajax() {
    $.ajax({
    url: 'includes/loadmore.php',
    type: "POST",
    data: {limit: limit},
    success: function(data){
        loadnews.innerHTML = data;
    },
    error: function(jqXHR, exception) {
              if (jqXHR.status === 0) {
                   alert('Not connect.\n Verify Network.');
               } else if (jqXHR.status == 404) {
                   alert('Requested page not found. [404]');
               } else if (jqXHR.status == 500) {
                   alert('Internal Server Error [500].');
               } else if (exception === 'parsererror') {
                   alert('Requested JSON parse failed.');
               } else if (exception === 'timeout') {
                   alert('Time out error.');
               } else if (exception === 'abort') {
                   alert('Ajax request aborted.');
               } else {
                   alert('Uncaught Error.\n' + jqXHR.responseText);
               }
           }
    });
}

ajax();
}());

A: *

*get familiar with offset http://www.w3schools.com/php/php_mysql_select_limit.asp
2.
success: function(data){
    var newWrapper = document.createElement('div')
    //add class to newWrapper or whatever
    newWrapper.innerHTML=data;
    loadnews.appendChild(newWrapper)
}


text:
Q: shell_exec throwing warning php I am running the following command through shell_exec but I'm getting the following Warning. The command isn't executing on the server.
$output=shell_exec ("awk -F'\t' '/\[Data\]/{f=1;next} /^$/{f=0} f{gsub(/\t/,",");print}' 1.tsv > 2.csv");

Warning: Wrong parameter count for shell_exec() in /Applications/MAMP/htdocs/output/u.php on line 3

I tried using system and passthru but they result in fatal errors.
Whats wrong? I'm passing only one parameter in shell_exec.

A: You forgot to escape the string, there are "," in your sting:
$output=shell_exec ("awk -F'\t' '/\[Data\]/{f=1;next} /^$/{f=0} f{gsub(/\t/,\",\");print}' 1.tsv > 2.csv");


text:
Q: Getting error "404 The specified blob does not exist" when downlading blob using Uri I am trying to download blob using blob url in Service Bus Topic trigger Azure function, but getting below error:
Status: 404 (The specified blob does not exist.)
 ErrorCode: BlobNotFound
Content:
<?xml version="1.0" encoding="utf-8"?><Error>BlobNotFound<Message>The specified blob does not exist.
</Message></Error>

Below is my Startup.cs file:
[assembly: FunctionsStartup(typeof(Startup))]
namespace Emails.Dispatcher
{
    public class Startup : FunctionsStartup
    {
        public override void Configure(IFunctionsHostBuilder builder)
        {
            builder.Services.AddSingleton(x =>
            new BlobServiceClient(connectionString: Environment.GetEnvironmentVariable("AzureWebJobsStorage")));

            builder.Services.AddSingleton<IBlobService, BlobService>();

            builder.Services.AddLogging();
            builder.Services.AddHttpClient();
            builder.AddHelpers();
            builder.Services.AddWorkers();

        }
    }
}

BlobService:
public class BlobService : IBlobService
{
    private readonly BlobServiceClient _blobServiceClient;

    public BlobService(BlobServiceClient blobServiceClient)
    {
        this._blobServiceClient = blobServiceClient;
    }

    public async Task<byte[]> DownloadAsync(string containerName, string fileUri)
    {
        var containerClient = _blobServiceClient.GetBlobContainerClient(containerName);

        var blobClient = containerClient.GetBlobClient(fileUri);

        using (var ms = new MemoryStream())
        {
            await blobClient.DownloadStreamingAsync();
            return ms.ToArray();
        }
    }

    public async Task<BlobDto> UploadAsync(string containerName, string filename, string content)
    {
        var containerClient = _blobServiceClient.GetBlobContainerClient(containerName);

        var blobClient = containerClient.GetBlobClient(filename);

        var bytes = Encoding.UTF8.GetBytes(content);

        await using var memoryStream = new MemoryStream(bytes);

        await blobClient.UploadAsync(content);

        return new BlobDto
        {
            Uri = blobClient.Uri,
            Name = blobClient.Name
        };
    }
}

public interface IBlobService
{
    Task<BlobDto> UploadAsync(string containerName, string filename, string content);

    Task<byte[]> DownloadAsync(string containerName, string fileUri);
}

Actually this service is receiving full blob url (i.e. https://{storage-url}.blob.core.windows.net/{container-name}/files/unzip/691ec307-7c2b-4aaa-8f75-8742c9faa9f5/1615015726/{file-name}.pdf).
Am i missing anythigng here?

A: The issue is with the following line of code:
var blobClient = containerClient.GetBlobClient(fileUri);

When you create a BlobClient using ContainerClient and GetBlobClient, you need to provide just the name of the blob and not the entire URL.
To fix the issue, just pass the blob name.

A: I am able to download blob file with the help of Uri and and Name property of CloudBlockBlob. As shown below:
  public async Task<byte[]> DownloadAsync(string containerName, string fileUri)
        {
            var containerClient = _blobServiceClient.GetBlobContainerClient(containerName);

            var blobUri = new System.Uri(fileUri);

            var name = new CloudBlockBlob(blobUri).Name;

            var blobClient = containerClient.GetBlobClient(name);

            var response = await blobClient.DownloadStreamingAsync();

            using MemoryStream ms = new MemoryStream();

            await response.Value.Content.CopyToAsync(ms);

            ms.Position = 0;

            return ms.ToArray();
        }


text:
Q: Cannot create Android apps in Xamarin Studio I have searched over and over again but cannot find a solution. I also tried installing on two different machines with the same errors.
I installed from VS 2017 installer and also standalone from monodevelop.com to no avail.
Android app option is disabled in Xamarin Studio and therefore I cannot create a project.
Also tried re-installing everything (including VS with all options to no avail).
SDKs are also set correctly.
Screenshots:

Android Tools Log:
[2017-07-20 11:16:13.0] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found:
    Path contains adb in \platform-tools (C:\Program Files (x86)\Android\android-sdk).
[2017-07-20 11:16:13.0] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found:
    Path contains ndk-stack in \. (C:\android-ndk-r15b).
[2017-07-20 11:16:13.0] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory found:
    Path contains jarsigner.exe in \bin (C:\Program Files (x86)\Java\jdk1.8.0_131).
[2017-07-20 11:16:13.0] INFO: Did not find Xamarin.Android
[2017-07-20 11:16:13.0] INFO: Found Android SDK. API levels: (none)
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found:
    Path contains adb in \platform-tools (C:\Program Files (x86)\Android\android-sdk).
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found:
    Path contains ndk-stack in \. (C:\android-ndk-r15b).
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory found:
    Path contains jarsigner.exe in \bin (C:\Program Files (x86)\Java\jdk1.8.0_131).
[2017-07-20 11:19:24.2] INFO: Found Android SDK. API levels: (none)
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found:
    Path contains adb in \platform-tools (C:\Program Files (x86)\Android\android-sdk).
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found:
    Path contains ndk-stack in \. (C:\android-ndk-r15b).
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory found:
    Path contains jarsigner.exe in \bin (C:\Program Files (x86)\Java\jdk1.8.0_131).
[2017-07-20 11:19:24.2] INFO: Found Android SDK. API levels: (none)
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found:
    Path contains adb in \platform-tools (C:\Program Files (x86)\Android\android-sdk).
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found:
    Path contains ndk-stack in \. (C:\android-ndk-r15b).
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory found:
    Path contains jarsigner.exe in \bin (C:\Program Files (x86)\Java\jdk1.8.0_131).
[2017-07-20 11:19:24.2] INFO: Found Android SDK. API levels: (none)
[2017-07-20 11:19:24.2] INFO: Did not find Xamarin.Android
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found:
    Path contains adb in \platform-tools (C:\Program Files (x86)\Android\android-sdk).
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found:
    Path contains ndk-stack in \. (C:\android-ndk-r15b).
[2017-07-20 11:19:24.2] INFO: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory found:
    Path contains jarsigner.exe in \bin (C:\Program Files (x86)\Java\jdk1.8.0_131).
[2017-07-20 11:19:24.2] INFO: Found Android SDK. API levels: (none)

IDE Log:
INFO [2017-07-20 11:40:23Z]: Starting Xamarin Studio 6.3 (build 863)
INFO [2017-07-20 11:40:23Z]: Running on Microsoft .NET 4.0.30319.42000
INFO [2017-07-20 11:40:23Z]: Operating System: Windows 10.0.10586.0 (64-bit)
INFO [2017-07-20 11:40:23Z]: Found GTK# version 2.12.38
WARNING [2017-07-20 11:40:24Z]: Storage folder: C:\Users\livob002\AppData\Local\Xamarin\Cache\AppInsights\ad58ff9da41d9e46a009b5b523971c10f8ed4e28
INFO [2017-07-20 11:40:24Z]: Using GTK+ 2.24.26
INFO [2017-07-20 11:40:25Z]: Add-in loaded: MonoDevelop.Core
INFO [2017-07-20 11:40:25Z]: Add-in loaded: MonoDevelop.Ide
INFO [2017-07-20 11:40:27Z]: Add-in loaded: MonoDevelop.WindowsPlatform
INFO [2017-07-20 11:40:27Z]: Initializing Runtime MS.NET
INFO [2017-07-20 11:40:27Z]: GTK: Using Gtk theme from C:\Users\livob002\AppData\Roaming\XamarinStudio-6.0\Config\share\themes\Dark
Starting Xamarin Studio
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.Debugger
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.SourceEditor2
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.TextTemplating
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.DesignerSupport
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.Xml
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.AspNet
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.UnitTesting
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.RegexToolkit
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.Refactoring
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.CSharpBinding
INFO [2017-07-20 11:40:28Z]: Add-in loaded: MonoDevelop.PackageManagement
INFO [2017-07-20 11:40:28Z]: Add-in loaded: Xamarin.Ide.Insights
INFO [2017-07-20 11:40:29Z]: Add-in loaded: MonoDevelop.Xamarin.Ide
INFO [2017-07-20 11:40:29Z]: Add-in loaded: Xamarin.Ide.Identity
INFO [2017-07-20 11:40:29Z]: Add-in loaded: Xamarin.TestCloud
INFO [2017-07-20 11:40:29Z]: Add-in loaded: MonoDevelop.Debugger.Soft
INFO [2017-07-20 11:40:29Z]: Add-in loaded: MonoDevelop.MonoAndroid
INFO [2017-07-20 11:40:29Z]: Add-in loaded: Xamarin.Forms.Addin
INFO [2017-07-20 11:40:29Z]: Add-in loaded: MonoDevelop.GtkCore
INFO [2017-07-20 11:40:29Z]: Add-in loaded: MonoDevelop.FSharpBinding
INFO [2017-07-20 11:40:29Z]: Add-in loaded: MonoDevelop.VBBinding
INFO [2017-07-20 11:40:30Z]: Add-in loaded: MonoDevelop.VersionControl
INFO [2017-07-20 11:40:30Z]: Add-in loaded: MonoDevelop.Packaging
   Loading Workbench
INFO [2017-07-20 11:40:30Z]: Add-in loaded: Xamarin.TestCloud.NUnit
INFO [2017-07-20 11:40:30Z]: Add-in loaded: MonoDevelop.WebReferences
INFO [2017-07-20 11:40:30Z]: Add-in loaded: MonoDevelop.ConnectedServices
INFO [2017-07-20 11:40:30Z]: Add-in loaded: MonoDevelop.DocFood
INFO [2017-07-20 11:40:30Z]: Add-in loaded: MonoDevelop.AssemblyBrowser
INFO [2017-07-20 11:40:30Z]: Add-in loaded: MonoDevelop.VersionControl.Git
INFO [2017-07-20 11:40:30Z]: ANDROID: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found:
    Path contains adb in \platform-tools (C:\Program Files (x86)\Android\android-sdk).
INFO [2017-07-20 11:40:30Z]: ANDROID: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found:
    Path contains ndk-stack in \. (C:\android-ndk-r15b).
INFO [2017-07-20 11:40:30Z]: ANDROID: sdk:   Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory found:
    Path contains jarsigner.exe in \bin (C:\Program Files (x86)\Java\jdk1.8.0_131).
INFO [2017-07-20 11:40:30Z]: ANDROID: Did not find Xamarin.Android
INFO [2017-07-20 11:40:30Z]: ANDROID: Found Android SDK. API levels: (none)
INFO [2017-07-20 11:40:30Z]: Xamarin.Android SDK not found, disabling Xamarin.Android addin
      Initializing Main Window
INFO [2017-07-20 11:40:30Z]: Creating DefaultWorkbench
INFO [2017-07-20 11:40:32Z]: Updating Welcome Page from 'https://software.xamarin.com/Service/News'.
INFO [2017-07-20 11:40:32Z]: Updating Prebuilt Apps from 'https://xamarin.com/PrebuiltApps.xml'.
INFO [2017-07-20 11:40:33Z]: Add-in loaded: MonoDevelop.VersionControl.Subversion
INFO [2017-07-20 11:40:33Z]: Add-in loaded: MonoDevelop.VersionControl.Subversion.Windows
INFO [2017-07-20 11:40:33Z]: Add-in loaded: MonoDevelop.Xamarin.Ide.Windows
INFO [2017-07-20 11:40:34Z]: Add-in loaded: MonoDevelop.UnitTesting.NUnit
node `classlib-gecko' is not defined on the documentation map
INFO [2017-07-20 11:40:34Z]: Prebuilt Apps image already up-to-date.
INFO [2017-07-20 11:40:34Z]: Prebuilt Apps image already up-to-date.
INFO [2017-07-20 11:40:34Z]: Prebuilt Apps image already up-to-date.
INFO [2017-07-20 11:40:34Z]: Prebuilt Apps image already up-to-date.
INFO [2017-07-20 11:40:34Z]: Welcome Page updated.
ERROR [2017-07-20 11:40:34Z]: An unhandled exception has occured. Terminating Xamarin Studio? False
System.TimeoutException: The operation has timed out.
   at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)
   at Microsoft.ServiceHub.Utility.NamedPipeClientStreamExtensions.<>c__DisplayClass2_0.<ConnectWithRetryAsync>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.ServiceHub.Utility.NamedPipeClientStreamExtensions.<ConnectWithRetryAsync>d__2.MoveNext()
node `classlib-taglib-sharp' is not defined on the documentation map
node `classlib-webkit' is not defined on the documentation map
INFO [2017-07-20 11:40:35Z]: Prebuilt Apps image already up-to-date.
INFO [2017-07-20 11:40:35Z]: Prebuilt Apps already up-to-date.
INFO [2017-07-20 11:40:35Z]: Prebuilt Apps updated.
INFO [2017-07-20 11:40:37Z]: Fetching vsid...
INFO [2017-07-20 11:40:37Z]: Refreshing entitlements...
INFO [2017-07-20 11:40:37Z]: Fetching entitlements...
INFO [2017-07-20 11:40:37Z]: Fetching auth token.
ERROR [2017-07-20 11:40:38Z]: Error fetching token
System.ArgumentException: The account is not supported by this provider. The configuration does not match.
   at Microsoft.Developer.IdentityService.Utilities.VerifyConfiguration(IAadConfiguration accountConfiguration, IAadConfiguration expectedConfiguration)
   at Microsoft.Developer.IdentityService.AccountProvider.AadAccountProviderClient.VerifyAccount(Account account)
   at Microsoft.Developer.IdentityService.AccountProvider.AadAccountProviderClient.<AcquireTokenAsync>d__40.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Xamarin.Ide.Identity.MicrosoftIdentity.<GetTokenAsync>d__26.MoveNext()
ERROR [2017-07-20 11:40:38Z]: Error fetching rights
System.ArgumentException: The account is not supported by this provider. The configuration does not match.
   at Microsoft.Developer.IdentityService.Utilities.VerifyConfiguration(IAadConfiguration accountConfiguration, IAadConfiguration expectedConfiguration)
   at Microsoft.Developer.IdentityService.AccountProvider.AadAccountProviderClient.VerifyAccount(Account account)
   at Microsoft.Developer.IdentityService.AccountProvider.AadAccountProviderClient.<AcquireTokenAsync>d__40.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Xamarin.Ide.Identity.MicrosoftIdentity.<GetTokenAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.Ide.Identity.MicrosoftIdentity.<GetTokenAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.Ide.Identity.VisualStudioOnlineLicensing.<FetchAndCacheEntitlementsAsync>d__5.MoveNext()
INFO [2017-07-20 11:41:01Z]: Add-in loaded: MonoDevelop.ILAsmBinding

Anything else I can do?

A: Solved the checkbox part by downloading Xamarin.Android standalone from my Xamarin subscription (downloads).
Although I have some other issues to fix (some things that have to do with the emulator) I can create Android projects now.
Uninstalling, re-installing VS 2017 and it's components did not solve the issue.


text:
Q: WheelCollider messing with CentreOfMass of Vehicle i started using unity 5 and i getting a problem. while changing the centre of mass position, wheel Collider also changing the position.

first image shows the centre of mass at 0, 0, 0;

second is centre of mass at 0, 0, 1.53f
in unity 4 i never face this type of problem

A: Could it be because CentreOfMass is a child of CarWheels? Try moving CentreOfMass so it is not a child and see if that fixes the issue :)


text:
Q: Good whitelist for search terms I'm implementing a simple search on a website, and right now I'm working on sanitizing the input. My plan is to make a whitelist of allowed characters. I'm using PHP, and so far I've got the current regex:
preg_replace('/[^a-z0-9 -]/i', '', $s);

So, I'm removing anything that's not alphanumeric or a space or a hyphen.
Is there a generally accepted whitelist for this sort of thing, or does it just depend on the application? I'm going to be searching on book titles, author names and book blurbs.

A: What about 2010 (A space odyssey)? What about Giscard d`Estaing's autobiography? ... This is really impossible to answer generally, it will depend on your application and data structures.
You want to look into the fulltext search functions of the database of your choice, or even specialized search appliances like Sphinx.
Clarify what engine you will use first to actually perform your search, and the rules on what you need to strip out will become much clearer.

A: Google has some pretty advanced rules for searches, but their basic rule is this:

Generally, punctuation is ignored, including @#$%^&*()=+[]\ and other special characters.

However, Google makes exceptions for common search terms, like C++, C#, or $100.
If you want a search as sophisticated as Google's, you can make rules against the above punctuation and have some exceptions. However, for a simple search, just ignore the characters that Google generally ignores.

A: There's not a generic regular expression to solve this problem.  Your code strips out a lot of things you might want to keep, like commas, exclamation points, (semi-)colons, and non-English letters.  If you have a full list of all of the titles in your database, you should be able to write a script that will construct a list of all characters found in all of your titles.  If your regular expression strips out any of those characters, then you risk having problems (although passing this test doesn't mean that you won't run into problems).
Depending on how the rest of your search is implemented, you may be able to strip out valid characters and still return relevant search results.  In this case, you would want your expression to allow non-English characters (since you don't want to split a word) but you might be able to remove all punctuation marks that aren't inside of a quote-delimited phrase.  For example, searching for red haired should give you all of the results you would get from searching for red-haired plus a few extra.


text:
Q: Ajax error callback called when valid JSON is retuned In my js file I'm calling the below:
    $.ajax({
          type: "POST",
          dataType: "application/json",
          url: "php/parseFunctions.php",
          data: {data:queryObj},
          success: function(response) {
             theFunction(response);
          },
          complete:  function(response) {
             theFunction(response);
          },
          error: function(response) {
             theFunction(response); // response = Object {readyState: 4, responseText: "{"found":0}", status: 200, statusText: "OK"

          }
    });

In my php/parseFunctions.php I have:
$returnResults = array();
$returnResults['found']=count($returnResults);
echo  json_encode($returnResults);
exit;

I expect the success callback to get called and for response to be the json object {"found":"0"}
Instead, the error callback gets called and  response = Object {readyState: 4, responseText: "{"found":"0"}", status: 200, statusText: "OK"}
I've read that this will happen if the returned JSON is invalid, but I don't feel like it is.
What am I doing wrong here?

A: I believe the issue is with your dataType attribute. You have set it to "application/json". While this is a value mimeType value, the $.ajax function is expecting one of the following predefined values: xml, json, script, or html as listed in the relevant page of the documentation.
Try having your call to $.ajax look something like this:
$.ajax({
      type: "POST",
      dataType: "json",
      url: "php/parseFunctions.php",
      data: {data:queryObj},
      success:{...},
      complete:{...},
      error:{...}
});


text:
Q: Optimizing location updates storage I receive location updates from drivers and store them in a table having the following attributes and structure :
id int PRIMARY KEY NOT NULL,
driverId int NOT NULL,
updateTime datetime2(2) NOT NULL,
latitude decimal(9,6) NOT NULL,
Longitude decimal(9,6) NOT NULL,
isAvailabe bit NOT NULL,
isBusy bit NOT NULL

Currently the table contains more than 70M rows and keeps growing (500K rows per day). I frequently delete part of the table to free up the disk and make the data processing a bit faster but it is not a wise solution.
Is there any way to optimize the storage of the location updates?

A: I don't follow your question 100%.  But I do get the gist about deleting large numbers of records.
The best solution for that is to partition your table, so different rows are in different partitions.  You can then just drop a partition, which is much faster than deleting the rows.
Read about partitioning in SQL Server here.


text:
Q: Trouble installing Facebook-iOS-SDK 3.1.1 in Rubymotion I'm trying to install the Facebook-iOS-SDK to my RubyMotion project but have hit a few hurdles.
According to section 5 of the Getting Started Instructions I should include the FacebookSDK framework and SQLite3.
I know how to do these in XCode but have no idea when it comes to Rubymotion - can anyone advise?

A: I would recommend including it using CocoaPods via the motion-cocoapods gem.
Add motion-cocoapods to your Rakefile:
require 'motion-cocoapods'

In your app setup, add this:
app.pods do
  dependency 'Facebook-iOS-SDK'
end

Also include the sqlite library thusly:
app.libs += ['/usr/lib/libz.dylib', '/usr/lib/libsqlite3.dylib']

Add this right below your frameworks:
app.weak_frameworks += %w{ AdSupport Accounts Social }

Do a rake clean and then build again and you should have it installed. Oh, and probably gem install motion-cocoapods or drop it into your Gemfile if you're using bundler.

A: A few people were having a problem with this so I wrote a blog post detailing the steps:
How To Use the Facebook iOS SDK In Your RubyMotion project
Thanks again to Jamon Holmgren for pointing me in the right direction!


text:
Q: Add HTML to skadate sidebar Can someone explain how exactly to add some html to the sidebar of a template in Skadate?  It is using smarty templates and I am trying a lot of different ways but have been unsuccessful.

A: It is located in Layout -> Components -> Page_Sidebar -> Default.tpl.  Be sure to also clear the site cache in the admin panel after making changes.  I missed that and that is why none of my changes were showing up.


text:
Q: pass permanent parameter to a jar file I have 3 jars: jar1, jar2 and jar3, in the same path who can change in other pc (ex: c:\prova)
When I run jar1, it moves jar2 in the Windows Sturtup folder.
I want that jar2 simply activate jar3 at every windows startup, but of course it doesn't find jar3 who is remained in the first path.
So I want that jar1 pass a reference (in this case the path c:\prova) to the jar2, when moving it, or at least on the first call to it.
I find it difficoult because:
I can't write the path in a text file in jar2: text files in jars aren't writable.
I can't write the text file in the windows Startup folder: it will be opened at every win startup..
I can't pass the path as a parameter, it will be good for the first call but I can't store this value for the succesive calls.
Sorry for my bad english, thanks for any help!

A: To add the file Path.txt (with jar3's path) in jar2:
Runtime.getRuntime().exec("jar uf jar2.jar Path.txt");

To read the file in jar2 (Startup is my class name):
        String s = "/Path.txt";
        is = Startup.class.getResourceAsStream(s);
        br = new BufferedReader(new InputStreamReader(is));
        while (null != (line = br.readLine())) {
            list.add(line);
        }

Thank me!


text:
Q: JavaScript anonymous function memory allocation and garbage allocation // This is a Framework Method
function ajaxJSONType(uri, reqtype , reqJSON , callback){
    var url : uri;

    $jq.ajax({

    url: uri,
    type: reqtype,
    data:reqJSON ,
    dataType: ResponseDataType.JSON,
    sucess: function(data){
        // do some validation on response data and call the callback function
        callback(data);
    },

    });
}

Every Developer calling this method from their code something like this
First Approach:
function MyMethod(){
       var reqdata = {};
       ajaxJSONType(serviceUri , ReqType.POST,function(responsedata){

                // Here some processing on the response will occur

           });
}

Here the callback method is an anonymous  function used to parse the response and process.
Second Approach :
function MyMethod(){
    var reqdata = {};
    ajaxJSONType(serviceUri , ReqType.POST,myCallbackFun);
}

function  myCallbackFun(responsedata){

     // Here some processing on the response will occur

}

My Question :
IF the MyMethod will be called more than 1000 Times in a short time period ..
Will it good to have the anonymous function or named function ?

The First approch will create function object 1000 times ?

 I saw in JSLINT , we should not create anonymous function inside a loop.
  here though we dont have any loop the MyMethod will be called many times by other events. So it is also like a Loop.

I am using the IE 9 browser.

A:
I saw in JSLINT , we should not create anonymous function inside a loop.

The reason for the warning in JSLint is the potential misunderstanding of the closure created by the function within the loop. It's not related to performance.

Will it good to have the anonymous function or named function ?

As you've mentioned, by passing a function expression directly into the call the engine is having to create a new copy of that function every time you call MyMethod. For that reason, it is likely preferable in this case to go with the function declaration. However, don't get caught up in premature optimisations... you're unlikely to notice any real performance increase.


text:
Q: meteor collection could not get from the server to client I have been reading the meteor doc and but currently i am facing the below issue.
code block 1
Router.map(function() {
     this.route('quizzes', {
         path: '/quizzes',
         waitOn: function() {
             return Meteor.subscribe('quizzes');
         }
     });
 })

I can see the above collection from template simply by using Meteor.quizzes.find()
Code Block 2
server side code is
// Declare server Movies collection
Movies = new Meteor.Collection("movies");

// Seed the movie database with a few movies
Meteor.startup(function () {
    if (Movies.find().count() == 0) {
        Movies.insert({ title: "Star Wars", director: "Lucas" });
        Movies.insert({ title: "Memento", director: "Nolan" });
        Movies.insert({ title: "King Kong", director: "Jackson" });
    }

console.log(Meteor.movies.find().count()) //retunr 3 records
Meteor.publish('movies', function(){
        return Movies.find({});
    })

routes code as follows
 Router.map(function() {
      //Admin routes
      this.route('userManagement', {
        path: '/user-management',
        waitOn: function() {
          return Meteor.subscribe('users');
        }
      });
    });

when I use the users in the above block of code, It working fine.
but when i use movies/quizzes on same route map .

  Router.map(function() {
      //Admin routes
      this.route('moviesManagement', {
        path: '/movies-management',
        waitOn: function() {
          return Meteor.subscribe('movies');
        }
      });
    });

But when i try to access Meteor.movies.find() nothing is coming and I think subscribe method also not returning anyhting.
I have spent a lot of time to fix but I could not find the soltioon . Please help me on this.

A: You need to subscribe to your movies publication, either by using Iron Router's waitOn or subscriptions options, or by calling the subscription yourself. Notice that in the quizzes code you are waiting on the quiz subscription before running the route.
Calling the subscription manually:
// on client
Meteor.subscribe('movies', function() {
  console.log(Movies.find().count()); // 3
});

Using Iron Router to handle your subscription:
// on client
Router.route('/movies', {
  waitOn: function() { return Meteor.subscribe('movies'); }
});

By the way, you're using the old, legacy Iron Router API. I recommend looking at the official Iron Router guide.


text:
Q: Docker error: Cannot create container for service web: invalid mode I'm having three errors when i run docker:

ERROR: for learningphp7_web_1  Cannot create container for service web: invalid mode: /etc/apache2/sites-enabled/virtualhosts.conf
ERROR: for web  Cannot create container for service web: invalid mode: /etc/apache2/sites-enabled/virtualhosts.conf
ERROR: Encountered errors while bringing up the project.

How can i solve these issues and finally start using docker?
My virtualhosts.conf:
<VirtualHost *:80>
  ServerName localhost
  DocumentRoot /var/www/html/web
  DirectoryIndex index.php

  <Directory /var/www/html/web>
    AllowOverride None
    Require all granted
    Allow from All
    Options FollowSymLinks
    <IfModule mod_rewrite.c>
          Options -MultiViews
          RewriteEngine On
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteRule ^(.*)$ index.php [QSA,L]
    </IfModule>
  </Directory>
</VirtualHost>

A: Check your docker-compose.yml file. I recently had the same error, due to an extra space in the volume config:
  volumes:
  - ./www:/home/distressedpro/public_html
   - ./conf:/etc/apache2/sites-available

Note the extra space on the last line, that was causing the error. Correcting it to:
  volumes:
  - ./www:/home/distressedpro/public_html
  - ./conf:/etc/apache2/sites-available

fixed it


text:
Q: StrtoInt64Def convert error in delphi I am having small program having ConvertFunction which converts the string data to other formats. The return type of function is Variant. When i use StrToIntDef to convert integer value then it does without any error.
But now my number is very large so I want to use int64 instead of integer. When i use StrToInt64def function to convert its giving me error, Incompatiable types:Variant and int64.
Below are the both codes. Any idea whats wrong in this?
Working:
function Convertfunction(sTest:String):Variant;
begin
  result:= StrtoIntDef(sTest,0);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  sString: string;
  value:variant;
begin
  sString:= '123456';
  value:= Convertfunction(sString);
  showMessage(value);
end;

Not Working:
function Convertfunction(sTest:String):Variant;
begin
  result:= StrtoInt64Def(sTest,0);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  sString: string;
  value:variant;
begin
  sString:= '12345678901';
  value:= Convertfunction(sString);
  showMessage(value);
end;

A: Delphi 5 doesn't seem to have stock converter between int64 and variant. If you need it in your app you can

*

*implement it (see manual on "custom variant types")

*switch to more recent Delphi

*switch to CodeTyphon or other Lazarus/FPC distro


text:
Q: Is there an equivalent to iOS's Keychain for user credentials on Android? Is there an equivalent to iOS's Keychain on Android?
My understanding of the Preferences API is that it is not encrypted. For my application it doesn't matter whether these credentials are persisted across devices (i.e. a different use-case to iPhone-like Keychain in Android?)
I also looked at the KeyStore API but it seems to leave the actual storage of user credentials up to the application developer.

A: Actually there is:

By integrating Smart Lock for Passwords into your Android app, you can
  automatically sign users in to your app using the credentials they
  have saved. Users can save both username-password credentials and
  federated identity provider credentials.
Integrate Smart Lock for Passwords into your app by using the
  Credentials API to retrieve saved credentials on sign-in. Use
  successfully retrieved credentials to sign the user in, or use the
  Credentials API to rapidly on-board new users by partially completing
  your app's sign in or sign up form. Prompt users after sign-in or
  sign-up to store their credentials for future automatic
  authentication.

https://developers.google.com/identity/smartlock-passwords/android/

A: Expanding upon @DJPlayer's answer:
Some relevant articles. The third includes a github app that demonstrates using the keystore provider to generate keys and then encrypt strings.

*

*Android Keystore System

*Where is the best place to store a password in your Android app?

*How to use the Android Keystore to store passwords and other sensitive information
Also see Android Storage Options for ways to store the encrypted password - my recommendation is Shared Preferences.
Note that according to the second article with root access and a bit of knowledge of how your app uses the keystore (which might be obtainable from decompiling your apk), it's possible to hijack the private key and use it to decrypt encrypted material (ex: the persisted password)

A: Short answer, there isn't one. But you can expect the filesystem to be secure.
Each app operates under a different user, and the filesystem used to store app data is secured by normal UNIX user permissions. So each app's file access is sandboxed by default. The filesystem also may be encrypted.
This page from the developer's site explains it better: http://developer.android.com/guide/topics/security/security.html

A: http://developer.android.com/reference/android/security/KeyChain.html
Keychain for OS 4.0


text:
Q: Has many relation design I have products that have more than one size. Is the next design good?

*

*Product(#product_id, product_name)

*Size(#size_id, #product_id, size)
By '#' I denote a key, either foreign or primary.

A: You've not clearly designated which column combinations are primary key and which are foreign key constraints and which are uniquely constrained in the Size table.

*

*Product_id is fairly obviously a foreign key referencing Product.  It presents no problem.

*Size_id is probably an auto-incrementing identifier, and is meant to be 'the primary key' for Size.  It seems like overkill to me, but isn't actually wrong.

*The undocumented combination of Product_ID and Size needs a unique constraint on it to ensure you don't end up with two rows like this:
Size_ID   Product_ID    Size
 1234      23456        12
 1235      23456        12

That says the same thing twice — the product with ID 23456 comes in size 12.  And saying the same thing twice is repetitious and is apt to lead to incorrect answers (how many sizes does product 23456 come in — the answer is harder to calculate if you have to write COUNT(DISTINCT Size) instead of just COUNT(*), and not because of the typing but because the DBMS has to do more work, and because someone will forget sometime and produce the wrong query and it won't be spotted as a problem until the post-mortem examination of why something went dramatically wrong.
You could perfectly well do without the Size_ID, using the combination of Product_ID and Size as the primary key.  Failing that, you need a unique constraint on Product_ID and Size.


text:
Q: Multiple asynchronous calls to populate an object I'm developing a Flex application and am having some trouble working with asynchronous calls. This is what I would like to be able do:
[Bindable] var fooTypes : ArrayCollection();

for each (var fooType : FooType in getFooTypes()) {
    fooType.fooCount = getFooCountForType(fooType);
    itemTypes.addItem(fooType);
}

The issue I'm running into is that both getFooTypes and getFooCountForType are asynchronous calls to a web service. I understand how to populate fooTypes by setting a Responder and using ResultEvent, but how can I call another service using the result? Are there any suggestions/patterns/frameworks for handling this?

A: If possible, I Strongly recommed re-working your remote services to return all the data you need in one swoop.
But, if you do not feel that is possible or practical for whatever reason, I would recommend doing some type of remote call chaining.
Add all the "remote calls" you want to make in array.  Call the first one.  In the result handler process the results and then pop the next one and call it.
I'm a bit unclear from your code sample when you are calling the remote call, but I assume it part of the getFooCountForType method.  Conceptually I would do something like this.  Define the array of calls to make:
public var callsToMake : Array = new Array();

cache the currently in process fooType:
public var fooType : FooType;

Do your loop and store the results:
for each (var fooType : FooType in getFooTypes()) {
    callsToMake.push(fooType);
    // based on your code sample I'm unclear if adding the fooTypes to itemTypes is best done here or in the result handler
    itemTypes.addItem(fooType);
}

Then call the remote handler and save the foo you're processing:
fooType = callsToMake.pop();
getFooCountForType(fooTypeToProcess);

In the result handler do something like this:
// process results, possibly by setting
fooType.fooCount = results.someResult;

and call the remote method again:
fooType = callsToMake.pop();
getFooCountForType(fooTypeToProcess);


text:
Q: are C++ static variables always destructed on main thread? Short question:
Are C++11 static (non thread_local) variables always destructed on main thread?
Are they always destroyed on program exit only (considering we do not call manually their destructors)?
UPDATE
For brevity, lets assume that destructors ARE called. (we did not pull the plug, we did not kill -9)

A: Destructors of the global objects are called by std::exit. That function is called by the C++ run-time when main returns.
It is possible to arrange for std::exit to be called by a thread other than that which entered main. E.g.:
struct A
{
    A() { std::cout << std::this_thread::get_id() << '\n'; }
    ~A() { std::cout << std::this_thread::get_id() << '\n'; }
};

A a;

int main() {
    std::thread([]() { std::exit(0); }).join();
}

Outputs:
140599080433472
140599061243648

Showing that one thread called the constructor and another the destructor.
See std::exit and std::atexit for more details.