text:
Q: Ant 1.9.4 won't clean and build Netbeans 8.0.2 project using Java 8; gives null pointer exception My code has no errors. If I choose F6 (Run) it executes fine. If I Clean it, there are no errors. But if I clean and build, I get these errors because of bug(s) in Netbeans 8.0.2 and/or Ant 1.9.4. The completely unacceptable workaround is to create a new project and copy all the files into it. This works for awhile. Then I have to do it again.
EDIT
I use tika-app-1.9.jar as library file. It is 45MB. If I remove it and instead use tika-parsers-1.10.jar and tika-core-1.10.jar as library files, I don't get this error BUT my program then can't properly process .PDF files. And with the huge library, the program has compiled successfully dozens of times and run as standalone (i.e., outside Netbeans) many more times.
END OF EDIT
EDIT 2
OK. I deleted replaced the two smaller library files with tika-app-1.10.jar and clean and build WORKED.
ONCE.
END EDIT
Please offer some insight into why it's happening and how to fix and prevent it or otherwise debug it. I have over 3000 lines of debug output but the bottom line, whether debug is selected or not is always these:
C:\Users\Dov\Google Drive\NetBeansProjects\Find\nbproject\build-impl.xml:994: The following error occurred while executing this line:
C:\Users\Dov\Google Drive\NetBeansProjects\Find\nbproject\build-impl.xml:838:
java.lang.NullPointerException
    at org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java:439)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:559)

Here's my project:

I haven't messed with build.xml or any other generated files.
I've restarted Netbeans 8.0.2 and looked for instances of JVM that might be running. There aren't.
Here's the Ant screen:

Here's more of the stack trace:
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:519)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:480)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:443)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:409)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:384)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:322)
    at org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs.execute(CopyLibs.java:206)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 4 seconds)

Please note these lines that FOLLOW the BUILD FAILED line:
Could not load class (org.apache.tools.ant.taskdefs.repository.MavenRepository) for type mavenrepository
Could not load a dependent class (jdepend/xmlui/JDepend) for type jdepend
Could not load a dependent class (javax/media/jai/PlanarImage) for type image
Could not load class (org.apache.tools.ant.taskdefs.repository.MavenRepository) for type mavenrepository
Could not load a dependent class (jdepend/xmlui/JDepend) for type jdepend
Could not load a dependent class (javax/media/jai/PlanarImage) for type image

A: Checking the related ResourceUtils, it seems the exception is occurring in a copy task (probably the one copying your library Jar file), specifically when trying to log an error before falling back to another copy mechanism.
Meanwhile checking Ant 1.9.5, it seems the problem was fixed, and the release notes mention this in Bug 57533 (NullPointerException FileUtil.rename / ResourceUtils.copyFile() if copyUsingFileChannels failed).
Therefore, I would try to upgrade to Ant 1.9.5 to see if the problem is resolved.

A: I downloaded Ant 1.9.6 and made Netbeans use it as shown in the screen shot.
No problem with the error and huge library .jar after 3 quick clean and builds.

Then: a different error:
Attempt to copy C:\Users\Dov\Downloads\tika-app-1.10.jar to C:\Users\Dov\Google Drive\NetBeansProjects\Find\dist\lib\tika-app-1.10.jar using NIO Channels failed due to 'C:\Users\Dov\Google Drive\NetBeansProjects\Find\dist\lib\tika-app-1.10.jar (Access is denied)'.  Falling back to streams.
C:\Users\Dov\Google Drive\NetBeansProjects\Find\nbproject\build-impl.xml:994: The following error occurred while executing this line:
C:\Users\Dov\Google Drive\NetBeansProjects\Find\nbproject\build-impl.xml:838:
java.io.FileNotFoundException: C:\Users\Dov\Google Drive\NetBeansProjects\Find\dist\lib\tika-app-1.10.jar (Access is denied)
    at java.io.FileOutputStream.open0(Native Method)

EDIT
The project folder, the dist folder, the lib folder, and the .jar library file all had red Xs on them. Only way to proceed: shut down Windows and then the .jar file goes away; clean and build works again--but for how long. Period.
Pretty inconvenient to not be able to delete the .jar file other than shutdown.
Hope the bug gets fixed soon.


text:
Q: Unity 5, Bundle scene without dependencies In Unity 5.6, when calling
public static AssetBundleManifest BuildAssetBundles(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform);

where a scene is in one of the builds, all dependencies/references in that scene will automatically be included.
I have a situation where a scene can reference some assets that are exclusive to that scene, and some assets that are shared with other scenes. I would like the shared assets to be built in one asset bundle, and the scene and its' exclusive assets in another asset bundle. My wish is for the shared assets to be placed in one folder, and each scene and its' exclusive assets to be placed in one folder each, and build one asset bundle per folder.

*

*Is it possible to not include the references/dependencies in a scene
when building an asset bundle containing it?

*Is it possible to specify a folder in which to include all assets in the asset bundle (rather than having a scene define it, or marking them specifically as part of an asset bundle in the inspector)?

A: Based on my reading of Asset Bundle management

Dependent Assets will be added to the AssetBundle automatically along with the selected Asset if that dependent Asset has not been assigned to any AssetBundle when the AssetBundles are built.

So all you have to do is package those shared assets first then package the scenes.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Php/MySQL Adding time from a form to current date then inserting into DB I've been looking everywhere for information on how to add an amount of time (months) specified in a form on a Php website to current date, and then adding this date into MySQL database Date (for ex. 2014-03-03) field (if using Date is even possible here).
Could You tell me what should I use to take the current date without time, add a custom amount of months to it (using strtotime I assume, but it uses syntax like +1 days, where I have a variable from a form), and then input it into database field type "Date"? I could change the DB field type to Datetime or Timestamp if needed.

A: You can use mktime for this:
<?php

print date("Y-m-d", mktime(0, 0, 0, date("m") + 6, date("d"), date("Y")));

Here, I have added 6 months to the date.

A: following this logic it should be pretty easy to save your date in mysql. =)
   strtotime is a great function because its always very  easy to understand what's going on at a glance.
$days = $_POST['days'];  // data from your form

$currentTime = strtotime('today');  // you can also use time() or put in your own date
$nextDay = strtotime('+'.$days.' days', $currentTime);  // add number of days from form
$nextDay = date('Y-m-d H:i:s', $currentTime);  // format the time from unix timestamp into mysql format


text:
Q: Netbeans php поддержка коротких тегов? Подскажите, как сделать, чтобы netbeans нормально определял и подсвечивал php-код в коротких тегах:
<?
print('hhh');
?>

A: Свойства проекта -> Исходные файлы -> Поставить чек на "Разрешить краткие теги (<?)"


text:
Q: best way to find top-level directory for path in bash I need a command that will return the top level base directory for a specified path in bash.
I have an approach that works, but seems ugly:
echo "/go/src/github.myco.com/viper-ace/psn-router" | cut -d "/" -f 2 | xargs printf "/%s"

It seems there is a better way, however all the alternatives I've seen seem worse.
Thanks for any suggestions!

A: One option is using awk:
echo "/go/src/github.myco.com/viper-ace/psn-router" |
awk -F/ '{print FS $2}'

/go

A: As a native-bash approach forking no subshells and invoking no other programs (thus, written to minimize overhead), which works correctly in corner cases including directories with newlines:
topdir() {
    local re='^(/+[^/]+)'
    [[ $1 =~ $re ]] && printf '%s\n' "${BASH_REMATCH[1]}"
}

Like most other solutions here, invocation will then look something like outvar=$(topdir "$path").

To minimize overhead even further, you could pass in the destination variable name rather than capturing stdout:
topdir() {
    local re='^(/+[^/]+)'
    [[ $1 =~ $re ]] && printf -v "$2" '%s' "${BASH_REMATCH[1]}"
}

...used as: topdir "$path" outvar, after which "$outvar" will expand to the result.

A: not sure better but with sed
$ echo "/go/src/github.myco.com/viper-ace/psn-router" | sed -E 's_(/[^/]+).*_\1_'
/go

A: Here's a sed possibility. Still ugly. Handles things like ////////home/path/to/dir. Still blows up on newlines.
$ echo "////home/path/to/dir" | sed 's!/*\([^/]*\).*!\1!g'
/home

Newlines breaking it:
$ cd 'testing '$'\n''this'
$ pwd
/home/path/testing
this
$ pwd | sed 's!/*\([^/]*\).*!/\1!g'
/home
/this

If you know your directories will be rather normally named, your and anubhava's solutions certainly seem to be more readable.

A: This is bash, sed and tr in a function :
#!/bin/bash

function topdir(){
  dir=$( echo "$1" | tr '\n' '_' )
  echo "$dir" | sed -e 's#^\(/[^/]*\)\(.*\)$#\1#g'
}

topdir '/go/src/github.com/somedude/someapp'

topdir '/home/somedude'

topdir '/with spaces/more here/app.js'

topdir '/with newline'$'\n''before/somedir/somefile.txt'

Regards!


text:
Q: JavaFX silently swallowing exception raised in drag listeners It appears that exceptions are silently swallowed in drag over listeners in JavaFX. I've searched and can't find any mention of this in the documentation.
I've recreated this below...
Is there anyway to prevent this and expose the exceptions?
public class App extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        Button source = new Button("source");
        Button destination = new Button("destination");
        HBox box = new HBox(source, destination);

        source.setOnDragDetected(event -> {
            Dragboard db = source.startDragAndDrop(TransferMode.ANY);
            ClipboardContent content = new ClipboardContent();
            content.putString("foo");
            db.setContent(content);
            event.consume();
        });
        destination.setOnDragOver(new EventHandler<DragEvent>() {
            public void handle(DragEvent event) {
                event.acceptTransferModes(TransferMode.LINK);
                String nullReference = null;
                nullReference.toCharArray(); // cause an exception
                event.consume();
            }
        });
        primaryStage.setScene(new Scene(box));
        primaryStage.show();
    }

}

Following feedback from James_D and further investigation, we have found this varies by platform

*

*Ubuntu Linux. 1.8.0_40 => exceptions seen

*Mac OS X. 1.8.0_40 => exceptions seen

*Windows 7. 1.8.0_40 => No exceptions

*Windows 7. 1.8.0_121 => No exceptions (latest JDK at time of writing)

A: It appears that native method WinDnDClipboard.push(Object[], int) - backed by GlassClipboard.cpp swallows the exception silently. A call back to Throwable.getMessage() can be seen in the debugger but no exception is printed to the console.
The Java 9 version of this file (http://hg.openjdk.java.net/openjfx/9-dev/rt/file/1a3f128518cd/modules/javafx.graphics/src/main/native-glass/win/GlassClipboard.cpp) has an additional call to CheckAndClearException(env); as defined in Utils.cpp, however this is against RT-35400 which appears unrelated. This has not been backported to Java 8.


text:
Q: No BLAS/LAPACK libraries found when installing SciPy I am using python 3.9.8 and pycharm on a macbook m1.
I have already installed openblas with homebrew but I still get the error below.
I tried installing SciPy via homebrew, but it didn't work properly.
My pip is up to date.
I installed Numpy, Pandas etc. Everything works fine except SciPy and I can't figure out why.
(venv) wes@Air-van-Wes pythonProject % pip install scipy
Collecting scipy
  Using cached scipy-1.7.2.tar.gz (36.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/wes/PycharmProjects/pythonProject/venv/bin/python /Users/wes/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/bl/2xjy80bj6y57yb5z0frfypk00000gn/T/tmpgb5a46oi
       cwd: /private/var/folders/bl/2xjy80bj6y57yb5z0frfypk00000gn/T/pip-install-19slhbw2/scipy_f4bfaae68a1e4c2db88f86a394b879ca
  Complete output (175 lines):
  setup.py:491: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /private/var/folders/bl/2xjy80bj6y57yb5z0frfypk00000gn/T/pip-modern-metadata-6yn5g0q3'), proceeding with generating Cython sources and expanding templates
    warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
  Running from SciPy source directory.
  Running scipy/linalg/_generate_pyx.py
  Running scipy/special/_generate_pyx.py
  Running scipy/stats/_generate_pyx.py
  Processing scipy/cluster/_vq.pyx
  Processing scipy/cluster/_optimal_leaf_ordering.pyx
  Processing scipy/cluster/_hierarchy.pyx
  Processing scipy/ndimage/src/_cytest.pyx
  Processing scipy/ndimage/src/_ni_label.pyx
  Processing scipy/linalg/cython_lapack.pyx
  Processing scipy/linalg/_matfuncs_sqrtm_triu.pyx
  Processing scipy/linalg/_solve_toeplitz.pyx
  Processing scipy/linalg/cython_blas.pyx
  Processing scipy/linalg/_decomp_update.pyx.in
  Processing scipy/optimize/_group_columns.pyx
  Processing scipy/optimize/_bglu_dense.pyx
  Processing scipy/optimize/_trlib/_trlib.pyx
  Processing scipy/optimize/_highs/cython/src/_highs_constants.pyx
  Processing scipy/optimize/_highs/cython/src/_highs_wrapper.pyx
  Processing scipy/optimize/_lsq/givens_elimination.pyx
  Processing scipy/optimize/cython_optimize/_zeros.pyx.in
  Processing scipy/io/matlab/mio_utils.pyx
  Processing scipy/io/matlab/streams.pyx
  Processing scipy/io/matlab/mio5_utils.pyx
  Processing scipy/_lib/_ccallback_c.pyx
  Processing scipy/_lib/_test_deprecation_def.pyx
  Processing scipy/_lib/_test_deprecation_call.pyx
  Processing scipy/_lib/messagestream.pyx
  Processing scipy/special/_ufuncs_cxx.pyx
  Processing scipy/special/cython_special.pyx
  Processing scipy/special/_ellip_harm_2.pyx
  Processing scipy/special/_comb.pyx
  Processing scipy/special/_test_round.pyx
  Processing scipy/special/_ufuncs.pyx
  Processing scipy/fftpack/convolve.pyx
  Processing scipy/interpolate/interpnd.pyx
  Processing scipy/interpolate/_bspl.pyx
  Processing scipy/interpolate/_ppoly.pyx
  Processing scipy/sparse/_csparsetools.pyx.in
  Processing scipy/sparse/csgraph/_shortest_path.pyx
  Processing scipy/sparse/csgraph/_traversal.pyx
  Processing scipy/sparse/csgraph/_flow.pyx
  Processing scipy/sparse/csgraph/_tools.pyx
  warning: _cython_special_custom.pxi:9:8: Unreachable code
  warning: _cython_special_custom.pxi:13:4: Unreachable code
  warning: _cython_special_custom.pxi:21:8: Unreachable code
  warning: _cython_special_custom.pxi:25:4: Unreachable code
  warning: _cython_special_custom.pxi:33:8: Unreachable code
  warning: _cython_special_custom.pxi:37:4: Unreachable code
  warning: _cython_special_custom.pxi:45:8: Unreachable code
  warning: _cython_special_custom.pxi:49:4: Unreachable code
  Processing scipy/sparse/csgraph/_matching.pyx
  Processing scipy/sparse/csgraph/_reordering.pyx
  Processing scipy/sparse/csgraph/_min_spanning_tree.pyx
  Processing scipy/spatial/ckdtree.pyx
  Processing scipy/spatial/_voronoi.pyx
  Processing scipy/spatial/_hausdorff.pyx
  Processing scipy/spatial/qhull.pyx
  Processing scipy/spatial/transform/rotation.pyx
  Processing scipy/signal/_max_len_seq_inner.pyx
  Processing scipy/signal/_peak_finding_utils.pyx
  Processing scipy/signal/_upfirdn_apply.pyx
  Processing scipy/signal/_spectral.pyx
  Processing scipy/signal/_sosfilt.pyx
  Processing scipy/stats/_stats.pyx
  Processing scipy/stats/_qmc_cy.pyx
  Processing scipy/stats/_sobol.pyx
  Processing scipy/stats/biasedurn.pyx
  Processing scipy/stats/_boost/src/beta_ufunc.pyx
  Processing scipy/stats/_boost/src/nbinom_ufunc.pyx
  Processing scipy/stats/_boost/src/binom_ufunc.pyx
  Cythonizing sources
  lapack_opt_info:
  lapack_mkl_info:
  customize UnixCCompiler
    libraries mkl_rt not found in ['/Users/wes/PycharmProjects/pythonProject/venv/lib', '/usr/lib']
    NOT AVAILABLE

  openblas_lapack_info:
    libraries openblas not found in ['/Users/wes/PycharmProjects/pythonProject/venv/lib', '/usr/lib']
    NOT AVAILABLE

  openblas_clapack_info:
    libraries openblas,lapack not found in ['/Users/wes/PycharmProjects/pythonProject/venv/lib', '/usr/lib']
    NOT AVAILABLE

  flame_info:
    libraries flame not found in ['/Users/wes/PycharmProjects/pythonProject/venv/lib', '/usr/lib']
    NOT AVAILABLE

  accelerate_info:
    NOT AVAILABLE

  atlas_3_10_threads_info:
  Setting PTATLAS=ATLAS
    libraries lapack_atlas not found in /Users/wes/PycharmProjects/pythonProject/venv/lib
    libraries tatlas,tatlas not found in /Users/wes/PycharmProjects/pythonProject/venv/lib
    libraries lapack_atlas not found in /usr/lib
    libraries tatlas,tatlas not found in /usr/lib
  <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
    NOT AVAILABLE

  atlas_3_10_info:
    libraries lapack_atlas not found in /Users/wes/PycharmProjects/pythonProject/venv/lib
    libraries satlas,satlas not found in /Users/wes/PycharmProjects/pythonProject/venv/lib
    libraries lapack_atlas not found in /usr/lib
    libraries satlas,satlas not found in /usr/lib
  <class 'numpy.distutils.system_info.atlas_3_10_info'>
    NOT AVAILABLE

  atlas_threads_info:
  Setting PTATLAS=ATLAS
    libraries lapack_atlas not found in /Users/wes/PycharmProjects/pythonProject/venv/lib
    libraries ptf77blas,ptcblas,atlas not found in /Users/wes/PycharmProjects/pythonProject/venv/lib
    libraries lapack_atlas not found in /usr/lib
    libraries ptf77blas,ptcblas,atlas not found in /usr/lib
  <class 'numpy.distutils.system_info.atlas_threads_info'>
    NOT AVAILABLE

  atlas_info:
    libraries lapack_atlas not found in /Users/wes/PycharmProjects/pythonProject/venv/lib
    libraries f77blas,cblas,atlas not found in /Users/wes/PycharmProjects/pythonProject/venv/lib
    libraries lapack_atlas not found in /usr/lib
    libraries f77blas,cblas,atlas not found in /usr/lib
  <class 'numpy.distutils.system_info.atlas_info'>
    NOT AVAILABLE

  lapack_info:
    libraries lapack not found in ['/Users/wes/PycharmProjects/pythonProject/venv/lib', '/usr/lib']
    NOT AVAILABLE

  /private/var/folders/bl/2xjy80bj6y57yb5z0frfypk00000gn/T/pip-build-env-4znp06oe/overlay/lib/python3.9/site-packages/numpy/distutils/system_info.py:1858: UserWarning:
      Lapack (http://www.netlib.org/lapack/) libraries not found.
      Directories to search for the libraries can be specified in the
      numpy/distutils/site.cfg file (section [lapack]) or by setting
      the LAPACK environment variable.
    return getattr(self, '_calc_info_{}'.format(name))()
  lapack_src_info:
    NOT AVAILABLE

  /private/var/folders/bl/2xjy80bj6y57yb5z0frfypk00000gn/T/pip-build-env-4znp06oe/overlay/lib/python3.9/site-packages/numpy/distutils/system_info.py:1858: UserWarning:
      Lapack (http://www.netlib.org/lapack/) sources not found.
      Directories to search for the sources can be specified in the
      numpy/distutils/site.cfg file (section [lapack_src]) or by setting
      the LAPACK_SRC environment variable.
    return getattr(self, '_calc_info_{}'.format(name))()
    NOT AVAILABLE

  Traceback (most recent call last):
    File "/Users/wes/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/Users/wes/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/wes/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 164, in prepare_metadata_for_build_wheel
      return hook(metadata_directory, config_settings)
    File "/private/var/folders/bl/2xjy80bj6y57yb5z0frfypk00000gn/T/pip-build-env-4znp06oe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 166, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "/private/var/folders/bl/2xjy80bj6y57yb5z0frfypk00000gn/T/pip-build-env-4znp06oe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 258, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/private/var/folders/bl/2xjy80bj6y57yb5z0frfypk00000gn/T/pip-build-env-4znp06oe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 150, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 631, in <module>
      setup_package()
    File "setup.py", line 627, in setup_package
      setup(**metadata)
    File "/private/var/folders/bl/2xjy80bj6y57yb5z0frfypk00000gn/T/pip-build-env-4znp06oe/overlay/lib/python3.9/site-packages/numpy/distutils/core.py", line 135, in setup
      config = configuration()
    File "setup.py", line 529, in configuration
      raise NotFoundError(msg)
  numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK libraries found. Note: Accelerate is no longer supported.
  To build Scipy from sources, BLAS & LAPACK libraries need to be installed.
  See site.cfg.example in the Scipy source directory and
  https://docs.scipy.org/doc/scipy/reference/building/index.html for details.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/0e/23/58c4f995475a2a97cb5f4a032aedaf881ad87cd976a7180c55118d105a1d/scipy-1.7.2.tar.gz#sha256=fa2dbabaaecdb502641b0b3c00dec05fb475ae48655c66da16c9ed24eda1e711 (from https://pypi.org/simple/scipy/) (requires-python:>=3.7,<3.11). Command errored out with exit status 1: /Users/wes/PycharmProjects/pythonProject/venv/bin/python /Users/wes/PycharmProjects/pythonProject/venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/bl/2xjy80bj6y57yb5z0frfypk00000gn/T/tmpgb5a46oi Check the logs for full command output.

A: For Debian/Ubuntu with a virtualenv (poetry):
sudo apt install libatlas-base-dev
sudo apt install gfortran

Then install skipy to your virtual env and wait a very long time for it to build (eg: 10 minutes!)
poetry add scipy scikit-learn

A: I encountered the same issue, using Homebrew based Python 3.10 installation and installing Poetry based package depending on Scipy.
The error was:
numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK libraries found. Note: Accelerate is no longer supported.

How I fixed this:
# Install lapack and openblas from Homebrew
brew install openblas lapack

# Tell Numpy installer where to find lapack
export LDFLAGS="-L/usr/local/opt/lapack/lib"
export CPPFLAGS="-I/usr/local/opt/lapack/include"
export PKG_CONFIG_PATH="/usr/local/opt/lapack/lib/pkgconfig"

# See https://github.com/scipy/scipy/issues/12935
export CFLAGS=-Wno-error=implicit-function-declaration

# The location may vary - use find command to find this on your local /usr/local/opt
export LAPACK=/usr/local/opt/lapack/lib/liblapack.dylib
export BLAS=/usr/local/opt/openblas/lib/libopenblasp-r0.3.19.dylib

And then attempting to install the packages again with:
# Install deps
poetry install

poetry / pip / etc. installation methods should be interchangeable.
SciPy 1.6.1 installation will take some time, but this time will complete.

*

*Tip about how LAPACK environment variable works
Some of the official documentation (less useful):

*

*The official Scipy installation instructions.

*The official LAPACK installation instructions

A: Mikko Ohtamaa's method didn't work for me.. I could see why, my brew packages happened to be installed somewhere else and some of the libraries were slightly newer.
It's worth being aware of this. You can see where brew puts stuff easily by just doing this after installing openblas:
brew info openblas

So in the end I had to do:
 brew install openblas lapack

 export LDFLAGS="-L/opt/homebrew/opt/lapack/lib"
 export LDFLAGS="-L/opt/homebrew/opt/lapack/include"
 export LDFLAGS="-L/opt/homebrew/opt/lapack/lib"
 export CPPFLAGS="-L/opt/homebrew/opt/lapack/include"
 export PKG_CONFIG_PATH="-L/opt/homebrew/opt/lapack/pkgconfig"
 export CFLAGS=-Wno-error=implicit-function-declaration
 export LAPACK=/opt/homebrew/opt/lapack/lib/liblapack.dylib
 export BLAS=/opt/homebrew/opt/openblas/lib/libopenblasp-r0.3.20.dylib

 poetry install

Still, I'd be nowhere without Mikko's answer. I've tried a couple of other methods that didn't work, so I don't know if that's because I'm on a newer M1 or because brew changed or what..

A: I downloaded conda and now it works just fine.

A: While OpenBLAS is important to install, it appears that we don't need to point to it in compiler flags. This means that the solution doesn't need to change when a different version of OpenBLAS is present:
brew install openblas lapack

export LDFLAGS="-L/opt/homebrew/opt/lapack/lib"
export CPPFLAGS="-I/opt/homebrew/opt/lapack/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/lapack/lib/pkgconfig"
export LAPACK=/opt/homebrew/opt/lapack/lib/liblapack.dylib

poetry add scipy


text:
Q: Texting existing JMS application I am working on existing project which uses JMS and spring. I am new to JMS. I need to test that application. My aim is to test that my classes which are used in the application are executed or not.
So can anybody provide me a way in which I can test the application which uses JMS?
I have searched on Google but everyone get started with a sample application. But I want to test my existing application, meaning how my application gets connected with another module. Is there any tool like SOAPUI for JMS test of my existing application, meaning something from which I can execute my classes or listener.
Edit 1
There is a scenario in my project that my module listen a JMS Queue and send SMS or Email to user but actually I am not getting that how my module connected to other module can anybody give me a way so I can find in that direction means which services or APIs used in there.


text:
Q: getting an error when using SOAP v2 I am trying to use SOAP v2 to work in customer details. I added below code.
$client = new SoapClient('http://localhost/abc/api/v2_soap/?wsdl');

And I got the following warning and fatal error

Warning: Uncaught exception 'Exception' with message 'Warning: SoapClient::SoapClient(http://localhost/abc/api/v2_soap/?wsdl): failed to open stream: HTTP request failed! in C:\xampp\htdocs\abc\test.php on line 64' in C:\xampp\htdocs\abc\app\code\core\Mage\Core\functions.php:245 Stack trace: #0 [internal function]: mageCoreErrorHandler(2, 'SoapClient::Soa...', 'C:\xampp\htdocs...', 64, Array) #1 C:\xampp\htdocs\abc\test.php(64): SoapClient->SoapClient('http://localhos...') #2 {main} thrown in C:\xampp\htdocs\abc\app\code\core\Mage\Core\functions.php on line 245
Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/abc/api/v2_soap/?wsdl' : failed to load external entity "http://localhost/abc/api/v2_soap/?wsdl"

A: Try http://localhost/abc/api/V2_soap?wsdl=1
if still you are facing problem, add your test.php code here.


text:
Q: Xcode 13.3 Build DocC Command CompileDocumentation failed with a nonzero exit code Xcode Build DocC Document with Product-Build Documentation failed
Command CompileDocumentation failed with a nonzero exit code


text:
Q: Are intervals considered local min/max values of a function? If you have a function with an interval.
i.e. $y = 5x$ where $0 \leq  x \leq 5$
Obviously the function itself has no local min/max, but if the function is only for the interval between $0$ and $5$, are $x = 0$ and $x = 5$ considered local min/max values?
Sometimes I'm told it's $f'(x) = 0$, others it's whenever $f(x)$ is bigger or smaller than all the other values of $f(x)$ around it in an interval? Since $-1$ and $6$ are not defined since the function is only for the interval between $0$ and $5$, would that make them local min/maxima?

A: When testing for minimums and maximums, we check critical points, and included in these critical points are endpoints of intervals, in the case of a function defined on such an interval.
In your function, $y' = 5 \neq 0$ for all $x$.
That leaves us with only the endpoints of the interval on which $y$ is defined as possible candidates for extrema. Since $y$ is always increasing, we can see that there is a minimum at $(0, 0)$ and a maximum  at $(5, 25).$
$y = f(x)$ is an extrema (minimum or maximum) only if $x$ is an element within the prescribed domain.


text:
Q: how do i create an automated sql restore script for multiple backups? Hello to all SQL gurus out there.
I basically have 6 daily sql backups (.bak) that need a restore everyday. I want to automate this process by having the sql agent run the script daily. I have the following restore script written, and I know it's not completely correct, that is why I'm here to ask for any pointers is much appreciated! I'm also still new to writing SQL stored procedures, but my job entails a lot of it. So, I'm learning all this as I go. I welcome any help. :) Thanks a bunch everyone!
use master;
go

set nocount on

-- 1 - variable declaration
declare @dbname nvarchar(max) --database to restore
declare @backuppath nvarchar(max) --backup location
declare @filelisttable --list the table to populate
declare @sql nvarchar(max) --dynamic sql
declare @mdf nvarchar(max) --logical primary data file
declare @ndf nvarchar(max) --logical 2nd data file
declare @ldf nvarchar(max) --logical log data file
declare @dp nvarchar(200) --data file path
declare @lp nvarchar(200) --log file path
declare @backupfile nvarchar(500)

-- 2 - initialize variables
set @dbname = 'test'
set @backuppath = '\\mybackuppath\c$\test'

-- 3 - get list of files
insert into @filelisttable exec('restore filelistonly from disk = ''' +@backuppath+'''') --temptable to retrieve all back up files

-- 4 - retrieve top 6 recent data extracts
select  @backuppath  = max(backupfile)
from @filelist
where backupfile like '%.bak' --how to pick up most recent 6 back up files w/timestamp on trails?

set @sql = ('use [master])
    restore database @dbname ['+@dbname+']
        from disk = N'''+@backuppath+'''
            with replace,
            move N'''+@mdf+''' to N'''+@mdf+'''
            move N'''+@ndf+''' to N'''+@ndf+'''
            move N'''+@ldf+''' to N'''+@ldf+''''

-- 5- the 6 backup files that need to be restored daily

/** I have to run this manually everyday, and I want to automate this.
RESTORE DATABASE test FROM
    DISK = 'C:\test\test_Customer_20160518_1.bak',
    DISK = 'C:\test\test_Customer_20160518_2.bak',
    DISK = 'C:\test\test_Customer_20160518_3.bak',
    DISK = 'C:\test\test_Customer_20160518_4.bak',
    DISK = 'C:\test\test_Customer_20160518_5.bak',
    DISK = 'C:\test\test_Customer_20160518_6.bak'
    WITH REPLACE,
    MOVE 'test_Data1' TO 'E:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\test_CUSTOMER.mdf',
    MOVE 'test_Data2' TO 'E:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\test_CUSTOMER_1.ndf',
    MOVE 'test_Log' TO 'E:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\test_CUSTOMER_2.ldf'
    GO
**/

use master
alter database test set multi_user with rollback immediate;

go

return


text:
Q: Is GPS time measuring the proper time on the mean sea level or the GPS station itself? LeapSecond.com states:

Global Positioning System time is the atomic time scale implemented by the atomic clocks in the GPS ground control stations and the GPS satellites themselves.

Does GPS time measure the proper time on the mean sea level (rotating geoid) or the proper time of the GPS station itself?
In other words, is GPS time exactly 19 SI seconds behind TAI time, where an SI second is defined as the proper time on the rotating geoid equal to the duration of 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the caesium-133 atom at rest and at a temperature of 0 K?
Put another way, is GPS time and TAI time simultaneous?

A: GPS time is locked to TAI time, with a constant difference of 19 seconds as you say. In fact GPS is used as part of the TAI process. See for example http://tycho.usno.navy.mil/ptti/1993/Vol%2025_13.pdf and http://tycho.usno.navy.mil/ptti/ptti2000/paper12.pdf for details.
If you're interested in this area there's a lot of useful stuff on the US Navy web site. Have a Google for something like "gps time site:navy.mil" for lots of useful articles.


text:
Q: Understanding the Nutch Regex pattern I am very new to Nutch. I am using Nutch 2.3 to crawl a website, here i want to crawl only some links which matches a specific pattern. As we know for this we have to use regex-urlfilter.txt.. So I have configured something like below in my regex-urlfilter.txt file, but the result is 0 crawled URL's.
URL's I want to crawl should match below pattern:
http://abc.test.com/profiles/people/a/1.html

In the above URL, we can see /a/1.html at the end. I want to apply regex only at this part. the letter 'a' could be [a-z] and the number '1' could be [1-20]. There is no change in the rest of the URL( http://abc.test.com/profiles/people).
Hope my requirement is clear now
Below is what I have written in /bin/seed/urls.txt
http://abc.test.com/profiles/people/a/1.html

Also I tried with http://abc.test.com/
And below is my regex pattern in regex-urlfilter.txt file
# accept anything else
+^http://abc.test.com/profiles/people/([a-z]*\.)/([0-20]*\.).html

I am getting 0 URL's when I am crawling. I am assuming that I am making some mistakes either in urls.txt file or in regex-urlfilter.txt
Will somebody please help me in configuring properly
Thanks in advance..

A: As per the Nutch Tutorial, you need to use a regex to the variable part, and you are doing that right, but your regular expression needs a small correction.
The literal dot . in regex must be escaped. ([a-z]*\.)/([0-20]*\.).html means lowercase English letters, 0 or more occurrences, then a literal ., then a literal /, then 0 or more 0s, 1s, 2s ([0-20]*), followed by a literal ., and then any character and html literal string.
So, you are trying to allow strings like
http://abc.test.com/profiles/people/./.^html

See, you require . to be before the final /. It is not the case, I believe.
So, use
+^http://abc\.test\.com/profiles/people/[a-zA-Z]+/([1-9]|1[0-9]|20)\.html

See demo


text:
Q: JSON to JSON transformation with JOLT and NIFI I need help with a JSON transformation. I'm using NIFI to transform a flat JSON into a nested JSON. I'm using processor JoltTransformJSON in version 1.8.0.
I have this JSON:
[
   {
      "territoryName":"Bauru",
      "territoryCode":"50",
      "territoryLatitude":1,
      "territoryLongitude":1,
      "branchCode":"80",
      "branchName":"Aracatuba",
      "branchLatitude":1,
      "branchLongitude":1
   },
   {
      "territoryName":"Bauru",
      "territoryCode":"50",
      "territoryLatitude":1,
      "territoryLongitude":1,
      "branchCode":"50",
      "branchName":"Bauru",
      "branchLatitude":1,
      "branchLongitude":1
   },
   {
      "territoryName":"Bauru",
      "territoryCode":"50",
      "territoryLatitude":1,
      "territoryLongitude":1,
      "branchCode":"74",
      "branchName":"Fernandopolis",
      "branchLatitude":1,
      "branchLongitude":1
   }
]

And I need an output like this
{
   "territoryName":"Bauru",
   "territoryCode":"50",
   "area":[
      {
         "latitude":1,
         "longitude":1
      },
      {
         "latitude":1,
         "longitude":1
      },
      {
         "latitude":1,
         "longitude":1
      }
   ],
   "branches":[
      {
         "branchName":"Aracatuba",
         "branchCode":"80",
         "area":[
            {
               "latitude":1,
               "longitude":1
            },
            {
               "latitude":1,
               "longitude":1
            }
         ]
      },
      {
         "branchName":"Bauru",
         "branchCode":"50",
         "area":[
            {
               "latitude":1,
               "longitude":1
            },
            {
               "latitude":1,
               "longitude":1
            }
         ]
      },
      {
         "branchName":"Fernandopolis",
         "branchCode":"74",
         "area":[
            {
               "latitude":1,
               "longitude":1
            },
            {
               "latitude":1,
               "longitude":1
            }
         ]
      }
   ]
}

I'm trying JOLT on line but I can't figure out how to create the spec to do it. Any help is welcome.


text:
Q: h2o.ai AutoML keeps repeating model object details. How do I supress this output? I have successfully built an h2o.ai automl object.  The problem I am having, however, is that whenever I am accessing the object, it repeats all of the object performance stats in the console output (including when I create a scored object which is particularly annoying).  How can I supress this output?
As an example, everytime I perform a task in the console, I now get model details listed in the std output.
results_data[:, i] = (cwc_as_df.values).flatten()
Model Details
=============
H2OStackedEnsembleEstimator :  Stacked Ensemble
Model Key:  StackedEnsemble_AllModels_AutoML_20210101_103720
No model summary for this model
ModelMetricsBinomialGLM: stackedensemble
** Reported on train data. **
MSE: 0.24104117322022564
RMSE: 0.49095944152264315
LogLoss: 0.6747021871111782
Null degrees of freedom: 9906
Residual degrees of freedom: 9897
Null deviance: 13734.012930120512
Residual deviance: 13368.549135420886
AIC: 13388.549135420886      p1
--------
0.611681
0.498122
0.468903
0.480892
0.78083
0.420298
0.541082
0.479242
...


text:
Q: Unrecognized escape character in asp.net I have the following piece of code in my .cs file :
string connectionString= "SUMAN-PC\SQLEXPRESS;Initial Catalog=northwind;Integrated Security=True";

It produce error as unrecognized escape character for the "\" character.How to solve this?
Note:Its in the .cs file not in the web.config

A: You didn't escapte the backslashes. this can be done like
string connectionString= @"SUMAN-PC\SQLEXPRESS;Initial Catalog=northwind;Integrated Security=True";

-> string prefixed by @

OR

string connectionString= "SUMAN-PC\\SQLEXPRESS;Initial Catalog=northwind;Integrated Security=True";

-> prefix backslash with another one


text:
Q: Deactivate user access or delete it? I'm working on a project using Django. After struggling about how delete user from my database, I found this information.

is_active
  Boolean.
  Designates whether this user account should be
  considered active.  We recommend that you set this flag to False
  instead of deleting accounts; that way, if your applications have any
  foreign keys to users, the foreign keys won't break.

After reading that, for me, as a developer makes sense, even easier my job. But I was wondering how the user would feel if he/she knows that the data generated by his/hers use wasn't delete in fact, but only, deactivated.
So as a developer, can I warn my user that his/her data won't be delete in fact to avoid any kind of law issue ?

A: From a programming point of view, there are many options:

*

*You can change all vital details such as email, names etc to anything different (again this depends though on related data, eg if they are family pictures, this won't do any good).

*You can have something like 'anonymous' account or 'deleted user' and hunt down to change all relationships' ids to that account (again there are issues to be worried depending on the specific data).

*You can eventually indeed delete the user as soon as again you look into all your relationships and decide what to do with them if a user gets deleted.

The documentation's recommendation is good for specific cases, but you have to decide on your own based on your specific case and requirements.
From a legal point of view, I am no expert but I believe this is a huge matter that is treated differently across countries, but in the end I believe there is an ethical obligation to let your users know at least about what you do with their data.


text:
Q: HTTPResponse debugging with the android emulator I would like to know if there is anyway to debug the HTTP response with the android emulator. my logs show that the response is not arriving complete to the application and i would like to know if it is the server that does not send the complete response or if my application is not processing the response completely.
I tried hooking up Fiddler and Blurp proxy, it actually works with Blurp proxy but only for HTTP and as you may guess i need it also for HTTPS

A: See this answer regarding capturing network traffic on the emulator:
Android emulator: How to monitor network traffic?

A: You can setup TCP/IP Monitor within eclipse. Then point your android emulator to talk to your computer and to the port you setup the monitor to listen on. The monitor will then forward the request to the appropriate host (which you configure when you create the monitor). This works nicely for your problem ;)
Take a look at this


text:
Q: Is it possible to do non-blocking Facebook API calls, using node.js? I want to use node.js to boost my Facebook applications performance. Imagine application that tries to compute who is you best friend on Facebook, fetching a lot of data from API calls - determining how many times your friends have posted to your wall, how many photos you have marked on together - so on.
So instead of running that calls one after one, as I do using PHP I have an idea to send them all together to Facebook using non-blocking, asynchronous nature of Node.js.
So overall execution time will be the time of most time consuming API call, but not the sum of execution time of the every call, right?
I try to use node-facebook-sdk (https://github.com/tenorviol/node-facebook-sdk) to make Facebook API calls and it seems to be that it's blocking, isn't it?
Just quick and dirty modification of example code, requesting 3 user profiles, seems that calls are not asynchronous, each sending to Facebook after previous has completed. Are there any way to avoid that?
Thank in advance!
var fbsdk = require('facebook-sdk');

var facebook = new fbsdk.Facebook({
  appId  : '_APPID_',
  secret : '_SECRET_'
});

var i = 0;

setInterval(function() {
  i++;
  console.log("TICK " + i);
}, 500);

facebook.api('/100000997949108', function(data) {
  console.log(data);
});

facebook.api('/1609464095', function(data) {
  console.log(data);
});

facebook.api('/100000560820400', function(data) {
  console.log(data);
});

A: This library will help you out with all things async. I hashed the particular method you would want to use for your problem, but the library as a whole is excellent at abstracting some of the more tedious (and ugly!) async patterns away. Great transitioning tool for those coming from procedural and you can take a peak under the covers if you want to learn some async patterns.
https://github.com/caolan/async/#parallel


text:
Q: >console login on macOS High Sierra 10.13.5 In attempting to log in using >console, I am met with a black screen and no terminal prompt, I eventually need to reboot into the GUI. I have successfully used this in the past (say, Mavericks). Has anyone been successful in >console login using High Sierra? I would rather not have to dual boot into linux. Disabling SIP does not solve the problem. The command:
sudo defaults write /Library/Preferences/com.apple.loginwindow.plist "DisableConsoleAccess" NO does nothing. To update this, I contacted Apple regarding this and have a macOS engineer working on a fix. When I hear back, I will update the OP.


text:
Q: Looping through XML Object PHP This is frustrating me! It seems so simple but I can't loop through this XML for the life of me. I'm getting back a SimpleXMLElement Object from this link (http://www.nfl.com/liveupdate/scorestrip/ss.xml). I'm trying to drill down into g array and get the attributes of [0], [1], [2] and etc. I'm just learning PHP. So any help would be appreciated.
The code I have tried:
$nfl = simplexml_load_file('http://www.nfl.com/liveupdate/scorestrip/ss.xml');
    foreach ($nfl as $game) {
        print '
';
        print_r($game);
        print '
';
    }

It outputs:
SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [w] => 2
            [y] => 2014
            [t] => R
            [gd] => 1
            [bph] => 103
        )

    [g] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091100
                            [gsis] => 56186
                            [d] => Thu
                            [t] => 8:25
                            [q] => F
                            [h] => BAL
                            [hnn] => ravens
                            [hs] => 26
                            [v] => PIT
                            [vnn] => steelers
                            [vs] => 6
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [1] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091400
                            [gsis] => 56187
                            [d] => Sun
                            [t] => 1:00
                            [q] => F
                            [h] => BUF
                            [hnn] => bills
                            [hs] => 29
                            [v] => MIA
                            [vnn] => dolphins
                            [vs] => 10
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [2] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091401
                            [gsis] => 56188
                            [d] => Sun
                            [t] => 1:00
                            [q] => F
                            [h] => CAR
                            [hnn] => panthers
                            [hs] => 24
                            [v] => DET
                            [vnn] => lions
                            [vs] => 7
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [3] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091402
                            [gsis] => 56189
                            [d] => Sun
                            [t] => 1:00
                            [q] => F
                            [h] => CIN
                            [hnn] => bengals
                            [hs] => 24
                            [v] => ATL
                            [vnn] => falcons
                            [vs] => 10
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [4] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091403
                            [gsis] => 56190
                            [d] => Sun
                            [t] => 1:00
                            [q] => F
                            [h] => CLE
                            [hnn] => browns
                            [hs] => 26
                            [v] => NO
                            [vnn] => saints
                            [vs] => 24
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [5] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091404
                            [gsis] => 56191
                            [d] => Sun
                            [t] => 1:00
                            [q] => F
                            [h] => MIN
                            [hnn] => vikings
                            [hs] => 7
                            [v] => NE
                            [vnn] => patriots
                            [vs] => 30
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [6] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091405
                            [gsis] => 56192
                            [d] => Sun
                            [t] => 1:00
                            [q] => F
                            [h] => NYG
                            [hnn] => giants
                            [hs] => 14
                            [v] => ARI
                            [vnn] => cardinals
                            [vs] => 25
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [7] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091406
                            [gsis] => 56193
                            [d] => Sun
                            [t] => 1:00
                            [q] => F
                            [h] => TEN
                            [hnn] => titans
                            [hs] => 10
                            [v] => DAL
                            [vnn] => cowboys
                            [vs] => 26
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [8] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091407
                            [gsis] => 56194
                            [d] => Sun
                            [t] => 1:00
                            [q] => F
                            [h] => WAS
                            [hnn] => redskins
                            [hs] => 41
                            [v] => JAC
                            [vnn] => jaguars
                            [vs] => 10
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [9] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091408
                            [gsis] => 56195
                            [d] => Sun
                            [t] => 4:05
                            [q] => F
                            [h] => SD
                            [hnn] => chargers
                            [hs] => 30
                            [v] => SEA
                            [vnn] => seahawks
                            [vs] => 21
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [10] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091409
                            [gsis] => 56196
                            [d] => Sun
                            [t] => 4:05
                            [q] => F
                            [h] => TB
                            [hnn] => buccaneers
                            [hs] => 17
                            [v] => STL
                            [vnn] => rams
                            [vs] => 19
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [11] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091410
                            [gsis] => 56197
                            [d] => Sun
                            [t] => 4:25
                            [q] => F
                            [h] => DEN
                            [hnn] => broncos
                            [hs] => 24
                            [v] => KC
                            [vnn] => chiefs
                            [vs] => 17
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [12] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091411
                            [gsis] => 56198
                            [d] => Sun
                            [t] => 4:25
                            [q] => F
                            [h] => GB
                            [hnn] => packers
                            [hs] => 31
                            [v] => NYJ
                            [vnn] => jets
                            [vs] => 24
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [13] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091412
                            [gsis] => 56199
                            [d] => Sun
                            [t] => 4:25
                            [q] => F
                            [h] => OAK
                            [hnn] => raiders
                            [hs] => 14
                            [v] => HOU
                            [vnn] => texans
                            [vs] => 30
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [14] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091413
                            [gsis] => 56200
                            [d] => Sun
                            [t] => 8:30
                            [q] => F
                            [h] => SF
                            [hnn] => 49ers
                            [hs] => 20
                            [v] => CHI
                            [vnn] => bears
                            [vs] => 28
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

            [15] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [eid] => 2014091500
                            [gsis] => 56201
                            [d] => Mon
                            [t] => 8:30
                            [q] => P
                            [h] => IND
                            [hnn] => colts
                            [hs] => 0
                            [v] => PHI
                            [vnn] => eagles
                            [vs] => 0
                            [rz] => 0
                            [ga] =>
                            [gt] => REG
                        )

                )

        )

)

I tried this foreach but it output nothing:
foreach ($nfl->g as $game) {
    print '
';
    print_r($game);
    print '
';
 }

A: $nfl->g doesn't exist and you also need to grab the attributes and not the contents since they are all blank. You should have success with the following. Note the proper depth in the XML $nfl->gms->g. Also note the use of the attributes() call.
$nfl = simplexml_load_file('http://www.nfl.com/liveupdate/scorestrip/ss.xml');

print '
';
foreach ($nfl->gms->g as $game) {
    foreach($game->attributes() as $a => $b) {
        echo $a,'="',$b,"\"\n";
    }
    echo "\n------------------------------------------\n";
}
print '
';


text:
Q: Duplicates in UITableView This is a possible duplication of previous questions, but I cannot figure out why my records are duplicating. I know that the table tries to recycle the rows. It seems like the table is adding more cells for every piece of data inserted into the table.
For instance for 2 records I get 4 rows. For 3 records, I get 9 rows.
Here the code:
UITable delegate stuff:
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    return nil;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return letters.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return letters.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    printf("%li", (long)indexPath.row);

    [cell textLabel].text = [letters objectAtIndex:indexPath.row];

    return cell;
}

Do I have to check if the data has already been displayed first?

A: Found the answer. Very silly but easy to miss. I have set this to:
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return letters.count;
}

should be set to 1, since there is only 1 section to display. I will leave this here in case someone does the same silly mistake!
IE
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}


text:
Q: How to debug specific file with gdb? I have to cpp files (main and functions) and I make them to build a exe file (code) and two object files (main.o and functions.o).
How can I debug specific file "functions.cpp" from gdb command line?

A: You need to compile your files with gcc's -g3 option. After this start gdb <exename>. You can then set breakpoint in your file inside gdb by something like b functions.cpp:36 if you want the exe to break on line 36 of functions.cpp. You can set breakpoints to particular function calls as well, such as b func(). Then run the program using r <options that exename takes>.


text:
Q: Measure with a Value from corresponding attribute dimension I have a Measure with 2 Dimensions: Cars and Routes.
For each Car there is only 1 corresponding Route.
I need to create a new measure that shows Route Name attribute for each member in Cars dimension.
Now we Measure look like this:

But I need to create a string Measure with no agregation, so data starts looks like at the next picture:

A: It is valid to use the following within a measure when writing mdx queries:
... .CURRENTMEMBER.MEMBERCAPTION

If the attribute is on rows as your first screenshot shows then this measure will return its caption


text:
Q: Problema al conectar con PHP 7 Tengo un archivo dbcon.php el cual me hace la conexión a la base de datos y otros de sesión... por más que intento adaptar el código a php 7 no me hace la conexión y se vuelve a index.php. El tipo de conexión que hago es PDO.
dbcon.php
$mysqli = new mysqli("localhost", "usuario", "contr", "bbdd");
if ($mysqli->connect_errno) {
    echo "Fallo al conectar a MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}

login.php
include('dbcon.php');
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
$sql = 'SELECT * FROM users WHERE username= "'.$username.'" && password= "'.$password.'"';
$result = mysqli_query($mysqli, $sql);
if (mysqli_num_rows($result) > 0) {
    while($row = mysqli_fetch_assoc($result)) {
        $_SESSION['id']=$row['user_id'];
        echo 'true';
        //echo 'true';

    }
} else {
    echo 'false';
}


text:
Q: Torch '!./install.sh' returns error in Colab when installing Torch I followed http://torch.ch/docs/getting-started.html#_ to install Torch.
I always get the following error when running
!./install.sh

in google colab
error:
...
-- Installing: /root/torch/install/include/luaT.h
-- Installing: /root/torch/install/share/cmake/torch/luaTConfig.cmake
Updating manifest for /root/torch/install/lib/luarocks/rocks
torch scm-1 is now built and installed in /root/torch/install/ (license: BSD)

Updating manifest for /root/torch/install/lib/luarocks/rocks
dok scm-1 is now built and installed in /root/torch/install/ (license: BSD)

gcc -O2 -fPIC -I/root/torch/install/include -c utils.c -o utils.o
gcc -shared -o treplutils.so -L/root/torch/install/lib utils.o
gcc -O2 -fPIC -I/root/torch/install/include -c readline.c -o readline.o
readline.c:8:10: fatal error: readline/readline.h: No such file or directory
 #include <readline/readline.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Error: Build error: Failed compiling object readline.o

.
Please I need help fixing this error.

A: Probably you need something like
!apt-get install libreadline-dev

before attempting to run the install.sh script.


text:
Q: cmake, qt, different libraries and executable. Localization? I have a project build by myself that is made by different executable and different libraries.
The idea is like:
/Src/
     ExecA/CMakeLists.txt
     ExecB/CMakeLists.txt
     LibC/CMakeLists.txt
     LibD/CMakeLists.txt

ExecA uses LibC and LibD,
ExecB uses only LibC
or... let me say... not all the executables uses all the libraries.
I have written in every CMakeLists.txt this sentence that allow me to generate ts and qm files:
SET(LANGUAGES ${SUPPORTED_LANGUAGES)
SET(LANGUAGE_TS_FILES)
FOREACH(LANGUAGE ${LANGUAGES})
    SET(TS_FILE      "${CMAKE_CURRENT_SOURCE_DIR}/${LIBRARY_NAME}_${LANGUAGE}.ts")
    SET(LANGUAGE_TS_FILES ${LANGUAGE_TS_FILES} ${TS_FILE})
    SET_SOURCE_FILES_PROPERTIES(${TS_FILE} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}")
 ENDFOREACH(LANGUAGE ${LANGUAGES})
 IF(LANGUAGE_TS_FILES)
     QT4_CREATE_TRANSLATION(qm_files ${FILES} ${QMLFILES}      ${LANGUAGE_TS_FILES})
 ENDIF(LANGUAGE_TS_FILES)

The qm files are then loaded in a qrc file that is shipped.
library:
set(RESOURCES
    ${CMAKE_CURRENT_BINARY_DIR}/translations_${LIBRARY_NAME}.qrc
)

executable:
set(RESOURCES
    ${CMAKE_CURRENT_BINARY_DIR}/translations_${EXECUTABLE_NAME}.qrc
 )

when create the library I have a sentence like
add_library(${LIBRARY_NAME} ${FILES} ${HEADERS} ${HEADERS_MOC}   {RESOURCES} ${qm_files})

and for the executable:
add_executable(${EXECUTABLE_NAME} ${FILES} ${HEADERS} ${HEADERS_MOC} ${RESOURCES} ${qm_files} LibA LibB)

with this code I am able to generate ts files, I edit them and then I can generate qm files to be loaded when the application starts.
The problem I am facing is that only the code present in the application is localized. The code of the library is not localized.
I read that I have to directly load translation for the library but, everywhere I try to load the qm file from the qrc with:
myappTranslator.load(langstr);

I receive a false as reply for all the qm files of the libraries.
It works for the executable.
Any hint on investigting on how to have libraries localized?


text:
Q: Tweaking the variables in integration I do not understand why these two equations are equal. If t is replaced by x + t, shouldn't x-t be replaced by -t (=x-(x+t)) rather than by t?

A: You are right, but so is the solution. Note that the sum goes from $-N$ to $N$, so changing the order of summation yields
$$\sum \limits_{j = -N}^N e^{-ijt} = \sum \limits_{j = -N}^N e^{ijt}.$$
This is under the assumption that $f$ is $2\pi$-periodic, as otherwise the substitution is incorrect in the first place.


text:
Q: Constrain body in HTML to height necessary to hold content for small page I have a webpage where the background-color for the body fills the browser window when the content is short. At times the content may be large and fill the browser window. Is there any way of controlling the height of the body to fit the content? I have tried setting the height of the body to 100% and to auto but this does not help. Solutions that do not need Javascript are preferred. A minimal example is included:
<!DOCTYPE html>

        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible">
        <title>Minimal Testcase for Body Height Sizing</title>

Test Heading

Sample text

When I set the height of the body to auto, the height is correctly reported by the Chrome development tools, but the background-color overflows and fills the browser window. So the question becomes, how to prevent overflow of the background-color.
`

A: Set HTML background-color to white.
html{
    background-color: white;
}

CSS body background is designed to fill the whole viewport if html doesn't have any style applied to it.

A: Try setting the height of the html element aswell
html {
height: 100%;
}
body {
min-height: 100%;
}


text:
Q: How to align a dynamic html div text inline with other text behind I have the below dynamic text parallel to each other.
A Person who brings together people,new
ideas, and important resources  and
service models.A person who brings..
 **Download:Img**

A seeker of promising
academic thinking,and
  Download: Img
but the download:Img div is not in-line other download:img.The paragraph maybe any number of lines but all the downlaod:img text should be in same line irrespective of the length of paragraph.
I have tried line height CSS property but its changing the height for one Downlaod:img only but i need all the Downlaod:img text to be in same line.can anyone help?


text:
Q: I'm locked inside Warmaiden's! I'm stuck in Warmaiden's in Whiterun.I click the door and it says it is locked. If I unlock it the animation plays, but then nothing: it doesn't load, doesn't freeze... just nothing. This happens to both doors leading outside.
I'm just hanging out in Warmaiden's, stuck.

A: Steal weapons, food, just about everything you can, to make a guard come and take you to jail.

A: Assuming there's not a larger problem and it's just a glitch that will fix itself once Warmaiden's is unloaded, you can use teleport console commands to get out and get on with your adventuring life. (It sounds like you're on a PC, so you have access to the console.)
First, shut down Skyrim and make a backup of your save. You want to be able to back up to a known
Open the console with ` (or § on some international keyboards – whatever key is below Esc and above Tab).
The console will open. Type cow WhiterunWorld 5, -3 and press enter. You should appear somewhere outside within Whiterun.
Alternatively, you can use the coc command to warp to another interior and try to exit there. For example, coc WhiterunDragonsreach will put you in Dragonsreach, right inside the front doors.
(If neither work the bug is more than just doors in Warmaiden's and we'll need more information about your installation of Skyrim.)


text:
Q: How to create legend in progress bar? how to make number follow the bar size?
in this qt designer, i create frame which contain bar, and
qlabel =500\n\n250\n\n0\n\n-250\n\n-500
Is there a way to create legend in this bar?
or can we make qlabel follow the size of bar?'
Progressbar in normal size
Progressbar that get extended

A: If I wasn't interested in having accuracy, I would create a structure with layouts like this
QHorizontalLayout
-> QProgressBar
-> QVerticalLayout
   -> QLabel (500)
   -> QLabel (250)
   -> QLabel (0)
   -> QLabel (-250)
   -> QLabel (-500)

But If accuracy is your priority you should start thinking of making your own custom widget.
p.s. the above is not code, but rather a representation of the widget hierarchy that I suggest. I have just formatted it as a code snippet, just to show the hierarchy  :)


text:
Q: Dúvida sobre inicialização de membro de dados const
"A 'constância' de um objeto const é imposta a partir do momento em que o construtor completa
  a inicialização do objeto até o destrutor desse objeto ser chamado" - Deitel,Como Programar C++

Se o compilador so "considera" um membro const apos a inicialização do objeto pelo construtor, por que uma inicialização por atribuição gera erros ? Por que só é aceita uma inicialização por inicializador de membro ?
Exemplos:
class Example
{
   public:
    const int num1;
    int num2;

   Example(int a, int b)
   {
      num1 = a; // Gera um erro
      num2 = b;
   }
}

class Example
{
   public:
    const int num1;
    int num2;

   Example(int a, int b)
    : num1(a) // Funciona normalmente
   {
      num2 = b;
   }
}

A:
Por que só é aceita uma inicialização por inicializador de membro ?

Simples. A inicialização dos membros é completa antes do corpo do construtor começar a executar.
Isto daqui:
num1 = a;

É atribuição, e não inicialização. Atribuição em variáveis constantes é proibido na linguagem. Agora, isto daqui:
Example(int a, int b) : num1(a) { ...

É inicialização. Seria o mesmo que fazer:
const int num1(42);

Ou:
const int num1 = 42;

Porque quando usa-se o = na declaração da variável, aí sim considera-se como inicialização, e não atribuição.


text:
Q: Do addition of values while adding into array in PHP I have values from database trying to add the next value with the initial value then insert into an array, can somebody help me here, please?
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
        $balance[]  =   (round($row["Balance"], 2))++;;
    }

Scenario:
I have 1,2,3,4,5 values
I want to get these values into an array as below:
{1,3,6,10,15}

That is:
{1, (1+2), (1+2+3), (1+2+3+4), (1+2+3+4+5)}

Any one with an idea?

A: You would be better off just having a running total and adding this in...
$total = 0;
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
    $total = round($row["Balance"], 2) + $total;
    $balance[]  = $total;
}

A: Maybe that:
$a = [1,2,3,4,5];

$b = [];

foreach($a as $c) {
    if(count($b) === 0) {
        $b[] = $c;
    } else {
        $b[] = end($b) + $c;
    }
}

$b is result.


text:
Q: Why does call off mean postpone? As a synonym of "postpone", "call off" can be used.
But, I can't understand why "call off" has a meaning of "postpone".
Please tell me its origin.

A: In some contexts, such as sport, the verb "call" can be used to mean "declare that something is a" - eg "call foul", meaning "To declare something as being a foul".  This probably originated from the referee literally shouting, ie "calling", "Foul!" and so "Call 'Foul!'" becomes "Call foul".
Using this meaning, to "call off" means "To declare something as being off", and "off" is a synonynm for "cancelled".  So if you were to say "We don't have enough players, I'm cancelling the game", this could be worded as "We don't have enough players, I'm calling off the game", and this could be further shortened to "I'm calling it off." or "I'm going to call off the game."

A: I would imagine it comes from the use when dogs were used as a security force and there was a command to get them to stop, referred to as 'calling them off' as calling the dogs off their pursuit.


text:
Q: Add a fee for a specific product category in Woocommerce I already found this code here and it works for like 80/90% for me (see below).
This code adds 60 euro to my cart when there is a product from category ID 349 in the cart. When I add a product from that category to my cart when the cart is empty it works fine. But when there is already a product in my cart from a different category and then I add the product with category 349 it doesn't add the 60 euro extra fee. How is this possible?
 function woo_add_cart_fee() {

$category_ID = '349';
global $woocommerce;

foreach ($woocommerce->cart->cart_contents as $key => $values ) {
    // Get the terms, i.e. category list using the ID of the product
$terms = get_the_terms( $values['product_id'], 'product_cat' );
    // Because a product can have multiple categories, we need to iterate through the list of the products category for a match
    foreach ($terms as $term) {
        // 349 is the ID of the category for which we want to remove the payment gateway
        if($term->term_id == $category_ID){
         $excost = 60;
         }
         }
        $woocommerce->cart->add_fee('Extra bezorgkosten kunstgras', $excost, $taxable = false, $tax_class = '');
}
}
add_action( 'woocommerce_cart_calculate_fees', 'woo_add_cart_fee' );

A: The code you are using is a bit outdated and you should use has_term() Wordpress conditional function to target a product category this way:
add_action( 'woocommerce_cart_calculate_fees','custom_pcat_fee', 20, 1 );
function custom_pcat_fee( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    // Set HERE your categories (can be term IDs, slugs or names) in a coma separated array
    $categories = array('349');
    $fee_amount = 0;

    // Loop through cart items
    foreach( $cart->get_cart() as $cart_item ){
        if( has_term( $categories, 'product_cat', $cart_item['product_id']) )
            $fee_amount = 60;
    }

    // Adding the fee
    if ( $fee_amount > 0 ){
        // Last argument is related to enable tax (true or false)
        WC()->cart->add_fee( __( "Extra bezorgkosten kunstgras", "woocommerce" ), $fee_amount, false );
    }
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

A fee of 60 will always be added if there is in cart an item from 349 product category ID.

A: I found a solution like the following. Note that I kept adding a fee, because I started from a previous snippet. You can apply an existing discount or calculate a different total according to your needs.
In this case, I apply a negative fee - like a discount - according to a >= 300 total value of the cart, whose values would be -25% only for local_pickup shipping method, calculating taxes in addition.
function discount_to_cat(){
// thanks to LoicTheAztec's snippet
$cat_in_cart = false;
// Loop through all products in the Cart
foreach ( WC()->cart->get_cart() as $cart_item ) {

    if ( has_term( 'category_to_pick', 'product_cat', $cart_item['product_id'] ) ) {
        $cat_in_cart = true;
        $tot_category_price = $cart_item['data']->get_price();
        $tot_category_qty = $cart_item['quantity'];
        $tot_category =  $tot_category_price * $tot_category_qty;
        break;
    }
}   global $product;
    $total = WC()->cart->subtotal;
    $discount_label = "";
    if($total >= 300){
        $discount_label=15;
}
    $chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
    $chosen_shipping = explode(':',$chosen_methods[0]);

    if($chosen_shipping[0]=='local_pickup'){
        $discount_label=25;
    }
    $discount_applied = ($total-$tot_category)*$discount_label/100;
    if($discount_label!=""){
        $discount_applied_net = ($discount_applied/1.1); //1.1 according taxes for shipping
        WC()->cart->add_fee( "Discount applied: ($discount_label%)", -$discount_applied_net, false );
    }
}

add_action( 'woocommerce_cart_calculate_fees','discount_to_cat' );


text:
Q: How i can translate the label "browse files" and "upload files"? I need translate the label "browse files" and "upload files" for a extension which uses default uploader of magento.
In Mage_Adminhtml_Block_Media_Uploader i changed the function _prepareLayout()
protected function _prepareLayout()
{
    $this->setChild(
        'browse_button',
        $this->getLayout()->createBlock('adminhtml/widget_button')
            ->addData(array(
                'id'      => $this->_getButtonId('browse'),
                'label'   => Mage::helper('adminhtml')->__('Browse Files...'),
                'type'    => 'button',
                'onclick' => $this->getJsObjectName() . '.browse()'
            ))
    );

    $this->setChild(
        'upload_button',
        $this->getLayout()->createBlock('adminhtml/widget_button')
            ->addData(array(
                'id'      => $this->_getButtonId('upload'),
                'label'   => Mage::helper('adminhtml')->__('Upload Files'),
                'type'    => 'button',
                'onclick' => $this->getJsObjectName() . '.upload()'
            ))
    );

    $this->setChild(
        'delete_button',
        $this->getLayout()->createBlock('adminhtml/widget_button')
            ->addData(array(
                'id'      => '{{id}}-delete',
                'class'   => 'delete',
                'type'    => 'button',
                'label'   => Mage::helper('adminhtml')->__('Remove'),
                'onclick' => $this->getJsObjectName() . '.removeFile(\'{{fileId}}\')'
            ))
    );

    return parent::_prepareLayout();
}

to
protected function _prepareLayout()
{
    $this->setChild(
        'browse_button',
        $this->getLayout()->createBlock('adminhtml/widget_button')
            ->addData(array(
                'id'      => $this->_getButtonId('browse'),
                'label'   => Mage::helper('adminhtml')->__('Buscar Archivos'),
                'type'    => 'button',
                'onclick' => $this->getJsObjectName() . '.browse()'
            ))
    );

    $this->setChild(
        'upload_button',
        $this->getLayout()->createBlock('adminhtml/widget_button')
            ->addData(array(
                'id'      => $this->_getButtonId('upload'),
                'label'   => Mage::helper('adminhtml')->__('Subir Archivos'),
                'type'    => 'button',
                'onclick' => $this->getJsObjectName() . '.upload()'
            ))
    );

    $this->setChild(
        'delete_button',
        $this->getLayout()->createBlock('adminhtml/widget_button')
            ->addData(array(
                'id'      => '{{id}}-delete',
                'class'   => 'delete',
                'type'    => 'button',
                'label'   => Mage::helper('adminhtml')->__('Remove'),
                'onclick' => $this->getJsObjectName() . '.removeFile(\'{{fileId}}\')'
            ))
    );

    return parent::_prepareLayout();
}

but without results

A: You can't afaik translate the label.
This two buttons are part of the flex uploader. The names of the buttons can be found here: lib/flex/uploader/uploader.mxml and can be changed there. We tried this but didn't achieve our goal, because we ware not able to compile the flex uploader.
Good luck! If you make it, please tell me which Flash/Flex version you used and ow you did it!


text:
Q: Limit access to public ip (whitelist) I want to set up a kubernetes cluster with a loadbalancer. Kubernetes will create a load balancer in azure and connect a public ip address with it.
But I don't want to make the api public, it should be exclusive for my api management service.
I tried to direct the load balancer into a vnet with the api service but I found nothing.
So I thought I could just limit the access to the public ip (a whitelist with only the incluced ip of my service) but I found nothing on the internet.
Is it possible to set such rule on a public ip or do I need some extra service for this problem?

A: With Kubernetes, assuming you have a service defined
Use the following commands:
kubectl get service
kubectl edit svc/<YOUR SERVICE>

change the type from LoadBalancer to ClusterIP
Now you can consume internally the service.


text:
Q: How many simple cycles can a graph with $n$ vertices and $m$ edges have? I am mainly interested in the smallest number of simple cycles a graph with $n$ vertices and $m$ edges must have.
For example, if $m\le n-1$, this number is $0$, then if $n\le m \le 3(n-1)/2$, it is $m-n$, then after a while it starts to grow exponentially with $m$.
What is known about this function?

A: To supplement Igor's answer, here is some more information on the maximum number of cycles  a graph on $n$ vertices with $m$ edges can have.  I apologize that this does not answer your question.  Entringer and Slater considered this problem in their paper On the Maximum Number of Cycles in a Graph.
Let $G$ be a simple connected graph with $m$ edges and $n$ vertices.  It is useful to re-parametrize by letting $d=m-n+1$, and defining $\psi(d)$ to be the maximum number of cycles of a graph with $m-n+1=d$.  They observed that since $d$ is the dimension of the cycle space of $G$, $\psi(d) \leq 2^d-1$.  On the other hand, they showed that the Möbius ladders imply that $\psi(d) \geq 2^{d-1}+d^2-3d+3$. Using exhaustive computer search they also determined $\psi(d)$ for all $d \leq 8$, and conjectured that the lower bound is essentially the right answer for $\psi(d)$.

A: For planar graphs there are recent (exponential) bounds, as in Buchin et al, 2007.


text:
Q: AlertDialog.Builder does not show ArrayList as list I am trying to develop an app, where you speak a name and it will lookup your contacts and return all names like "Lars A., Lars B., Lars C.". I save all those names in an ArrayList and it works.
Now I want to have a AlertDialog, so the User can select the right contact out of this list. I  figured out, that it has to be a CharSequence, so I convert it before. But I think the list is empty, because I only see the alert message.
This site describes it very well, but uses static values, I need dynamic values: Android Developer Site.
Heres my code:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
 CharSequence[] cs = namearray.toArray(new CharSequence[namearray.size()]);
 builder.setMessage("Welche/n " + cname + " meinst du?");
 builder.setItems(cs, new DialogInterface.OnClickListener() {
 public void onClick(DialogInterface dialog,
 int item) {
 //do something
 }   });
 AlertDialog alert = builder.create();
 alert.show();

A: The documentation says:

Because the list appears in the dialog's content area, the dialog cannot show both a message and a list and you should set a title for the dialog with setTitle().


text:
Q: How to select SQL for column 1 not in column 2 I have a table with four columns. The first column ID1 has one similar row in ID2. I like to select a query to get all rows from ID2, except the identical record. For instance:
ID1 Name1 ID2 Name2
-------------------
01  A     01  A
01  A     02  B
01  A     03  C
03  C     03  C
03  C     01  A
03  C     04  G

Select ID2, Name2 From table where ID2 <> ID1
Output should be:
ID2, Name2
----------
02   B
03   C
01   A
04   G

03/C and 01 A need to be here.
If I use distinct, then it exludes all identical records of ID1, which I don't want to. I am using classic ASP to select ID1 groups in SELECt option list. if I select 01, then SELECT option list for ID2 appear. I only want to see all ID2 that is not in ID1.

Can someone help me please?
Thanks.

A: I think there is no need for explanation:
select id2, name2
from t
where (id1 <> id2) OR (name1 <> name2)

A: I think  you want not exists.  But your result set doesn't seem to match the description of the question.
select id2, name2
from t
where not exists (select 1
                  from t t2
                  where t2.id1 = t.id2 and t2.name1 = t.name2
                 );

A: Try 'distinct'
Select distinct ID2, Name2 From table where ID2 <> ID1

A: Your question is not entirely clear, assuming that ID1 can't equal ID2 AND name1 can equal name2 the proper answer would be:
SELECT DISTINCT ID2, Name2 FROM tableName WHERE ID2 <> ID1

You select columns ID2 and Name2 but only those where ID1 is not equal to ID2. There is also DISTINCT, it guarantees that only different values are returned.
if name1 can't equal name2 you have to use:
SELECT DISTINCT ID2, Name2 FROM tableName WHERE ID2 <> ID1 AND name1 <> name2

A: this will work:
select ID2,Name2 from tablename where ID1!=ID2 and Name1!=Name2


text:
Q: Dynamically construct user-defined math function for efficient calling in C++? An example is something like Desmos (but as a desktop application). The function is given by the user as text, so it cannot be written at compile-time. Furthermore, the function may be reused thousands of times before it changes. However, a true example would be something where the function could change more frequently than desmos, and its values could be used more as well.
I see four methods for writing this code:

*

*Parse the user-defined function with a grammar every single time the function is called. (Slow with many function calls)

*Construct the syntax tree of the math expression so that the nodes contain function pointers to the appropriate math operations, allowing the program to skip parsing the text every single time the function is called. This should be faster than #1 for many function calls, but it still involves function pointers and a tree, which adds indirection and isn't as fast as if the functions were pre-compiled (and optimized).

*Use something like The Tiny C Compiler as the backend for dynamic code generation with libtcc to quickly compile the user's function after translating it into C code, and then use it in the main program. Since this compiler can compile something like 10,000 very simple programs on my machine per second, there should be next to no delay with parsing new functions. Furthermore, this compiler generates machine code for the function, so there are no pointers or trees involved, and optimization is done by TinyCC. This method is more daunting for an intermediate programmer like me.

*Write my own tiny compiler (not of C, but tailored specifically to my problem) to generate machine code almost instantly. This is probably 20x more work than #3, and doesn't do much in the way of future improvements (adding a summation operation generator would require me to write more assembly code for that).

Is there any easier, yet equally or more efficient method than #3, while staying in the realm of C++? I'm not experienced enough with lambdas and templates and the standard library to tell for sure if there isn't some abstract way to write this code easily and efficiently.
Even a method that is faster than #2 but slower than #3, and requires no dynamic code generation would be an improvement.
This is more of an intellectual curiosity than a real-world problem, which is why I am concerned so much with performance, and is why I wouldn't use someone else's math parsing library. It's also why I wouldn't consider using javascript or python interpreter which can interpret this kind of thing on-the-fly.

A: I think something along the lines of your option 2 would be good. Except maybe to be a little easier would be to have an Expr class with a float Expr::eval(std::unordered_map<string,float> vars) method. Then implement subclasses like Var with a name, Add with left and right, Sub, Mult, Div, etc all the functions you want. When evaluating you just pass in the map with like {{"x",3},{"y",4}} or whatever and each Expr object would pass that down to any subexpressions and then do it's operation.
I would think this would be reasonably fast. How complicated of expressions do you think your user's would be putting in? Most expressions probably won't require more than 10-20 function calls.
It can also get a lot faster
If you're trying to make something that graphs functions (or similar) you could speed this up considerably if you made your operations able to work with vectors of values rather than single scalar values.
Assuming you wanted to graph something like x^3 - 6x^2 + 11x - 6 with 10,000 points, if you had your Expr objects only working on single values at a time, yeah this would be like ~10-15 function calls * 10,000 points = a lot jumping around! However, if your Expr objects could take arrays of values, like calling eval with {{"x",[1,2,3...10000]}} then this would only be ~10-15 function calls, total, into optimized C++. This could easily scale up to a larger number of points and still be very fast.

A: Actually, the generating machine code track isn't that difficult, the trick is to design the parser so the parse result observes the order of computation.
Then you basically concatenate machine code strings with semantics like "push a literal on the stack", "perform a binary operation on the two topmost elements of the stack and push the result on the stack" and "pop the result from the stack"


text:
Q: What .Net business logic layer frameworks do you use ? I've been asked to extend a simple legacy application by adding a few tables and classes in it to extend functionality.
This is a .Net 1.1 application which I have now successfully upgraded to .Net 3.5
Now my problem is that for these new tables and classes I wanted to add an ORM and a business logic layer that I can in the future extend to the legacy classes whenever I need to touch a piece of that code.
I know about a quite few ORM tools that I can use, e.g. Entity Framework and NHibernate.
For me the problem is in deciding what business logic layer to use, I've used csla.net in the past with good results but my question is what other real alternatives are out there ?

A: Other than using a tool to maybe code generate some of the business objects and/or DTOs based on the database or data layer, I don't personally have much need for a framework for the business layer.
I believe CLSA.NET helps some with validation, and tries to make it easier to "tier" an application.
Some people may want a framework or something similar to help serialize business objects, but the versioning issues are usually pretty severe, so I work pretty hard to avoid needing that.
My business layers are pretty much business objects, business logic and business rules.  I try to keep it minimal, preferring simplicity.

A: The best approach to designing maintainable applications is to not rely upon any frameworks or code generation tools for the creation of your domain layer (i.e. business layer).  Keep your infrastructure away from your domain as much as possible (Infrastructure Ignorance) and avoid all-encompassing, tightly coupled frameworks which try to do everything for you.  For infrastructure concerns, seek out targeted frameworks, or frameworks which enable you to chose only those concerns which you need.


text:
Q: Opendaylight Oxygen Error when instantiating bean osgiBundleScanningSchema I use ODL Oxygen 0.8.1 version. I have blueprint.xml file like that
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
  odl:use-default-for-reference-types="true">

  <reference id="dataBroker"
    interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
    odl:type="default" />

 <service ref="cliCommandsImpl" interface="tr.com.argela.cliapp.cli.api.CliappCliCommands" />
  <bean id="cliCommandsImpl" class="tr.com.argela.cliapp.cli.impl.CliappCliCommandsImpl">
    <argument ref="dataBroker" />
  </bean>

  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
     <command name="nelmo/test-command2">
        <action class="tr.com.argela.cliapp.cli.commands.CliappCliShowCommand">
        </action>
    </command>
  </command-bundle>

</blueprint>

I couldnt instantiate the bean "CliappCliCommandsImpl", logs are following
Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean osgiBundleScanningSchema of class org.opendaylight.mdsal.dom.schema.service.osgi.OsgiBundleScanningSchemaService
    at org.apache.aries.blueprint.container.BeanRecipe.wrapAsCompDefEx(BeanRecipe.java:361) ~[?:?]
    at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromStaticFactory(BeanRecipe.java:331) ~[?:?]
    at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:280) ~[?:?]
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:830) ~[?:?]
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811) ~[?:?]
    at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79) ~[?:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?]
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88) ~[?:?]
    at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62) ~[?:?]
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106) ~[?:?]
    at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:285) ~[?:?]

A: I clear data directory of karaf then restart. Everthing seems normal.


text:
Q: Keyboard is not shown for Edit Text I have a FragmentActivity which has a layout containing two linear layouts.

*

*First linear layout changes on click events performed by user

*Second linear layout is constant throughout the application

When user performs some click actions, I am adding the fragment to the first layout as
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.llFragmentContainer, FragmentClassObject, "fragment_detail");

Then within the fragment's onCreateView method. I am inflating the view I want to show to the user.
View rootView = inflater.inflate(R.layout.personal_stuff, container,
                false);

Now personal_stuff layout has some edit text fields.
Problem :
After the first linear layout is inflated with a fragment. keyboard is not shown to the user when EditText in personal_stuff layout is focused/Clicked.
What could be the problem ?? Any suggestions ??

A: public static void forceFocusOnView(final View view) {
    if (view == null)
        return;
    view.post(new Runnable() {
        @Override
        public void run() {
            view.clearFocus();
            view.post(new Runnable() {
                @Override
                public void run() {
                    view.requestFocus();
                }
            });
        }
    });
}

with
forceFocusOnView(myView);

EDIT : public spelling was incorrect so corrected that