text:
Q: Identify an '80s/'90s animated film from a scene I am trying to identify an animated film (or TV series episode) that I watched on TV when I was a child:

*

*I watched it some time in the early '90s - adding the usual propagation delay for foreign shows in my country (Greece) at the time, it was probably created in the '80s.

*Classic 2-D animation artwork, fairly detailed. Probably created by hand; didn't feel at all like CGI.

*It was sci-fi themed and rather dark, both in plot and presentation. In retrospect, it was probably unsuitable for my age but TV program managers back then still thought that "animated" equals "for children".

*Some of the characters had a power of some sort similar to the Force Lightning from Star Wars, although I believe the lightning color was more white/yellow than blue.

*One of the main male characters was named "Lok" or "Loch" or similar. Or not; the audio was dubbed, so for all I know all the names were mangled.

*I sort-of remember one scene, probably due to all the violence:

*

*It involved a robot of some sort killing the aforementioned character, after he failed to defend himself with the lightning-thingie.

*It used retractable metallic cone-shaped (rather than flat-bladed) elements that emerged from round holes in its main body to stab the person to death.

*I seem to remember a close-up shot of the bloodied cones immediately after the deed; two cones in a vertical arrangement emerging from the right (as seen by the viewer) front side of the robot's body.

*I have the impression that the robot drove the cones into the person by moving its whole body; I don't remember them being able to move independently.

*I think that the robot had a blocky main body and was possibly tracked, but I may be wrong. I am pretty sure it was not humanoid, though.

A: Might it be Rock and Rule?

"My name is Mok, thanks a Lot"


text:
Q: Python regular expressions and Excel Im trying to perform regular match on data that came from excel to python array using openpyxl but the data came as unicode and "None" is allways given by python. The data in Hebrew and i whant to convert the strings from excel to strings that can be matched using regex.. what can be done?
import re
from openpyxl import load_workbook

file_name = 'excel.xlsx'
wb = load_workbook(file_name)
ws = wb[u'beta']
li = []
li2 = []
#readin the cells from excel into an array
for i in range(1,1500):
li2.append(ws["A"+str(i)].value)

for i in li2:
    if i != None:
    li.append(i)
#deliting the unwanted list for making memory
del li2

r = re.match("א",li[1])
r == None
>>> True

the wanted resault is r.string = "somthing..." and not r == None
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on       win32
Type "copyright", "credits" or "license()" for more information.
 >>> ================================ RESTART ================================
 >>>
 >>> li[1]
 u"\u05d0\u05d1\u05d5 \u05d2'\u05d5\u05d5\u05d9\u05d9\u05e2\u05d3 (\u05e9\u05d1\u05d8)"
 >>> print li[1]
 אבו ג'ווייעד (שבט)
 >>> r = re.match(u'א',li[1])
 >>> r ==None
 True
 >>> r = re.match(ur'א',li[1])
 >>> r = re.match(u'',li[1])
 >>> r.string
 u"\u05d0\u05d1\u05d5 \u05d2'\u05d5\u05d5\u05d9\u05d9\u05e2\u05d3      (\u05e9\u05d1\u05d8)"
 >>> unicode('א')

 Traceback (most recent call last):
   File "<pyshell#7>", line 1, in <module>
   unicode('א')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0:   ordinal not in range(128)
 >>> u'א'
 u'\xe0'
 >>> u'א'.encode("utf8")
 '\xc3\xa0'
 >>> u"א"
 u'\xe0'
 >>>

A: I put the Hebrew letter specified in your code into several cells, and then ran this code:
# -*- coding: utf-8 -*-
import re
from openpyxl import load_workbook

file_name = 'worksheet.xlsx'
wb = load_workbook(file_name)
ws = wb[u'beta']
li = []
li2 = []
#readin the cells from excel into an array
for i in range(1,1500):
    li2.append(ws["A"+str(i)].value)

for i in li2:
    if i != None:
        li.append(i)
#deliting the unwonted list for clearing memory
del li2

print "Non-empty cells: "
print li

r = re.search(u"א", li[1])

print "Match in: "
print r.string.encode('utf-8')
print "Position: "
print r.span()

Output:
Non-empty cells:
[u'Hebrew letter test 1 \u05d0', u'Hebrew letter test 2 \u05d0', u'Hebrew letter test 3 \u05d0', u'Hebrew letter test 4 \u05d0']
Match in:
Hebrew letter test 2 ÎÉ
Position:
(21, 22)

Please let me know if that's what you needed.

A: and the answer is:
import re
from openpyxl import load_workbook
file_name = "excel.xlsx"
wb = load_workbook(file_name)
ws = wb[wb.get_sheet_names()[0]]

#regex

match = re.search(r"\d",ws["A2"].value )
print match.group(0)

:)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Lock a sheet from updating in between form submissions? I have created a script on google sheets App script that will take a form submission, and put it into a new sheet. The way it does this is by calling on the last row with data, but when two forms are submitted at the same time, only one is submitted as the first did not have enough time to go through. Is there a way to still keep google forms open and delay the responses from updating the spreadsheet by 5 or so second intervals? I don't want data to be missed if two forms submit at the same time. Any help is appreciated as I am a COMPLETE beginner.

A: Casey, I think what you need is LockService. You can set the lock prior to any edits and release it once you've updated the sheet. If any concurrent updates need to happen, they will wait until the lock is released. Full example here.


text:
Q: "error with web service Android ksoap2 object reference not set to a instance of a object I'm creating an app and want to send a object to a web-service and I get an error
obeject reference not set to an instance of an object. I don't know if I am sending them correctly.
I'm new in Android with ksoap.
This is what I tried:
`
public String sendPostSoap_registarContentor(String requestname ,   String soapAction) {
    System.setProperty("http.keepAlive", "false");
    SoapObject request = new SoapObject("http://tempuri.org/", requestname);//nome do metodo "ObterDadosContentor"

    Registar_Entrada_Contentor obj = new Registar_Entrada_Contentor();

    obj.Tipo= Tipo;
    obj.IdContentor= IdContentor;
    obj.IdEstadoContentor= IdEstadoContentor;
    obj.IdNavio= IdNavio;
    obj.IdTipoMovimentacao= IdTipoMovimentacao;
    obj.IdTipoTrafego= IdTipoTrafego;
    obj.IdDimensaoContentor= IdDimensaoContentor;
    obj.Localizacoes= Localizacoes;
    obj.NumeroEscala=null;
    obj.NumeroListaDesembarque=null;
    obj.NumeroGuiaEntrada=null;

    PropertyInfo pro = new PropertyInfo();
    pro.setName("obj");
    pro.setValue(obj);
    pro.setType(obj.getClass());
    request.addProperty(pro);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.implicitTypes = true;
    envelope.setOutputSoapObject(request);
    envelope.dotNet = true;
    envelope.addMapping("http://tempuri.org/","obj",new Registar_Entrada_Contentor().getClass() );

    HttpTransportSE httpTransport = new HttpTransportSE("http://172.16.0.36/GestaoParqueQUAL/Service/ParqueContentorService.asmx");
    httpTransport.debug = true;

    String result = null;
    String resultado = null;

    try {
        httpTransport.call(soapAction, envelope); //metodo recebe soap action e o metodo "http://tempuri.org/ObterDadosContentor"
    } catch (HttpResponseException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (XmlPullParserException e) {
        e.printStackTrace();
    }

    try {

          //resultado = envelope.getResponse().toString();
        Object results = envelope.getResponse();
        result = results.toString();

        String x = null;

    } catch (SoapFault e) {
        e.printStackTrace();
    }

    return result;

}

`
I expect the output to be a json whitretorno:true,Mensagem: okbecause the obj is populate, but the actual output of the json return ```retorno:false,Mensagem: the object reference is not set to an instance of an object`.

A: the object arrived in webservice with all null values. I solve the problem i needet to create  a object with implements KvmSerializable


text:
Q: Using Deriving Via with Phantom Types Apologies for the long repro but I haven't been able to make it any shorter. The following code compiles fine until the last line:
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
{-# LANGUAGE DerivingVia, DerivingStrategies, StandaloneDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Repro where

import Prelude hiding ((+))

class (Additive a) where
    (+) :: a -> a -> a

data Vector2D u = Vector2D {
    x :: u,
    y :: u
}

addVector2 :: (Additive a) => Vector2D a -> Vector2D a -> Vector2D a
addVector2 Vector2D { x = x1, y = y1 } (Vector2D { x = x2, y = y2 }) =
    Vector2D { x = x1 + x2, y = y1 + y2 }

instance (Additive a) => Additive (Vector2D a) where
    (+) = addVector2

newtype Phantom1 d a = Phantom1 (Vector2D a) --Axial

deriving via (Vector2D a) instance forall d . (Additive a) => (Additive (Phantom1 d a))

data Via a b = Via a

class IsoEvidence a b where
    convertTo :: a -> b
    convertFrom :: b -> a

instance forall a b . (IsoEvidence a b, Additive b) => (Additive (Via a b)) where
    (Via x) + (Via y) = Via $ convertFrom $ (convertTo x :: b) + (convertTo y :: b)

newtype Phantom2 d a = Phantom2 (Vector2D a) --Offset

instance (IsoEvidence (Phantom1 d a) (Phantom2 d a)) where
    convertTo (Phantom1 x) = Phantom2 x
    convertFrom (Phantom2 x) = Phantom1 x

deriving via (Via (Phantom2 d a) (Phantom1 d a))
    instance (Additive a, IsoEvidence (Phantom1 d a) (Phantom2 d a)) =>
        (Additive (Phantom2 d a))

After that I get the following error:

*

*Couldn't match representation of type Vector2D a
          with that of Via (Phantom2 d a) (Phantom1 d a)
Which seems to be saying it can't coerce "Via &c" to "Vector2D a", which is odd because it's literally a newtype two levels deep and that works fine.
What am I doing wrong here?

A: DerivingVia works through newtypes, but you wrote
data Via a b = Via a   -- should be newtype


text:
Q: Is there a tool that will explain what each symbol in a Scala program means and how it is parsed? I'm trying to learn Scala and am confused by the terse syntax and difficult-to-search operators, methods, and implicit. Other terse languages have tools like https://regexr.com/ or  Take the following program:
object SampleMain {

  val sample: Parser[Sample] =
    ^(
      strOption(long("hello"), metavar("TARGET"), help("Target for the greeting")),
      switch(long("quiet"), help("Whether to be quiet"))
    )(Sample.apply)

  def greet(s: Sample): Unit = s match {
    case Sample(h, false) => println("Hello, " ++ h)
    case _ =>
  }

  def main(args: Array[String]) {
    val opts = info(sample <*> helper,
      progDesc("Print a greeting for TARGET"),
      header("hello - a test for scala-optparse-applicative"))
    greet(execParser(args, "SampleMain", opts))
  }

}

I'd to be able to hover over ^, <*>, or other symbols and have the tool show me the documentation for them.

A: Those are not standard Scala symbols, so you need to look at the documentation for the library that provides them. It will be imported somewhere at the top of the file.
IntelliJ IDEA will give you information if you hover over the symbol with ALT pressed, and take you to the library if you ALT click on it. There should be some basic documentation in the code.


text:
Q: wifi options not being set to disable power / how to reload wifi setting changes without rebooting My wifi options are not being set to disable power save / how to reload wifi setting changes without rebooting.  I'm using a intel 7260ac card
I change the parameter in my iwlwifi.conf file with
options iwlwifi power_save=2 and also type in sudo iwconfig wlp3s0 power off at the terminal screen but my power_save option always says enabled.
parm:           power_save:enable WiFi power management (default: disable) (bool)
$ modinfo iwlwifi | grep -v 'pci:' | grep -v 'iwlwifi-'

$ modinfo iwlwifi | grep -v 'pci:' | grep -v 'iwlwifi-'
filename:       /lib/modules/4.8.0-41-generic/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko
license:        GPL
author:         Copyright(c) 2003- 2015 Intel Corporation <linuxwifi@intel.com>
description:    Intel(R) Wireless WiFi driver for Linux
srcversion:     E7651FD3D9AF45F96CD8B2E
depends:        cfg80211
intree:         Y
vermagic:       4.8.0-41-generic SMP mod_unload modversions
parm:           swcrypto:using crypto in software (default 0 [hardware]) (int)
parm:           11n_disable:disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX (uint)
parm:           amsdu_size:amsdu size 0: 12K for multi Rx queue devices, 4K for other devices 1:4K 2:8K 3:12K (default 0) (int)
parm:           fw_restart:restart firmware in case of error (default true) (bool)
parm:           antenna_coupling:specify antenna coupling in dB (default: 0 dB) (int)
parm:           nvm_file:NVM file name (charp)
parm:           d0i3_disable:disable d0i3 functionality (default: Y) (bool)
parm:           lar_disable:disable LAR functionality (default: N) (bool)
parm:           uapsd_disable:disable U-APSD functionality bitmap 1: BSS 2: P2P Client (default: 3) (uint)
parm:           bt_coex_active:enable wifi/bt co-exist (default: enable) (bool)
parm:           led_mode:0=system default, 1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0) (int)
parm:           power_save:enable WiFi power management (default: disable) (bool)
parm:           power_level:default power save level (range from 1 - 5, default: 1) (int)
parm:           fw_monitor:firmware monitor - to debug FW (default: false - needs lots of memory) (bool)
parm:           d0i3_timeout:Timeout to D0i3 entry when idle (ms) (uint)
parm:           disable_11ac:Disable VHT capabilities (default: false) (bool)
$

$ uname -a
Linux sys76 4.8.0-41-generic #44~16.04.1-Ubuntu SMP Fri Mar 3 17:11:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

$ iwconfig
lo        no wireless extensions.

enp4s0f2  no wireless extensions.

wlp3s0    IEEE 802.11  ESSID:"2.4ghz"
          Mode:Managed  Frequency:2.437 GHz  Access Point: E0:3F:49:93:3F:10
          Bit Rate=144.4 Mb/s   Tx-Power=22 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=60/70  Signal level=-50 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:6  Invalid misc:248   Missed beacon:0

And is there way to restart wifi and have the changes take place if I make changes to the iwlwifi.conf file without rebooting?

A: Use
sudo sed -i 's/wifi.powersave = 3/wifi.powersave = 2/' /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
to disable power management for wifi.  Reboot and the power management should remain off.  The results of modinfo iwlwifi does not reflect any changes made by module options in the /etc/modprobe.d/ conf files use

grep [[:alnum:]] /sys/module/iwlwifi/parameters/*

To see those changes
Changes to the conf file can be loaded by removing and reinstalling the driver
sudo modprobe -r iwlwifi wait ten seconds and sudo modprobe iwlwifi


text:
Q: Derivation of geometric mean? It is given the geometric mean:
$$f(x) =(\prod_{i=1}^{k}x_i)^{1/k}$$ on $R_{++}$
The first derivation is a chain rule:
$f'(x)=\frac{1}{k}(\prod_{i=1}^{k}x_i)^{\frac{1}{k}-1} \cdot (\text{inner derivation})$
How do I do the inner derivation: $\frac{d}{dx}\left(\prod_{i=1}^{k}x_i\right)$?

A: It must be a multivariable ($k$-variable) function:
$$f(x)=f(x_1,x_2,\cdots,x_k)=\left(\prod_{i=1}^k x_i \right)^{1/k}.$$
You can take a partial derivative:
$$f_{x_i}=\frac{1}{k}\cdot x_i^{\frac{1}{k}-1} \prod_{j=1, j\ne i}^k x_j.$$
For example: $f(x_1,x_2,x_3)=(x_1x_2x_3)^{1/3}:$
$$f_{x_1}=\frac13 x_1^{1/3-1}\cdot x_2^{1/3}x_3^{1/3}$$


text:
Q: Resolve Hostname Error When Accessing Subversion I get the an error when attempting to do the following commands in Subversion:
update, commit, log, list, blame etc.
However, diff and info work.
The error is the following when using any desktop client, e.g. CollabNet, TortoiseSVN, Intellij, Visual Studio's AnkhSVN:
"http://xxx01/comm/JavaService/trunk/: Could not resolve hostname
`http://xxx01/comm': The requested name is valid and was found in the
database, but it does not have the correct associated data being
resolved for."
This only occurs on my laptop (not colleagues) and only started occurring this week after
administrators changed the password for the account Subversion uses to authenticate. The error does not occur when I'm using remote desktop to another machine or accessing subversion via the web.
Thanks in advance for any help in resolving this issue.

A: It sounds like your proxy server settings need to be updated.  Subversion keeps all of these settings in a text file named "servers" (no extension).
In Windows, this file is located in %APPDATA%/Subversion/ (e.g. C:\Documents and Settings\YourUserName\Application Data\Subversion).
1) Open "servers" and make sure that all data for your proxy server is correct.  There should be directions in the file on how to change your password, but it will involve changing these lines:
[GLOBAL]:
http-proxy-host = proxyserver.example.com
http-proxy-port = 80
http-proxy-username = yourusername
http-proxy-password = yourpassword

2) Also, sometimes Tortoise SVN keeps active an incorrect proxy setting.  If you have Tortoise installed, whether or not you're using it (especially if you're using Subclipse): open the Tortoise Settings GUI, navigate to 'Network' and make sure the settings are correct under 'Enable Proxy Server'.

A: It seems that you have a default domain in your desktop settings, compare the output of
nslookup xxx01 from your desktop and laptop. You could also use a fully qualified name like xxx01.acme.com in your SVN URL.

A: From Windows Sockets Error Codes:

The requested name is valid and was found in the database, but it does
  not have the correct associated data
  being resolved for, e.g. an MX record
  is returned but no A record -
  indicating the host itself exists, but
  is not directly reachable.

Sometimes after some changes to hostnames it requires several reboots
(or a few hours waiting) until those changes fully are used (due to
caching).
Or there might be a firewall/proxy/virus scanner interferring.

A: I tried everything to resolve this issue. I did find some malware on my machine a corrupt file, but none of this resolve the issue. In the end, I recored the machine, reinstalled TortoiseSVN ... and voila! It fixed the problem ;-)

A: Recently I ran into this issue, probably because some .svn files were corrupt. I created a new folder and let the tortoisesvn check out the whole version. It works.


text:
Q: WP MashShare Plugin breaks my site when enabled When I activate the Mashshare plugin, it gives me the following error when browsing the website like below:
Fatal error: Class 'WPChromePHP' not found in D:\home\site\wwwroot\wp-content\plugins\mashsharer\includes\debug\classes\MashDebug.class.php on line 238

I'm using the Mashshare plugin on my website running on WordPress 4.7.5, PHP 5.6, hosted in Azure Webapps.
Anyone have faced it before or knows how to fix?


text:
Q: Map objects without overwriting existing one in React I have this code which every time, when button is clicked should filter product by entered value by user. This part works fine, but every time I try to add another product, it overwrites already mapped value. But I need to keep all entered products in the setLoadedProducts state.
  const [loadedProducts, setLoadedProducts] = useState([]);
  const [expeditionProducts, setExpeditionProducts] = useState([]);

  const addProduct = () => {
    const enteredProductEan = enteredEanRef.current.value;
    const filteredExpeditionProducts = expeditionProducts.filter(
      (order_item) => {
        return order_item.ean.toString() === enteredProductEan;
      }
    );

      const loadedExpeditionProducts = filteredExpeditionProducts.map(
        (invoiceData) => {
          return invoiceData;
        }
      );
      setLoadedProducts(loadedExpeditionProducts);
      setExpeditionProducts(
        expeditionProducts.filter(function (item) {
          return !filteredExpeditionProducts.includes(item);
        })
      );

A: If you want to keep adding more products to loadedProducts without losing  what you've already saved, you can include the value of your existing loadedProducts when you update state:
const newLoadedExpeditionProducts = filteredExpeditionProducts.map(
  (invoiceData) => {
    return invoiceData;
  }
);

setLoadedProducts(loadedProducts => [...loadedProducts, ...newLoadedExpeditionProducts]);


text:
Q: unity crashes after git reset with no hint on what is going on I am developing a game in unity for 4 months now. today I reset my local repo to a state from a few days ago. since then, unity claims there would be "compilation errors" and offers me to open the project in "safe mode" or ignore the errors and continue to load the project. whatever I choose, unity crashes.
What I tried:

*

*Open the project by clicking "ignore" in the unity dialog. Unity suddenly starts modifying the using statements in my C# files. I have no clue as to why that is. Rider starts complaining about issues.

*Reset git to the current state again. Rider says everything is fine.

*Copy the whole folder to be able to do multiple repair attempts.

*Download the current state from Azure DevOps, overwrite everything in the project. Unity is now able to open the project in safe mode and starts complaining about missing files in the library and library / bee folder. I found the missing files in other projects and 1 on a  random git repo online that seems to mirror official sources and keeps older version.
While working through that I noticed unity started to complain about missing C# scripts. The scripts were there, but it was searching in an old location of the scripts. So I think something got reset to the old state and is stuck there :S
I moved the files including the meta files to the old location and restarted unity. Now it complained about components in library and library / bee again, so I copied the files there and unity started crashing again.

*create a new project, copy my files and the asset files in there. unity crashes

Unity crash:
Obtained 10 stack frames
0x00007ff700d33866 (Unity) AssetImportManager::Import
0x00007ff700d37b94 (Unity) ImportOutOfDateAssets
0x00007ff700d42f79 (Unity) RefreshInternalV2
0x00007ff700d4ab7f (Unity) StopAssetImportingV2Internal
0x00007ff700d384bd (Unity) InitialRefreshV2
0x00007ff70053d566 (Unity) Application::InitializeProject
0x00007ff7009d5495 (Unity) WinMain
0x00007ff701d9c9ae (Unity) __scrt_common_main_seh
0x00007ffbe0a326bd (KERNEL32) BaseThreadInitThunk
0x00007ffbe0cadfb8 (ntdll) RtlUserThreadStart

CrashLog: https://pastebin.com/SurWU6QT
The crash log states:
Symbol file LoadedFromMemory doesn't match image F:\prog\Unity\myProject\Library\PackageCache\com.unity.visualscripting@1.8.0\Editor\VisualScripting.Core\Dependencies\YamlDotNet\Unity.VisualScripting.YamlDotNet.dll
Symbol file LoadedFromMemory doesn't match image F:\prog\Unity\myProject\Library\PackageCache\com.unity.visualscripting@1.8.0\Editor\VisualScripting.Core\Dependencies\DotNetZip\Unity.VisualScripting.IonicZip.dll
I excluded the package cache from my git repo as I thought it's just a cache that can be rebuilt.. copying the files back seems to be an issue.
As soon as I remove the folder Library\PackageCache\com.unity.visualscripting@1.8.0 I can open the project in safe mode, but get these errors:  error CS0234: The type or namespace name 'VisualScripting' does not exist in the namespace 'Unity' (are you missing an assembly reference?)
Package manager things it's installed, but uninstalling and reinstalling the package causes unity to crash with exactly the same error as stated in the crash logs above :/
After uninstalling visual scripting and removing all (unused) references to it in my code, unity crashes on start. I have the feeling that as soon as there are no errors, it crashes. In the crash logs, it still shows the native crash and Got a UNKNOWN while executing native code. together with the Managed Stacktrace: stuff.
I'm not a professional (game) developer and completely lost here, fearing for the loss of the unity project.
can somebody please help me figure out what is going on here? I've been battling this for hours without any progess.
Is unity stuck in the old state that I initially tried to restore?
I assume a big part of the issue is that in the meantime, I upgraded unity from 2022.1.f1 to the current version 2022.2.f1. Is unity confused because of the upgrade? how do I restore a working version?
Thank you so much!!

A: As mentioned by @RetiredNinja and @PSGuy, the solution is to:

*

*git clean -fdx with Unity closed

*Doing restore tests with another local repo regularly

Also, I updated my .gitignore with the content from https://github.com/github/gitignore/blob/main/Unity.gitignore


text:
Q: Element-Wise Proofs? Prove by element-wise:
$$A \cup (B \cap C) = (A \cup B) \cap (A \cup C).$$
This is easy to prove by Venn Diagram, which I have already done. I do not, however, know how to prove using this technique. I know it has to do with proving each is a subset, but I do not understand the general method to prove this formally?

A: Proving "by element-wise" (I do hope you are translating; that's awful abuse of language) means showing that each side is a subset of the other. In other words, the argument looks something like:

Suppose $x\in A\cup(B\cap C)$; then .... stuff ...., so $x\in (A\cup B)\cap (A\cup B)$; therefore, $A\cup(B\cap C) \subseteq (A\cup B)\cap (A\cup C)$.
Now suppose that $y\in (A\cup B)\cap (A\cup C)$. Then ... stuff..., so $y\in A\cup (B\cap C)$. Therefore, $(A\cup B)\cap (A\cup C) \subseteq A\cup(B\cap C)$.
Since each is contained in the other, $A\cup(B\cap C)=(A\cup B)\cap(A\cup C)$. QED.

Or you can try to do both inclusions at the same time using equivalences. Then you would have something like

$x\in A\cup (B\cap C) \Longleftrightarrow$ stuff $\Longleftrightarrow$ more stuff $\Longleftrightarrow$ even more stuff $\Longleftrightarrow x\in (A\cup B)\cap (A\cup C)$.

In other words, "element-wise" means "chasing an element": pick an element in one side, show it has to be in the other and vice versa. After all, equality of sets is defined in terms of them containing the same elements, not in terms of Venn diagrams.

A: $(\Rightarrow)$: Suppose $x \in A \cup (B \cap C)$. Then $x \in A$ or $x \in B$ and $x \in C$. So $x \in A$ or $x \in B$ and $x \in A$ or $x \in C$. So $x \in (A \cap B) \cap (A \cup C)$.
$(\Leftarrow)$: Try this one.

A: "Element-wise" means using the definitions of an intersection and a union and an equality of sets:
$\forall x. x\in(A\cup B) \leftrightarrow x\in A\lor x\in B$
$\forall x. x\in(A\cap B) \leftrightarrow x\in A\land x\in B$
$(A=B) \leftrightarrow (\forall x.x\in A \leftrightarrow x\in B)$
Reason about $x$ which is "an element". Then the deduction rules of intuitionistic logic give you the desired theorem.


text:
Q: How to set the number of digits in Identify Features tool output for a pixel value query in QGIS 2.18 I found out that for a raster in float32 Identify Features tool reports rounded values. For example on the screenshot it reports that the pixel value is -0.3, although the real value is -0.300000011920929 (and I can see the real value using "Layer properties/Transparency/Add values from display" ). How to disable rounding in Identify Features tool? I'm using QGIS 2.18.12

A: the extra digits at the end are a bit confusing; these are due to something called single-precision floating point. As opposed to Arbitrary precision. The 'real' value is -0.3
This is a limitation of how floating point numbers are stored in a fixed-sized binary format (float 32 in your case); it's not unique to QGIS.
This page shows what's happening, if you're curious.
e.g. in python
>> import numpy as np
>> print(np.float32(-0.3))
-0.30000001

so it looks as if the problem is the other way around, perhaps the display of the transparency dialog could be changed to be more like the identify tool.


text:
Q: get status of an Arraylist in Java In my code I write a "Project" object that can contains an Arraylist of "Requirement" objects. I want to write a function that can calculate the status of my Project objects :
1) "Status" can only have 3 values : "todo", "in progress" and "done"
2) If the status of ONE requirement (in the arraylist) is "todo", the final status of the project is "todo".
3) If the status of ALL requirements is "in progress", the status of the project will be "in progress". The same thing for the last status (done).
4) If some requirements have "in progress" status while other have "done" status, the final status of the project will be "in progress". But I don't how can I write this case in the function.
I search a clean way to code this. I'm sure it's easy in Java but I'm newbie in Java and I don't feel comfortable with ArrayList.
I tried this :
@Override
public String getStatus(Project project){

    Iterator<Requirement> it = project.listRequirement.iterator();

    while (it.hasNext()) {
        Requirement s = it.next();

        if (s.getStatus()=="TODO")  return "TODO";

    //I don't know how I can write the others lines for the two others status
    }
}

Can you help me please to complete my function? Thanks

A: Your comparison logic in if (s.getStatus()=="TODO") is incorrect as you are using == to compare the Strings. You should be using equals() or equalsIgnoreCase() instead.
You can use a boolean to track the statuses. If none of your conditions gets fulfilled then you can return null from the function and handle it appropriately in your code.
Here is the corrected snippet:
@Override
public String getStatus(Project project) {
    /* Create Final Strings */
    final String TODO = "TODO";
    final String INP = "In Progress";
    final String DONE = "Done";

    /* Boolean Flag */
    boolean flag = false;

    /* Comparison Logic */
    Iterator<Requirement> it = project.listRequirement.iterator();
    while (it.hasNext()) {
        Requirement s = it.next();

        if (TODO.equalsIgnoreCase(s.getStatus())) {
            return TODO;
        } else if (INP.equalsIgnoreCase(s.getStatus())) {
            flag = true;
        }
    }

    /* Return Done */
    if(flag) return INP;
    else return DONE;
}

Also, you can use if-else or switch() to do the comparisons.

A: You can use the List method "contains" to check if a list contains a certain element.
But your logic seems incomplete: What about if the list contains status of both "DONE" and "in progess" (And no "todo")? You never specified what should be returned in that case.
To check if a List only contains status of one type, I would copy the list to a Set (A Collections that doesn't allow duplicates) and then check if that sets size is 1
so maybe something like
if(project.listRequirement.contains("TODO")) {
    return "TODO";
} else if(project.listRequirement.contains("INPROGRESS") && new HashSet<String>(project.listRequirement).size()==1) {
    return "INPROGRESS";
} else if(project.listRequirement.contains("DONE") && new HashSet<String>(project.listRequirement).size()==1) {
    return "DONE";
} else {
    // These are the cases your logic doesn't cover yet.....
}

Edit:

@PyThon I forget that. In this case, the status of the progress will be "in progress" (since the entire project is not completly done). But I don't have an idea how to program that...

Okay, so if the list looks like this ("DONE", "DONE", "INPROGRESS") the result is supposed to be "INPROGRESS"?
In that case my edited code from above:
if(project.listRequirement.contains("TODO")) {
    // list contains a todo
    return "TODO";
} else if(project.listRequirement.contains("DONE") && new HashSet<String>(project.listRequirement).size()==1) {
    // list contains no todo, and only "done" as only status
    return "DONE";
} else if(project.listRequirement.contains("INPROGRESS")) {
    // list contains no todo, but does contain in progress
    return "INPROGRESS";
} else {
    // this should never happen!
    throw new IllegalStateException();
}

A: If you use Java 8
public static String getStatus(List<Requirement> requirement) {
    if (requirement.stream().anyMatch(r -> r.getStatus().equals("TODO"))) {
        return "TODO";
    } else if (requirement.stream().allMatch(r -> r.getStatus().equals("DONE"))) {
        return "DONE";
    } else {
        return "IN PROGRESS";
    }
}

*

*If there is any TODO then it is TODO

*If all are DONE, then it is DONE

*If there are no TODO and not all are done, then some or all must be IN PROGRESS


text:
Q: C# Way to serialize List in settings containing any character (Regex/xml) I am looking for a neat/clean way to store a list of strings into a C# settings file.  As far as I can work out, you can't store List objects into these settings, so basically it needs to be converted to a string.  For example, say I have a list of names:

*

*NameA

*Name;B

*Complex, Weird, Name

*Name"nickname"Person

i.e. I am trying to demonstrate a list of names which can possibly contain any character.  Does anyone have any recommendations for a neat format + Regex to read it that can handle any character?  Or possibly an easy way to serialize a List<string>?
Currently, I am saving them as a simple command delimited string which works fine so long as you are careful with the names (can't have commas), but is destined to break down the line.

A: You can select the type of your setting entry as
System.Collections.Specialized.StringCollection

from the Properties.Settings tab.
This will be translated into your config file as something like
 <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <string>string1</string>
  <string>string2</string>
 </ArrayOfString>


text:
Q: How to set combox item visibility? i have 2 WPF comboboxes(comboboxA, comboboxB)with identical combobox item(Apple & Orange). Let say i select "Apple" in the comboboxA, then the "Apple" need to be hidden in the comboxB. If i go back to comboxA and select "Orange", "Apple" will be visible and "Orange" need to be hidden. How can i achieve that using C#?
code snippet for xaml:
    <ComboBox Name="comboboxA" >
        <ComboBoxItem Content="Apple" Name="AppleA"></ComboBoxItem>
        <ComboBoxItem Content="Orange" Name="OrangeA"></ComboBoxItem>
    </ComboBox>

    <ComboBox Name="comboboxB" >
        <ComboBoxItem Content="Apple" Name="AppleB"></ComboBoxItem>
        <ComboBoxItem Content="Orange" Name="OrangeB"></ComboBoxItem>
    </ComboBox>

A: You can use the Method that sa_ddam213 mentioned, or you can just brute force it in the SelectionChanged Event like so.
private void comboboxA_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    for (int i = 0; i <= comboboxB.Items.Count -1; i++)
    {
        if (((ComboBoxItem)(comboboxB.Items[i])).Content.ToString() == ((ComboBoxItem)comboboxA.SelectedItem).Content.ToString())
        {
            ((ComboBoxItem)(comboboxB.Items[i])).Visibility = System.Windows.Visibility.Collapsed;
        }
        else
            ((ComboBoxItem)(comboboxB.Items[i])).Visibility = System.Windows.Visibility.Visible;
    }
}

A: Maybe just filtering the selected item from list
<Window x:Class="WpfApplication6.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" Name="UI">
    <Grid>
        <ComboBox ItemsSource="{Binding ElementName=UI,Path=YourCollection}" SelectedItem="{Binding ElementName=UI,Path=SelectedItem}" Height="23" HorizontalAlignment="Left" Margin="65,61,0,0" Name="comboBox1" VerticalAlignment="Top" Width="120" />
        <ComboBox ItemsSource="{Binding ElementName=UI, Path=FilteredCollection}" Height="23" HorizontalAlignment="Left" Margin="223,61,0,0" Name="comboBox2" VerticalAlignment="Top" Width="120" />
    </Grid>
</Window>

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window, INotifyPropertyChanged
{
    private string _selectedItem;
    private ObservableCollection<string> _yourCollection = new ObservableCollection<string>();

    public MainWindow()
    {
        InitializeComponent();
        YourCollection.Add("Apple");
        YourCollection.Add("Banana");
        YourCollection.Add("Pear");
        YourCollection.Add("Orange");
        NotifyPropertyChanged("FilteredCollection");
    }

    // Collection Fro ComboBox A
    public ObservableCollection<string> YourCollection
    {
        get { return _yourCollection; }
        set { _yourCollection = value; }
    }

    // ComboBox A selected Item
    public string SelectedItem
    {
        get { return _selectedItem; }
        set
        {
            _selectedItem = value;

            // Notify the the filter collection has changed
            NotifyPropertyChanged("FilteredCollection");
        }
    }

    // Collection to show in ComboBox B
    public List<string> FilteredCollection
    {
        // Remove the selected Item
        get { return _yourCollection.Where(s => !s.Equals(_selectedItem)).ToList(); }
    }

    public event PropertyChangedEventHandler PropertyChanged;
    public void NotifyPropertyChanged(String info)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }
}

Or do you need this to work both ways


text:
Q: Removing files which are not tracked will be marked as deleted I have the following state in a git repo:
git status

On branch whatever
Your branch is ahead of 'origin/whatever' by 1 commit.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    docs/file1.docx

nothing added to commit but untracked files present (use "git add" to track)

So I will do a:
git clean -fdx

After that a git status will show the following:
On branch whatever
Your branch is ahead of 'origin/whatever' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    deleted:    docs/file1.docx

no changes added to commit (use "git add" and/or "git commit -a")

If I delete files which are not tracked how could it happen that they are marked as deleted?

A: I don't know what causes this, but I get into the same state sometimes. When it happens, I fix it by running:
git clean --force

(or git clean -f), which removes the untracked files but does not cause git to mark them as deleted.
For more information, run git help clean. It has various other flags and features that you might find helpful.


text:
Q: Why so many WM_INPUTLANGCHANGEREQUEST in my message loop? In sonme environment, my progrmae's message loop was full with WM_INPUTLANGCHANGEREQUEST , WM_INPUTLANGCHANGE and WM_IME_NOTIFY in order.
I really don't know where was the WM_INPUTLANGCHANGEREQUEST posted from. It makes the api PeekMessage(..., PM_REMOVE) always returns nonezero so that I can't do my logic in idle time.
When it happens, maxium and minium the window after some times. The message loop becomes clear. And evething goes right. Or still busy with dealing WM_INPUTLANGCHANGEREQUEST , WM_INPUTLANGCHANGE and WM_IME_NOTIFY loop.
It may happens when ime changes in the start of the programe launches.
Beg Help! Orz~~~~~。Sorry for my poor Engilsh.


text:
Q: Why do we write 'He has an MA' and not ' a MA' even though MA does not begin with a vowel? Can anybody give me anymore examples like it?
Possible Duplicate:
Do you use "a" or "an" before acronyms?

Why do we write 'He has an MA' and not ' a MA' even though MA does not begin with a vowel? Can anybody give me anymore examples like it?

A: We write "an MA" rather than "a MA" because the choice of article is decided by pronunciation and "M" is pronounced with an initial vowel sound.
Other examples:

*

*an FTP transfer

*an HMRC office

*an L-plate

*an MOT test

*an NCP car-park

*an RAC van

*an SSD device

*an X-Ray image

*an MSc in Chemistry


text:
Q: Get a count of values selected in a multi-select picklist on all contacts I have a multi-select picklist (colors__c) in my contact object (with 20 records). Let us say the picklist has 4 values (red, blue, green, yellow). And I have a separate object (object__c), which contains a field named "Count" (count__c). Here I want to display the total number of colors selected. For example, if 10 contacts selected red, 15 selected blue, 11 selected green and 6 selected yellow, then I want result to be something like this:

Color
Count

Red
10

Blue
15

Green
11

Yellow
6

How can I achieve this? Also what should be the data-type of Count.


text:
Q: Keep updating error message when validating multiple input fields I have a form that I am validating server side and adding style (red border) to make clear which fields are invalid using jQuery. At the bottom there also is a message which indicates why it is invalid.
The borders work fine, but the problem is the message at the bottom. When for example some fields are invalid and I fix them, the last error message is still always displayed.
This is because an if statement in the following code:
$("body").on("blur","input",function(e){
    e.preventDefault();
    accountform = $(".account-form").serialize();
    $.ajax({
     type:'post',
     url:"includes/updateaccount.php",
     data:({accountform: accountform}),
     success:function(data){
         var obj = JSON.parse(data);

         for (var i = 0; i < obj.length; i++) {
             var status = obj[i].status;
             var field = obj[i].field;
             if(status == 'error'){
                 var message = obj[i].message;
                    $( "#updateresult" ).show().empty().append( message );
                    $( 'input[name="' + field + '"]' ).addClass('invalid-input');
             }else if(status == 'success'){
                 $( 'input[name="' + field + '"]' ).removeClass('invalid-input');
             }
         }
     }
 });
});

This code:
if(status == 'error'){
    var message = obj[i].message;
    $( "#updateresult" ).show().empty().append( message );
    $( 'input[name="' + field + '"]' ).addClass('invalid-input');
}else if(status == 'success'){
    $( 'input[name="' + field + '"]' ).removeClass('invalid-input');
}

Does not remove the message when all is okay. This is because if one input field has status success there will be no error message at all.
I tried this :
if(status == 'error'){
    var message = obj[i].message;
    $( "#updateresult" ).show().empty().append( message );
    $( 'input[name="' + field + '"]' ).addClass('invalid-input');
}else if(status == 'success'){
    $( 'input[name="' + field + '"]' ).removeClass('invalid-input');
    $( "#updateresult" ).hide();
}

But like I said, this removes the error message because it never reaches the error status if one input field has status success.
This is an example of the JSON I am receiving:
[
    {
    "status":"error",
    "field":"voornaam",
    "message":"Vul een voornaam in"
    },
    {
    "status":"success",
    "field":"achternaam"
    },
    {
    "status":"error",
    "field":"telefoon",
    "message":"Vul een telefoonnummer in"
    },
    {
    "status":"success",
    "field":"email"
    },
    {
    "status":"success",
    "field":"huisnummer"
    },
    {
    "status":"success",
    "field":"postcode"
    },
    {
    "status":"success",
    "field":"straat"
    },
    {
    "status":"success",
    "field":"woonplaats"
    }
]


text:
Q: Excel/VBA/VBS - IE After selecting a value from drop down page not getting refreshed Based on the values from dropdown1, dropdown2 will refresh and list the values.
Whenever I'm selecting the values for the dropdown1 manually the page is getting refreshed and dropdown2 listing the values, But through code I'm unable to do it (when value selected in dropdown1 page is not getting refreshed, so the dropdown2 not listing any values).
Code sample:
Set objtag1 = objIE.Document.getelementbyId(dropdown1_objID)
objtag1.Value = "drpdwn1_value"

'After this page is not getting refreshed

Set objtag2 = objIE.Document.getelementbyId(dropdown2_objID)
objtag2.Value = "drpdwn2_value"

'in the above line code getting failed coz no values available in the dropdown

A: You will need to call the onchange event handler. objtag2.onchange

A: Set objtag1 = objIE.Document.getelementbyId(dropdown1_objID)
objtag1.Value = "drpdwn1_value"
objtag1.FireEvent ("onchange")
'here the page is  getting refreshed now
Set objtag2 = objIE.Document.getelementbyId(dropdown2_objID)
objtag2.Value = "drpdwn2_value"


text:
Q: Borland 5.5 C++ Ifstream 0xC0000005 I am doing a school project and my teacher wants it to compile in Borland 5.5. The code works quite fine in GNU GCC compiler, but here it is a mess. I tracked the error to the use of ifstream (I use it to read a .txt file), but what confuses me the most is that even instantiate ifstream crashes. I will post the entyre code and two pieces that I was testing with Ifstream.
#include <iostream>
#include <fstream>
using namespace std;

ifstream arch_paises;

int main () {
  cout << "End..." << endl;
  return 0;
}

The last line (print "End") doesnt even execute. But... if I change the ifstream position..
#include <iostream>
#include <fstream>

using namespace std;

int main () {
  ifstream arch_paises;
  cout << "End..." << endl;
  return 0;
}

The "end" is printed. Anyway the "returned -1073741819" is still there.
Here I post the entyre code of the project, as I said with the GNU GCC compiler it works perfectly. It read some data from text files and makes some calculations about the pandemic.
//------------------------------------------------------------------------------
// Librerias
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string.h>

using namespace std;

//------------------------------------------------------------------------------
// Parametros de configuracion
const short MAX_PAIS = 200;
#define n_paises "Paises.txt"
#define n_partes "ParteDiario.txt"

//------------------------------------------------------------------------------
// Posibles titulos
const string titulo[] = {"Hisopados", "Infectados" , "Recuperados", "Fallecidos"};

//------------------------------------------------------------------------------
// Estructura con informacion mundial
struct tsGlobal{
    short cp              ;                   //  Cantidad de paises
    long     poblacion    ;                   //  Poblacion mundial
    long     totales_globales[5];             //  Hisopados(1) , Infectados(2) , Recuperados(3) , Fallecidos(4)
};

//------------------------------------------------------------------------------
// Estructura utilizada para los calculos
struct datos_paises{
   char  pais[20];
   char  cont[10];
   unsigned short habs           ;
   unsigned short mensual[5][13] ; // [Hisopados(1) , Infectados(2) , Recuperados(3) , Fallecidos(4)] [mes]
   unsigned short totales[5]     ; //  Hisopados(1) , Infectados(2) , Recuperados(3) , Fallecidos(4)
};

//------------------------------------------------------------------------------
// Estructura utilizada para la lectura de los partes diarios
struct tsParDia{
    char pais[20];
    unsigned short mes;
    unsigned short dia;
    unsigned short  ch;
    unsigned short  ci;
    unsigned short  cf;
    unsigned short  cr;
};

//------------------------------------------------------------------------------
// Prototipos de modulos
void  Abrir_archivo(ifstream &paises, ifstream &partes);
void  ProcPaises(tsGlobal &i, datos_paises* tsC, ifstream &paises);
bool  LeerPaises(datos_paises* r, short index,ifstream &paises);
void  ProcParteDiarios( datos_paises* ps,tsGlobal &tsg, ifstream &partes, tsParDia tsPart);
bool  LeerParte(ifstream &partes,tsParDia &tsPart);
void  Ordenar(datos_paises* ps,int cantidad,int criterio);
void  IntCmb(datos_paises &elem1,datos_paises &elem2);
void  Listado(tsGlobal tsg,datos_paises* ps);
void  Generar_contenido_archivo(datos_paises* estructura,short tipo,tsGlobal tsg,datos_paises* ps);
void  archivo_formato(short tipo,ofstream &outfile,datos_paises* ps);
void  archivo_body(short cantidadPaises,ofstream &outfile,short tipo,datos_paises* ps);
void  archivo_footer(short tipo,ofstream &outfile, datos_paises* ps,tsGlobal tsg);
void  Cerrar_archivo(ifstream &paises, ifstream &partes);

//+=============================================================================
// Bloque principal
//
int main() {
    /*Declaracion de estructuras*/
    datos_paises ps [MAX_PAIS];
    tsParDia     tsPartes;
    tsGlobal     tsGlb;

    /*Archivos*/
    ifstream arch_paises;
    ifstream arch_partes;

    /*Abro los archivos*/
    Abrir_archivo(arch_paises, arch_partes);
    /*Proceso la informacion del archivo de paises*/
    ProcPaises(tsGlb, ps, arch_paises);
    /*Proceso la informacion del archivo de partes diarios*/
    ProcParteDiarios(ps, tsGlb, arch_partes, tsPartes);
    /*Genero el listado*/
    Listado(tsGlb,ps);
    /*Cierro los archivos*/
    Cerrar_archivo(arch_paises, arch_partes);

    return 0;
}

//+=============================================================================
// Abro los archivos para lectura
//
void Abrir_archivo(ifstream &paises, ifstream &partes){
    paises.open(n_paises);
    partes.open(n_partes);
}

//+=============================================================================
// Proceso la linea y la almaceno en la posicion indicada de la struct
//
void ProcPaises(tsGlobal &i, datos_paises* tsC, ifstream &paises){
    i.cp = 0;
    while(LeerPaises(tsC, i.cp, paises)){
        i.poblacion += tsC[i.cp].habs;
        i.cp++;
    }
}

//+=============================================================================
// Leo el archivo de paises y lo almaceno en la estructura interna
//
bool LeerPaises(datos_paises* r, short cp,ifstream &paises) {
    paises.get(r[cp].pais,21, ' ');
    paises >> ws;
    paises.get(r[cp].cont,11, ' ');
    paises >> ws;
    paises >> r[cp].habs;
    paises.ignore();

    return paises.good();
} // Leer

//+=============================================================================
// Proceso la linea del parte y la almaceno en la posicion indicada de la struct
//
void ProcParteDiarios( datos_paises* ps,tsGlobal &tsg, ifstream &partes, tsParDia tsPart){
    while(LeerParte(partes, tsPart)){
       for(int c = 0; c < tsg.cp; c ++){
            if(!strcmp(tsPart.pais,ps[c].pais)){
            ps[c].mensual[1][tsPart.mes]+= tsPart.ch;
            ps[c].totales[1]            += tsPart.ch;
            tsg.totales_globales[1]     += tsPart.ch;
            ps[c].mensual[2][tsPart.mes]+= tsPart.ci;
            ps[c].totales[2]            += tsPart.ci;
            tsg.totales_globales[2]     += tsPart.ci;
            ps[c].mensual[3][tsPart.mes]+= tsPart.cr;
            ps[c].totales[3]            += tsPart.cr;
            tsg.totales_globales[3]     += tsPart.cr;
            ps[c].mensual[4][tsPart.mes]+= tsPart.cf;
            ps[c].totales[4]            += tsPart.cf;
            tsg.totales_globales[4]     += tsPart.cf;
        }
       }
    }
}

//+=============================================================================
// Leo el archivo de partes y lo almaceno en la estructura interna
//
bool LeerParte(ifstream &partes, tsParDia &tsPart) {
    /*Nombre del pais*/
    partes.get(tsPart.pais,21, ' ');
    /*Descargo el mes*/
    partes >> tsPart.mes;
    /*Descargo el dia*/
    partes >> tsPart.dia;
    /*Descargo hisopados*/
    partes >> tsPart.ch;
    /*Descargo infectados*/
    partes >> tsPart.ci;
    /*Descargo fallecidos*/
    partes >> tsPart.cr;
    /*Descargo recuperados*/
    partes >> tsPart.cf;
    partes.ignore();
    return partes.good();
} // Leer

//+=============================================================================
// Ordena el struct en funcion de un parametro especifico
//
void Ordenar(datos_paises* ps,int cantidad,int criterio){
    bool cambios = true;
    char grupos=cantidad/2;
    while(grupos>1){
        grupos = grupos/2;
        cambios = true;
        while(cambios){
            cambios = false;
            for (char i=0;i+grupos<cantidad;i++){
                if(ps[i].totales[criterio] < ps[i+grupos].totales[criterio])
                {
                    cambios=true;
                    IntCmb(ps[i],ps[i+grupos]);
                }
            }
        }
    }
}

//+=============================================================================
// Intercambia posiciones del Struct
//
void IntCmb(datos_paises &elem1,datos_paises &elem2){
    datos_paises aux;
    aux   = elem1;
    elem1 = elem2;
    elem2 = aux;
}

//+=============================================================================
// Genero el listado de los distintos topicos y guardo en archivos
//
void  Listado(tsGlobal tsg,datos_paises* ps){
    for(int i = 1; i < 5; i++){
        Ordenar(ps,tsg.cp,i);      // Ordeno la estructura en funcion del parametro dado
        Generar_contenido_archivo(ps,i,tsg, ps);
    }
}

//+=============================================================================
// Genero el contenido de los archivos
//
void Generar_contenido_archivo(datos_paises* estructura,short tipo,tsGlobal tsg,datos_paises* ps){
    ofstream outfile;
    string nombre = "Listado" + titulo[tipo-1] + ".txt";
    outfile.open(nombre.c_str());
    archivo_formato(tipo,outfile,ps);
    archivo_body(tsg.cp,outfile,tipo,ps);
    archivo_footer(tipo,outfile,ps,tsg);
    outfile.close();
}

//+=============================================================================
// Primera parte del archivo en donde plasmo el formato solicitado por el docente
//
void  archivo_formato(short tipo,ofstream &outfile,datos_paises* ps){
   /*Titulo*/
   outfile << setw(100) << endl;
   outfile << setw(77)  << "Listado de " + titulo[tipo-1] << endl;
   /*Linea 1*/
   outfile << left << setw(10)<< "Nro.";
   outfile << left << setw(20)<< "Nombre";
   outfile << left << setw(10)<< "Cant.Hab";
   /*Linea2*/
   string auxiliar = "---------- Cantidades de "  + titulo[tipo-1]  + " por mes ----------";
   outfile << left  << setw(47)<< auxiliar;
   outfile << right << setw(6) << "Cant.";
   outfile << right << setw(15)<< "Porcentajes" <<endl;
   outfile << left  << setw(10)<< "Ord.";
   outfile << left  << setw(20)<< "Pais";
   outfile << left  << setw(10)<< "";
   outfile << left  << setw(8) << "Ene";
   outfile << left  << setw(8) << "Feb";
   outfile << left  << setw(8) << "Mar";
   outfile << left  << setw(8) << "Abr";
   outfile << left  << setw(8) << "May";
   outfile << left  << setw(8) << "Jun";
   outfile << left  << setw(7) << "Jul";
   outfile << left  << setw(10)<< "Tot." << endl;
}

//+=============================================================================
// Cuerpo del archivo... Coloco la info por pais
//
void  archivo_body(short cantidadPaises,ofstream &outfile,short tipo,datos_paises* ps){
   for(int i = 0; i < cantidadPaises ; i ++){
       outfile << left  << setw(10) << i+1;
       outfile << left  << setw(20) << ps[i].pais;
       outfile << left  << setw(10) << ps[i].habs;
       outfile << left  << setw(8)  << ps[i].mensual[tipo][1];
       outfile << left  << setw(8)  << ps[i].mensual[tipo][2];
       outfile << left  << setw(8)  << ps[i].mensual[tipo][3];
       outfile << left  << setw(8)  << ps[i].mensual[tipo][4];
       outfile << left  << setw(8)  << ps[i].mensual[tipo][5];
       outfile << left  << setw(8)  << ps[i].mensual[tipo][6];
       outfile << left  << setw(7)  << ps[i].mensual[tipo][7];
       outfile << left  << setw(10) << ps[i].totales[tipo];
       double porcentaje = ((double)ps[i].totales[tipo] / (double)ps[i].habs) * 100;
       char aux[50];
       sprintf(aux,"%.2f", porcentaje);
       outfile << right << setw(6)  << aux << "%" << endl;
   }
}

//+=============================================================================
// Coloco el footer del archivo
//
void archivo_footer(short tipo,ofstream &outfile, datos_paises* ps,tsGlobal tsg){
   string foot1 = "Cantidad total de " + titulo[tipo-1] + " a la fecha actual:";
   outfile << endl << endl << left  << foot1 << tsg.totales_globales[tipo] << endl;

   double porcentaje = ((double) tsg.totales_globales[tipo] / (double)tsg.poblacion) * 100;
   char aux[50];
   sprintf(aux,"%.2f", porcentaje);

   string foot2 = "Porcentaje de " + titulo[tipo-1];
   outfile << left  << setfill('.') << setw(foot1.length()-1) << foot2;
   outfile << right << ":" << aux << "%" ;
}

//+=============================================================================
// Cerramos los archivos de lectura
//
void  Cerrar_archivo(ifstream &paises, ifstream &partes){
    paises.close();
    partes.close();
}

The code compiles without errors or warnings but it doesnt runs properly/entirely with Boorland.
Thanks.

A: 0xC0000005 is Windows exception code for memory access violation.
One example would be writing to NULL address.
ifstream is part of C++ standard library, and each compiler provides its own implementation of it.
Borland C++ 5.5 is 20 years old and was not designed to be used with OS newer then Windows 2000.
Since according to your question the error occurs by simply instantiating ifstream, I believe the problem is somewhere within Borland's implementation of ifstream that is simply incompatible with the newer OS you are running.
You can try to run the resulting EXE in compatibility mode (if that is still available on your version of windows).
Another option may be avoiding ifstream and using the C API instead fopen, fread or using WIN32 API CreateFile and ReadFile.
Unless of course you can convince your teacher to switch compilers.


text:
Q: Getting the album link from a list of albums with Facebook Graph The json below is the response I get from the server for requesting /id/albums, but I want to use that data to get the link to the album that has all the pictures in json format. The "link" field provided is to the actual desktop site, but I need the json. How would I use the json data provided (below) to send a request to graph.facebook.com to get the pictures within the corresponding album in json format?
{
  "data": [
    {
      "id": "150228731810007",
      "from": {
        "name": "James McMahon",
        "id": "100004686423103"
      },
      "name": "Profile Pictures",
      "link": "https://www.facebook.com/album.php?fbid=150228731810007&id=100004686423103&aid=1073741831",
      "cover_photo": "150228735143340",
      "count": 2,
      "type": "profile",
      "created_time": "2013-03-15T05:29:24+0000",
      "updated_time": "2013-11-09T17:12:36+0000",
      "can_upload": false
    },
    {
      "id": "233767233456156",
      "from": {
        "name": "James McMahon",
        "id": "100004686423103"
      },
      "name": "Mobile Uploads",
      "link": "https://www.facebook.com/album.php?fbid=233767233456156&id=100004686423103&aid=1073741838",
      "type": "mobile",
      "created_time": "2013-11-09T17:12:30+0000",
      "updated_time": "2013-11-09T17:12:30+0000",
      "can_upload": false
    },
    {
      "id": "206255352874011",
      "from": {
        "name": "James McMahon",
        "id": "100004686423103"
      },
      "name": "Aug. 17th, 2013",
      "description": "Day with some of the Family",
      "link": "https://www.facebook.com/album.php?fbid=206255352874011&id=100004686423103&aid=1073741837",
      "cover_photo": "206255402874006",
      "count": 8,
      "type": "normal",
      "created_time": "2013-08-17T21:24:12+0000",
      "updated_time": "2013-08-17T21:24:36+0000",
      "can_upload": false,
      "likes": {
        "data": [
          {
            "id": "1774907390",
            "name": "Ashley Carter"
          },
          {
            "id": "646440613",
            "name": "Mitzy Lanthier"
          },
          {
            "id": "1801948293",
            "name": "Calvin Carter"
          },
          {
            "id": "100000653918655",
            "name": "Kimberly Lane Lirette"
          }
        ],
        "paging": {
          "cursors": {
            "after": "MTAwMDAwNjUzOTE4NjU1",
            "before": "MTc3NDkwNzM5MA=="
          }
        }
      }
    },
    {
      "id": "150230918476455",
      "from": {
        "name": "James McMahon",
        "id": "100004686423103"
      },
      "name": "Cover Photos",
      "link": "https://www.facebook.com/album.php?fbid=150230918476455&id=100004686423103&aid=1073741833",
      "cover_photo": "202581716574708",
      "count": 4,
      "type": "cover",
      "created_time": "2013-03-15T05:43:31+0000",
      "updated_time": "2013-08-08T17:26:35+0000",
      "can_upload": false
    },
    {
      "id": "158017154364498",
      "from": {
        "name": "James McMahon",
        "id": "100004686423103"
      },
      "name": "Timeline Photos",
      "link": "https://www.facebook.com/album.php?fbid=158017154364498&id=100004686423103&aid=1073741834",
      "cover_photo": "179650435534503",
      "count": 10,
      "type": "wall",
      "created_time": "2013-04-07T14:04:04+0000",
      "updated_time": "2013-06-12T23:28:45+0000",
      "can_upload": false
    },
    {
      "id": "178309025668644",
      "from": {
        "name": "James McMahon",
        "id": "100004686423103"
      },
      "name": "U.S.Navy D.E.P.",
      "description": "Was a pretty fun day. We were out there helping restore this World War 2 Destroyer.",
      "link": "https://www.facebook.com/album.php?fbid=178309025668644&id=100004686423103&aid=1073741835",
      "cover_photo": "178309055668641",
      "count": 4,
      "type": "normal",
      "created_time": "2013-06-10T00:32:45+0000",
      "updated_time": "2013-06-10T00:33:49+0000",
      "can_upload": false,
      "likes": {
        "data": [
          {
            "id": "100000651398529",
            "name": "Jennifer Manuel Hyatt"
          },
          {
            "id": "1801948293",
            "name": "Calvin Carter"
          },
          {
            "id": "1522740127",
            "name": "Bliss Reane Kinder"
          }
        ],
        "paging": {
          "cursors": {
            "after": "MTUyMjc0MDEyNw==",
            "before": "MTAwMDAwNjUxMzk4NTI5"
          }
        }
      }
    },
    {
      "id": "150228468476700",
      "from": {
        "name": "James McMahon",
        "id": "100004686423103"
      },
      "name": "Untitled Album",
      "description": "03112013",
      "link": "https://www.facebook.com/album.php?fbid=150228468476700&id=100004686423103&aid=1073741830",
      "cover_photo": "150228475143366",
      "count": 1,
      "type": "normal",
      "created_time": "2013-03-15T05:27:54+0000",
      "updated_time": "2013-03-15T05:28:17+0000",
      "can_upload": false
    }
  ],
  "paging": {
    "cursors": {
      "after": "MTUwMjI4NDY4NDc2NzAw",
      "before": "MTUwMjI4NzMxODEwMDA3"
    }
  }
}
Response received in 237 ms

A: You have the id field- that's the album-id
So, you can create the link by yourself, just like this-

https://graph.facebook.com/<ALBUM-ID>/photos

from this you can fetch all the photos of a particular album (but remember that you'll need the access token- of-course)

https://graph.facebook.com/<ALBUM-ID>/photos?access_token=<ACCESS-TOKEN>


text:
Q: PipedInputStream - How to avoid "java.io.IOException: Pipe broken" I have two threads. One of them writes to PipedOutputStream, another one reads from corresponding PipedInputStream. Background is that one thread is downloading some data from remote server and multiplexes it to several other threads through piped streams.
The problem is that sometimes (especially when downloading large (>50Mb) files) I get java.io.IOException: Pipe broken when trying to read from PipedInputStream.
Javadoc says that A pipe is said to be broken if a thread that was providing data bytes to the connected piped output stream is no longer alive.
It is true, my writing thread really dies after writing all his data to PipedOutputStream.
Any solutions? How can I prevent PipedInputStream from throwing this exception? I want to be able to read all data that was written to PipedOutputStream even if writing thread finished his work. (If anybody knows how to keep writing thread alive until all data will be read, this solution is also acceptable).

A: Use a java.util.concurrent.CountDownLatch, and do not end the first thread before the second one has signaled that is has finished reading from the pipe.
Update: quick and dirty code to illustrate my comment below
    final PipedInputStream pin = getInputStream();
    final PipedOutputStream pout = getOutputStream();

    final CountDownLatch latch = new CountDownLatch(1);

    InputStream in = new InputStream() {

        @Override
        public int read() throws IOException {
            return pin.read();
        }

        @Override
        public void close() throws IOException {
            super.close();
            latch.countDown();
        }
    };

    OutputStream out = new OutputStream(){

        @Override
        public void write(int b) throws IOException {
            pout.write(b);
        }

        @Override
        public void close() throws IOException {
            while(latch.getCount()!=0) {
                try {
                    latch.await();
                } catch (InterruptedException e) {
                    //too bad
                }
            }
            super.close();
        }
    };

    //give the streams to your threads, they don't know a latch ever existed
    threadOne.feed(in);
    threadTwo.feed(out);

A: Are you closing your PipedOutputStream when the thread that's using it ends? You need to do this so the bytes in it will get flushed to the corresponding PipedInputStream.

A: PipedInputStream and PipedOutputStream are broken (with regards to threading). They assume each instance is bound to a particular thread. This is bizarre. I suggest using your own (or at least a different) implementation.

A: You might encounter problems with these classes when you use more than one reader or writer thread (see JDK-4028322).
However most users likely only use one reader and one writer thread. Since this is the case for you as well, the reason why you are encountering a broken pipe is most likely that you did not close the PipedOutputStream once you are done writing.
PipedOutputStream out = new PipedOutputStream();
PipedInputStream in = new PipedInputStream(out);

// You can of course also use an Executor or similar for this
new Thread(() -> {
    // Your method writing the data
    writeDataTo(out);
    // Close PipedOutputStream so that reader knows that the end of the data
    // has been reached
    try {
        out.close();
    }
    catch (IOException e) {
        // Handle exception or simply ignore it; current implementation will NEVER
        // throw an IOException: https://github.com/openjdk/jdk/blob/0e14d5a98453407488057e6714f90f04d7dfa383/src/java.base/share/classes/java/io/PipedOutputStream.java#L174
    }
}).start();

// Your method reading the data
readDataFrom(in);
// Close PipedInputStream so that writer fails instead of blocking infinitely in case
// it tries to write again (for whatever reason)
in.close();

There is also no need to manually call PipedOutputStream.flush(), it only notifies waiting readers, but no data is lost if you directly call close().
Sadly the documentation is at the moment not very clear about all of this. In general it is not a good idea to rely on the implementation, but in this case it might be the only sensible solution:

*

*https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/io/PipedInputStream.java

*https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/io/PipedOutputStream.java


text: Q: VBA Code - how do I make a code run through a cell that is linked to other sheets with formulas? I have a workbook.  One sheet one the code I wrote works perfectly.  I added 5 more worksheets to this book since there are multiple times this can be executed.  To make life easier on myself on sheet one I made a "master chart" that holds all the information for all sheets in the book by linking that cell to the master one.  After I updated my code with the appropriate cells in the master chart I keep getting a "type mismatch" error.  It is occurring when the code reaches the first cell that is linked to a cell that has a formula calculating other cells.  Is this something that can be fixed?


text:
Q: Why pthread_create does not work 100% of the times? I am recently learning about threads in C, and I have noticed something I consider weird.
Let's take the next code:
#include <stdio.h>
#include <pthread.h>

void    *sub_routine(void *p)
{
    p = NULL;
    printf("This is a sub_routine\n");
    return (NULL);
}

int main(int argc, char **argv)
{
    void        *p;
    pthread_t   thread;

    if (argc < 1)
        return (0);
    p = argv[1];
    pthread_create(&thread, NULL, sub_routine, NULL);
    sub_routine(p);
    return (0);
}

I use this command line to compile my program:
gcc -Wall -Wextra -Werror -pthread pthreads.c

The expected result is to print This is a sub_routine two times. Well that happens but not 100% of the times. Is there any particular reason for that?

A: When main returns, it exits the program even if other threads are running. Therefore, it's possible for the thread you spawned to not get to the printf before the main thread returns, in which case the program ends before you'll see both messages.
One way to address this is to add a call to pthread_join at the end of main to tell the program to wait for the thread you created to finish running before main returns. That will ensure you always see two printouts.

A: Add pthread_join(thread, NULL) at the end (just before return) of the main thread to join the thread "sub_routine"
The modified version of your code works properly:
#include <stdio.h>
#include <pthread.h>

void    *sub_routine(void *p)
{
    p = NULL;
    printf("This is a sub_routine\n");
    return (NULL);
}

int main(int argc, char **argv)
{
    void        *p;
    pthread_t   thread;

    if (argc < 1)
        return (0);
    p = argv[1];
    pthread_create(&thread, NULL, sub_routine, NULL);
    sub_routine(p);
    pthread_join(thread, NULL);
    return (0);
}


text:
Q: Given a dataframe with event details, return a count of events that occured on any given date, based on the start and end dates of the events What I have and am trying to do:
A dataframe, with headers: event_id, location_id, start_date, end_date.
An event can only have one location, start and end.
A location can have multiple events, starts and ends, and they can overlap.
The goal here is to be able to say, given any time T, for location X, how many events were there?
E.g.
Given three events, all for location 2:

Event.
Start.
End.

Event 1
2022-05-01
2022-05-07

Event 2
2022-05-04
2022-05-10

Event 3
2022-05-02
2022-05-05

Time T.
Count of Events

2022-05-01
1

2022-05-02
2

2022-05-03
2

2022-05-04
3

2022-05-05
3

2022-05-06
2

**What I have tried so far, but got stuck on: **
((I did look at THIS possible solution for a similar problem, and I went pretty far with it, but I got lost in the itterows and how to have that apply here.))
Try to get an array or dataframe that has a 365 day date range for each location ID.
E.g.
[1,2022-01-01],[1,2022-01-02]........[98,2022-01-01][98,2022-01-02]
Then convert that array to a dataframe, and merge it with the original dataframe like:

index
location
time
event
location2
start
end

0
1
2022-01-01
1
10
2022-11-07
2022-11-12

1
1
2022-01-01
2
4
2022-02-16
2022-03-05

2
1
2022-01-01
3
99
2022-06-10
2022-06-15

3
1
2022-01-01
4
2
2021-12-31
2022-01-05

4
1
2022-01-01
5
5
2022-05-08
2022-05-22

Then perform some kind of reduction that returns the count:

location
Time
Count

1
2022-01-01
10

1
2022-01-02
3

1
2022-01-03
13

..
...
...

99
2022-01-01
4

99
2022-01-02
0

99
2022-01-03
7

99
2022-01-04
12

I've done something similar with tying events to other events where their dates overalapped, using the .loc(...) but I don't think that would work here, and I'm kind of just stumped.
Where I got stuck was creating an array that combines the location ID and date range, because they're different lengths, and I could figure out how to repeat the location ID for every date in the range.
Anyway, I am 99% positive that there is a much more efficient way of doing this, and really any help at all is greatly appreciated!!
Thank you :)

A: Update per comment
# get the min and max dates
min_date, max_date = df[['Start.', 'End.']].stack().agg([min, max])

# create a date range
date_range = pd.date_range(min_date, max_date)
# use list comprehension to get the location of dates that are between start and end
new_df = pd.DataFrame({'Date': date_range,
                       'Location': [df[df['Start.'].le(date) & df['End.'].ge(date)]['Event.'].tolist()
                                    for date in date_range]})
# get the length of each list, which is the count
new_df['Count'] = new_df['Location'].str.len()

        Date                     Location  Count
0 2022-05-01                    [Event 1]      1
1 2022-05-02           [Event 1, Event 3]      2
2 2022-05-03           [Event 1, Event 3]      2
3 2022-05-04  [Event 1, Event 2, Event 3]      3
4 2022-05-05  [Event 1, Event 2, Event 3]      3
5 2022-05-06           [Event 1, Event 2]      2
6 2022-05-07           [Event 1, Event 2]      2
7 2022-05-08                    [Event 2]      1
8 2022-05-09                    [Event 2]      1
9 2022-05-10                    [Event 2]      1

IIUC you can try something like
# get the min and max dates
min_date, max_date = df[['Start.', 'End.']].stack().agg([min, max])
# create a date range
date_range = pd.date_range(min_date, max_date)
# use list comprehension to get the count of dates that are between start and end
# df.le is less than or equal to
# df.ge is greater than or equal to
new_df = pd.DataFrame({'Date': date_range,
                       'Count': [sum(df['Start.'].le(date) & df['End.'].ge(date))
                                 for date in date_range]})

        Date  Count
0 2022-05-01      1
1 2022-05-02      2
2 2022-05-03      2
3 2022-05-04      3
4 2022-05-05      3
5 2022-05-06      2
6 2022-05-07      2
7 2022-05-08      1
8 2022-05-09      1
9 2022-05-10      1

Depending on how large your date range is we may need to take a different approach as things may get slow if you have a range of two years instead of 10 days in the example.
You can also use a custom date range if you do not want to use the min and max values from the whole frame
min_date = '2022-05-01'
max_date = '2022-05-06'
# create a date range
date_range = pd.date_range(min_date, max_date)
# use list comprehension to get the count of dates that are between start and end
new_df = pd.DataFrame({'Date': date_range,
                       'Count': [sum(df['Start.'].le(date) & df['End.'].ge(date))
                                 for date in date_range]})

        Date  Count
0 2022-05-01      1
1 2022-05-02      2
2 2022-05-03      2
3 2022-05-04      3
4 2022-05-05      3
5 2022-05-06      2

A: Note - I wanted to leave the original question up as is, and I was out of space, so I am answering my own question here, but @It_is_Chris is the real MVP.
Update! - with the enormous help from @It_is_Chris and some additional messing around, I was able to use the following code to generate the output I wanted:
# get the min and max dates
min_date, max_date = original_df[['start', 'end']].stack().agg([min, max])

# create a date range
date_range = pd.date_range(min_date, max_date)

# create location range
loc_range = original_df['location'].unique()

# create a new list that combines every date with every location
combined_list = []
for item in date_range:
    for location in loc_range:
        combined_list.append(
            {
                'Date':item,
                'location':location
            }
        )

# convert the list to a dataframe
combined_df = pd.DataFrame(combined_list)

# use merge to put original data together with the new dataframe
merged_df = pd.merge(combined_df,original_df, how="left", on="location")

# use loc to directly connect each event to a specific location and time
merged_df = merged_df.loc[(pd.to_datetime(merged_df['Date'])>=pd.to_datetime(merged_df['start'])) & (pd.to_datetime(merged_df['Date'])<=pd.to_datetime(merged_df['end']))]

# use groupby to push out a table as sought Date - Location - Count
output_merged_df = merged_df.groupby(['Date','fleet_id']).size()

The result looked like this:
Note - the sorting was not as I have it here, I believe I would need to add some additional sorting to the dataframe before outputting as a CSV.

Date
location
count

2022-01-01
1
1

2022-01-01
2
4

2022-01-01
3
1

2022-01-01
4
10

2022-01-01
5
3

2022-01-01
6
1


text:
Q: Spring Boot Maven plugin: Cannot override arguments set in pom.xml I am using the 2.7.4 version of the Spring Boot Maven plugin, and am puzzled about the behavior of arguments set in the pom.xml. Once there, it seems they cannot be overriden by specifying some on the command line.
According to the documentation

Arguments from the command line that should be passed to the application. Use spaces to separate multiple arguments and make sure to wrap multiple values between quotes. When specified, takes precedence over #arguments.

If I have this in my pom.xml:
<configuration>
  <arguments>
    <argument>--oh_hello=there</argument>
  </arguments>
</configuration>

Then I cannot override this by for example using mvn spring-boot:run -Dspring-boot.run.arguments="--hello=world".
The arguments seen when the Spring applications starts are stuck at what is specified in pom.xml. I expect to be able to override this. Am I misunderstanding, or is this a bug?
Full example on GitHub.

A: As counter-intuitive as it may seem, it's conventional for a Maven plugin to behave in this way, with configuration in the pom.xml taking precedence over command-line configuration.
The reference documentation for Spring Boot's Maven plugin recommends using a project property to allow a setting to be configured on the command line. In your case, that would look something like this:
<properties>
    <run.arguments>--hello=there</run.arguments>
</properties>

<configuration>
  <arguments>
    <argument>${run.arguments}</argument>
  </arguments>
</configuration>

mvn spring-boot:run -Drun.arguments="--hello=world"


text:
Q: Managing Intents in Dialogflow I want to know if there is some way through which I can manage, update or delete Intents in Dialogflow programmatically using python.
I have been able to send and get response from dialogflow using apiai library, but i want to be able to input intents, it's questions and the text response.
I went through dialogflow library, which i think does help with that, but it has some requirements on making account on google console clouds.
Is there a way to do what I want, without having to create/do billings or whatever it mentions in it's documentation in Dialogflow.
If there is, please point me in the right direction.
Thank you.

A: The Dialogflow API is the only way for your to programmatically update an agent's intents and entities: https://dialogflow.com/docs/reference/agent/
You will need to use a Google Account to create an agent to begin with. Billing shouldn't be needed to simply run an agent that doesn't use any other Google API's.


text:
Q: Inequality.$\sqrt{\frac{2a}{b+c}}+\sqrt{\frac{2b}{c+a}}+\sqrt{\frac{2c}{a+b}} \leq 3$
Let $a,b,c \gt 0$. Prove that (Using Cauchy-Schwarz) :
  $$\sqrt{\frac{2a}{b+c}}+\sqrt{\frac{2b}{c+a}}+\sqrt{\frac{2c}{a+b}} \leq 3$$

I tried to use Cauchy-Schwarz in the following form
$$\sqrt{Ax}+\sqrt{By}+\sqrt{Cz}\leq \sqrt{(A+B+C)(x+y+z)}\tag{1}.$$
I wrote $$\sqrt{\frac{2a}{b+c}}+\sqrt{\frac{2b}{c+a}}+\sqrt{\frac{2c}{a+b}}=\frac{\sqrt{2a(c+a)(a+b)}+\sqrt{2b(b+c)(a+b)}+\sqrt{2c(b+c)(c+a)}}{\sqrt{(a+b)(b+c)(c+a)}}.$$
and then I applied on $(1)$:
\begin{eqnarray}
A &=& 2a(c+a)   &\mbox{and}&  x=a+b;\\
B &=& 2b(a+b)   &\mbox{and}&  y=b+c;\\
C &=& 2c(b+c)   &\mbox{and}&  z=c+a ,
\end{eqnarray}
but I did not obtain anything. Thanks for your help. :)

A: Denote $$S = \sqrt{\frac{a}{b+c}} + \sqrt{\frac{b}{c+a}} + \sqrt{\frac{c}{a+b}}$$
The Inequality doesn't hold. Clearly, taking $b=c=0.05, a=5$ implies $$\sqrt{2}S>\sqrt{\frac{2a}{b+c}} = 10 > 3$$ By this method, it is easily shown that no upper bound exists.
For a lower bound, note firstly that when $a = b, c \rightarrow 0$, $S \rightarrow 2$. We'll prove that $S \ge 2$ for non negative reals $a,b,c$.
We have, $$\frac{a+b+c}{2a} = \frac 12 \left(\frac{b+c}{a} + 1 \right) \ge \sqrt{\frac{b+c}{a}} \\ \implies \sqrt{\frac{a}{b+c}} \ge \frac{2a}{a+b+c}$$ Adding up the other two similar inequalities, we get the result.

A: You got it wrong. It should be:
$$
\sqrt{\frac{2a}{a+b}}+\sqrt{\frac{2b}{b+c}}+\sqrt{\frac{2c}{c+a}} \leq 3
$$
See my comment on Inequality. $\sqrt{\frac{11a}{5a+6b}}+\sqrt{\frac{11b}{5b+6c}}+\sqrt{\frac{11c}{5c+6a}} \leq 3$ for a proof.

A: We will begin with an observation. Consider the function $$f(a,b,c)=\sqrt{\frac{2a}{b+c}}+\sqrt{\frac{2b}{c+a}}+\sqrt{\frac{2c}{a+b}} .$$ It has the property that $$f(ta,tb,tc)=f(a,b,c).$$ We may thus assume without loss of generality that $$a+b+c=1$$, by setting $$t=\frac{1}{a+b+c}.$$ Under this assumption, we may rewrite the function as $$\sqrt{\frac{2a}{1-a}}+\sqrt{\frac{2b}{1-b}}+\sqrt{\frac{2c}{1-c}}$$ If $a=1-\epsilon$ for $\epsilon>0$, $b+c=\epsilon$. Now note that in order for these square roots to be defined over the reals, then $0\leq a,b,c<1$, which means that $b,c<\epsilon$. Now for such an $\epsilon$,  $$\sqrt{\frac{2b}{1-b}}, \sqrt{\frac{2c}{1-c}}$$ are both close to zero, and $$\sqrt{\frac{2a}{1-a}}$$ is large.

A: By AM-HM, $\frac{2(a+b+c)}{3}\ge\frac{3}{\frac{1}{a+b}+\frac{1}{b+c}+\frac{1}{c+a}}$$\implies(2a+2b+2c)\left(\frac{1}{a+b}+\frac{1}{b+c}+\frac{1}{c+a}\right)\ge3^2$.
By Cauchy-Schwarz, $(2a+2b+2c)\left(\frac{1}{a+b}+\frac{1}{b+c}+\frac{1}{c+a}\right)\ge\left(\sqrt{\frac{2a}{a+b}}+\sqrt{\frac{2b}{b+c}}+\sqrt{\frac{2c}{a+c}}\right)^2$.
Thus, $\left(\sqrt{\frac{2a}{a+b}}+\sqrt{\frac{2b}{b+c}}+\sqrt{\frac{2c}{a+c}}\right)^2\le3^2$$\implies\sqrt{\frac{2a}{a+b}}+\sqrt{\frac{2b}{b+c}}+\sqrt{\frac{2c}{a+c}}\le3$.


text:
Q: Compile rygel for yocto with plugins I'm using bitbake to compile rygel for yocto from the meta-openembedded layer, with the plugins mpris and gst-launch.
As per the PACKAGECONFIG docs, I created a bbappend file and added the following:
EXTRA_OECONF = "--disable-introspection \
                --disable-tracker-plugin \
                --with-media-engine=gstreamer \
                --enable-mpris-plugin \
                --enable-gst-launch-plugin"

PR = "r1"

It compiles and installs, but has no plugins.
The append shows up when I run bitbake-layers show-appends, so at least bitbake is finding it. After running bitbake the directory tmp/work/core2-64-poky-linux/rygel/0.26.1-r1/image/usr/lib/rygel-2.6/plugins/ is populated. Then when I run the image /usr/lib/rygel-2.6/ contains an engines dir and nothing else.
Any idea where I'm going wrong?

A: I don't think your read all the way down to "If you want to change an existing PACKAGECONFIG block, you can do so one of two ways:".
From a bbappend, just do
PACKAGECONFIG_append = " mpris gst-launch"

A: In the recipe do_install, they remove some of the engines and plugins files.  This might be the reason you do not see them in your image.
do_install_append() {
       # Remove .la files for loadable modules
       rm -f ${D}/${libdir}/rygel-${LIBV}/engines/*.la
       rm -f ${D}/${libdir}/rygel-${LIBV}/plugins/*.la
}

A: your compiling plugins successfully and not able to see in board(rootfs)? if yes please add below line in your .bbappend file. '
FILES_${PN} += "${libdir}/*"
this will add all your compiled plugins to your rootfs image.


text:
Q: Get $_POST & $_REQUEST values before adding/updating post I've done this many times before, but it stopped working and I can't figure out why and haven't found a way to re-accomplish the same task.
GOAL: intercept submitted values from $_POST/$_REQUEST before saving/updating post in DB. Specifically for processing both default WP meta/tax as well as custom meta/tax.
QUESTION: How do I get the $_POST/$_REQUEST data for ALL fields when a post is created or updated in WordPress. Everything that USED TO WORK no longer does. I'd like $_POST & $_REQUEST data so that I can process front-end form submissions, admin panel submissions, and quick edits.

HOOKS TRIED:
Hooks 'pre_post_update' SHOULD work, but always returns empty array, or the generic a:1:{s:7:"_locale";s:4:"user";} that are part of the wp-admin URL query string.
Hook 'post_updated' is after submission and does give old/new values, but only for default WP meta/tax, not custom meta/tax, and it's after processing so no $_POST or $_REQUEST data.
Hook 'save_post' is after saving, so not suitable for the task.

DUMP VARS:
For every single one of these hooks, I'm saving a dump for each of these:
$post_id
$post_data
$_POST
$_GET
$_REQUEST
'php://input'

SAMPLE CODE TRIED:
pre_post_update hook:
function PPU_intercept_post_save($post_id, $post_data){
    // passed vars first
    file_put_contents('vardump.txt', serialize($post_id));
    file_put_contents('vardump.txt', PHP_EOL.serialize($post_data), FILE_APPEND);
    // rest data second
    $json_data = json_decode(file_get_contents('php://input'), true);
    file_put_contents('vardump.txt', PHP_EOL.serialize($json_data), FILE_APPEND);
    // server vars last
    file_put_contents('vardump.txt', PHP_EOL.serialize($_POST), FILE_APPEND);
    file_put_contents('vardump.txt', PHP_EOL.serialize($_GET), FILE_APPEND);
    file_put_contents('vardump.txt', PHP_EOL.serialize($_REQUEST), FILE_APPEND);
}
add_action( 'pre_post_update', 'PPU_intercept_post_save', 10, 2 );

result:
// post_id
i:118;
// post_data
a:21:{s:11:"post_author";s:1:"1";s:9:"post_date";s:19:"2022-06-08 15:45:49";s:13:"post_date_gmt";s:19:"2022-06-08 20:45:49";s:12:"post_content";s:821:"SENSITIVE_REMOVED";s:21:"post_content_filtered";s:0:"";s:10:"post_title";s:21:"SENSITIVE_REMOVED";s:12:"post_excerpt";s:0:"";s:11:"post_status";s:7:"publish";s:9:"post_type";s:13:"SENSITIVE_REMOVED";s:14:"comment_status";s:4:"open";s:11:"ping_status";s:6:"closed";s:13:"post_password";s:0:"";s:9:"post_name";s:21:"SENSITIVE_REMOVED";s:7:"to_ping";s:0:"";s:6:"pinged";s:0:"";s:13:"post_modified";s:19:"2022-06-11 12:45:20";s:17:"post_modified_gmt";s:19:"2022-06-11 17:45:20";s:11:"post_parent";i:0;s:10:"menu_order";i:0;s:14:"post_mime_type";s:0:"";s:4:"guid";s:59:"SENSITIVE_REMOVED&p=118";}
// rest data
a:2:{s:2:"id";i:118;s:7:"content";s:821:"SENSITIVE_REMOVED";}
// POST
a:0:{}
// GET
a:1:{s:7:"_locale";s:4:"user";}
// REQUEST
a:1:{s:7:"_locale";s:4:"user";}

save_post hook:
function SP_intercept_post_save( $post_id, $post_data, $update ) {
    // passed vars first
    file_put_contents('vardump.txt', serialize($post_id));
    file_put_contents('vardump.txt', PHP_EOL.serialize($post_data), FILE_APPEND);
    file_put_contents('vardump.txt', PHP_EOL.serialize($update), FILE_APPEND);
    // rest data second
    $json_data = json_decode(file_get_contents('php://input'), true);
    file_put_contents('vardump.txt', PHP_EOL.serialize($json_data), FILE_APPEND);
    // server vars last
    file_put_contents('vardump.txt', PHP_EOL.serialize($_POST), FILE_APPEND);
    file_put_contents('vardump.txt', PHP_EOL.serialize($_GET), FILE_APPEND);
    file_put_contents('vardump.txt', PHP_EOL.serialize($_REQUEST), FILE_APPEND);
}
add_action( 'save_post', 'SP_intercept_post_save', 10, 3 );

result:
// post_id
i:118;
// post_data
O:7:"WP_Post":24:{s:2:"ID";i:118;s:11:"post_author";s:1:"1";s:9:"post_date";s:19:"2022-06-08 15:45:49";s:13:"post_date_gmt";s:19:"2022-06-08 20:45:49";s:12:"post_content";s:821:"SENSITIVE_REMOVED";s:10:"post_title";s:21:"SENSITIVE_REMOVED";s:12:"post_excerpt";s:0:"";s:11:"post_status";s:7:"publish";s:14:"comment_status";s:4:"open";s:11:"ping_status";s:6:"closed";s:13:"post_password";s:0:"";s:9:"post_name";s:21:"SENSITIVE_REMOVED";s:7:"to_ping";s:0:"";s:6:"pinged";s:0:"";s:13:"post_modified";s:19:"2022-06-11 13:04:34";s:17:"post_modified_gmt";s:19:"2022-06-11 18:04:34";s:21:"post_content_filtered";s:0:"";s:11:"post_parent";i:0;s:4:"guid";s:59:"SENSITIVE_REMOVED&p=118";s:10:"menu_order";i:0;s:9:"post_type";s:13:"SENSITIVE_REMOVED";s:14:"post_mime_type";s:0:"";s:13:"comment_count";s:1:"0";s:6:"filter";s:3:"raw";}
// update
b:1;
// rest data
a:2:{s:2:"id";i:118;s:7:"content";s:821:"SENSITIVE_REMOVED";}
// POST
a:0:{}
// GET
a:1:{s:7:"_locale";s:4:"user";}
// REQUEST
a:1:{s:7:"_locale";s:4:"user";}

post_updated hook:
function PU_intercept_post_save($post_id, $post_after, $post_before){
    // passed vars first
    file_put_contents('vardump.txt', serialize($post_id));
    file_put_contents('vardump.txt', PHP_EOL.serialize($post_after), FILE_APPEND);
    file_put_contents('vardump.txt', PHP_EOL.serialize($post_before), FILE_APPEND);
    // rest data second
    $json_data = json_decode(file_get_contents('php://input'), true);
    file_put_contents('vardump.txt', PHP_EOL.serialize($json_data), FILE_APPEND);
    // server vars last
    file_put_contents('vardump.txt', PHP_EOL.serialize($_POST), FILE_APPEND);
    file_put_contents('vardump.txt', PHP_EOL.serialize($_GET), FILE_APPEND);
    file_put_contents('vardump.txt', PHP_EOL.serialize($_REQUEST), FILE_APPEND);
}
add_action( 'post_updated', 'PU_intercept_post_save', 10, 3 );

result:
// post_id
i:118;
// post_after
O:7:"WP_Post":24:{s:2:"ID";i:118;s:11:"post_author";s:1:"1";s:9:"post_date";s:19:"2022-06-08 15:45:49";s:13:"post_date_gmt";s:19:"2022-06-08 20:45:49";s:12:"post_content";s:821:"SENSITIVE_REMOVED";s:10:"post_title";s:21:"SENSITIVE_REMOVED";s:12:"post_excerpt";s:0:"";s:11:"post_status";s:7:"publish";s:14:"comment_status";s:4:"open";s:11:"ping_status";s:6:"closed";s:13:"post_password";s:0:"";s:9:"post_name";s:21:"SENSITIVE_REMOVED";s:7:"to_ping";s:0:"";s:6:"pinged";s:0:"";s:13:"post_modified";s:19:"2022-06-11 13:14:58";s:17:"post_modified_gmt";s:19:"2022-06-11 18:14:58";s:21:"post_content_filtered";s:0:"";s:11:"post_parent";i:0;s:4:"guid";s:59:"SENSITIVE_REMOVED&p=118";s:10:"menu_order";i:0;s:9:"post_type";s:13:"SENSITIVE_REMOVED";s:14:"post_mime_type";s:0:"";s:13:"comment_count";s:1:"0";s:6:"filter";s:3:"raw";}
// post_before
O:7:"WP_Post":24:{s:2:"ID";i:118;s:11:"post_author";s:1:"1";s:9:"post_date";s:19:"2022-06-08 15:45:49";s:13:"post_date_gmt";s:19:"2022-06-08 20:45:49";s:12:"post_content";s:821:"SENSITIVE_REMOVED";s:10:"post_title";s:21:"SENSITIVE_REMOVED";s:12:"post_excerpt";s:0:"";s:11:"post_status";s:7:"publish";s:14:"comment_status";s:4:"open";s:11:"ping_status";s:6:"closed";s:13:"post_password";s:0:"";s:9:"post_name";s:21:"SENSITIVE_REMOVED";s:7:"to_ping";s:0:"";s:6:"pinged";s:0:"";s:13:"post_modified";s:19:"2022-06-11 13:04:34";s:17:"post_modified_gmt";s:19:"2022-06-11 18:04:34";s:21:"post_content_filtered";s:0:"";s:11:"post_parent";i:0;s:4:"guid";s:59:"SENSITIVE_REMOVED&p=118";s:10:"menu_order";i:0;s:9:"post_type";s:13:"SENSITIVE_REMOVED";s:14:"post_mime_type";s:0:"";s:13:"comment_count";s:1:"0";s:6:"filter";s:3:"raw";}
// rest data
a:2:{s:2:"id";i:118;s:7:"content";s:821:"SENSITIVE_REMOVED";}
// POST
a:0:{}
// GET
a:1:{s:7:"_locale";s:4:"user";}
// REQUEST
a:1:{s:7:"_locale";s:4:"user";}


text:
Q: Eclipse Python Error in sitecustomize; set PYTHONVERBOSE for traceback: Brand new to python, running it in eclipse. Running the following code
print("Hello, World!")

I received this error:
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'sitecustomize'
Hello, World!

Then I tried running this line, found it in a blog site.
PYTHONVERBOSE=1 conda update --all

and got this error:
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'sitecustomize'
  File "\config\workspace\MyTestProject\src1\root\nested\example.py", line 9
    PYTHONVERBOSE=1 conda update --all
                    ^
SyntaxError: invalid syntax

Not sure where to go from here, any help would be appreciated!

A: Found answer in another post After installing Anaconda, I get constant "KeyError: 'PYTHONPATH'" messages
I changed the name of the file 'sitecustomize' and code ran without error.


text:
Q: Firebase JavaScript JQuery image link showing problem I am working on this project and I got stuck here: When I click on the button the image that was uploaded earlier should show. It shows, but only if I click on the button 2-3 times. It looks like it takes some time before i can use the storage ref.
`$(document).on("click",".edit", function(){
    var id = $(this).data('edit');
  firebase.storage().ref('Images/'+id).getDownloadURL().then(function(url){
    imgurl=url;

  });

  $(".myimg").attr("src", imgurl);

`


text:
Q: WpDataTables - View Image Directory I made a form in PHP and it has an image upload that returns the image name in MySQL, and in the Wp-admin / wordpress folder.

It is functional, so I created a column with URL Link in DataTables to redirect me to the image directory but it doesn't work.

How do I get WpDataTable to read my image directory in the Upload folder?


text:
Q: $(a\mod m)/(b\mod m) = (a/b)\mod m$? b and m are relatively prime (m is prime and $b \in \mathbb Z_m^* $). In truth, I would like to be able to get to the following point (it is a simplified example):
$\frac{ab \mod m}{b \mod m} = a \mod m$
Is it possible?

EDIT
My apologies. Thanks to Henning Malkholm I noticed I had used the wrong notation. I actually meant this:
$(ab \mod m)(b^{-1} \mod m) \equiv abb^{-1} \mod m$
$abb^{-1} \mod m \equiv (a \mod m)(bb^{-1} \mod m) \equiv (a \mod m)$
Is this valid? Again, I apologise if this seems too silly. I just don't feel secure enough to trust what I've found.

A: Let $a = 3, b = 4, m = 5$. Then
$$ab \mod m = 12 \mod 5 = 2$$
$$b \mod m = 4$$
$$a \mod m = 3$$
Thus, you can see that your assumption is not true.

A: It is possible, but it is not necessarily true.
For example, take $m=11$, $a=4$, $b=3$. Then $ab\bmod m=1$, $a\bmod m=4$ and $b\bmod m=3$, yet
$$ \frac{1}{3} \ne 4 $$

In order to extend division to modular arithmetic, what you need to do is find the modular inverse $b^{-1}$ of $b$, defined as the solution to
$$ xb \equiv 1 \pmod m$$
which is $3$.
Then you can let "$a$ divided by $b$, modulo $m$" mean $ab^{-1}\pmod m$.

A: It depends what the symbols mean. Most commonly, the $\mod m$ notation is used together with the $\equiv$ symbol meaning congruence, as in $15\equiv1\mod 7$.
However, you can also note that congruence modulo $m$ is an equivalence relation, and define $\mathbb{Z}_m$ as the set of congruence classes modulo $m$. Algebraically speaking, you get a ring, and you might write $a\bmod m$ for the equivalence class of $a$ modulo $m$. In which case, it is true by definition that $(a\bmod m)(b\bmod m)=ab\bmod m$, and you can then get the identity you ask for by dividing by $b\bmod m$ – provided that this is an invertible element of $\mathbb{Z}_m$, which is equivalent to $\gcd(b,m)=1$.
Finally, and this is somewhat more low-brow, you can define $a\bmod m$ to be the particular member of the congruence class of $a$ which is in $\{0,1,\ldots,m-1\}$. In which case, your conjecture is dead wrong, as already indicated by others.


text:
Q: Running deseq2 through rpy2 I am trying to run DEseq2 from Python using rpy2.
How should I pass the design matrix?
My script is as follows:
from numpy import *
from numpy.random import multinomial, random
from rpy2 import robjects
import rpy2.robjects.numpy2ri
robjects.numpy2ri.activate()
from rpy2.robjects.packages import importr
deseq = importr('DESeq2')

# Generate some data. 1000 genes, 10 samples
n = 1000
probabilities = random(n)
probabilities /= sum(probabilities)
data = zeros((n,10), int)
for i in range(10):
    data[:,i] = multinomial(1000000, probabilities)

# Make the data frame
d = {}
categories = ('1','2') * 5
d["key_1"] = robjects.IntVector(categories)
dataframe = robjects.DataFrame(d)

# Create the design matrix, and run DESeqDataSetFromMatrix
design = "~ key_1" # <--- I guess this is wrong
dds = deseq.DESeqDataSetFromMatrix(countData=data, colData=dataframe,design=design)

The error I am getting is
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2-2.8.5-py3.6-macosx-10.11-x86_64.egg/rpy2/rinterface/__init__.py:186: RRuntimeWarning: Error: $ operator is invalid for atomic vectors

warnings.warn(x, RRuntimeWarning)
Traceback (most recent call last):
File "testrpy.py", line 23, in <module>
dds = deseq.DESeqDataSetFromMatrix(countData=data, colData=dataf,design=design)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2-2.8.5-py3.6-macosx-10.11-x86_64.egg/rpy2/robjects/functions.py", line 178, in __call__
return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2-2.8.5-py3.6-macosx-10.11-x86_64.egg/rpy2/robjects/functions.py", line 106, in __call__
res = super(Function, self).__call__(*new_args, **new_kwargs)
rpy2.rinterface.RRuntimeError: Error: $ operator is invalid for atomic vectors

My guess is that the design argument is not correct.
Does anybody have an example of running DEseq via rpy2?
Thanks.

A: Ah ! You were almost there:
# Create the design matrix, and run DESeqDataSetFromMatrix
design = "~ key_1" # <--- I guess this is wrong

design is a string, but I guess that it should be a formula. Formulae are language objects in R.
Try with:
from rpy2.robjects import Formula
design = Formula("~ key_1")


text:
Q: Check series for convergence or divergence $$\sum_{n=1}^{\infty} \frac{2+(-3)^n}{4^n} $$
I had an idea to decompose this series into the sum of two series
$$ \sum_{n=1}^{\infty} \frac{2+(-3)^n}{4^n}  = \sum_{n=1}^{\infty} \frac{2}{4^n} + \sum_{n=1}^{\infty} \frac{(-3)^n}{4^n} $$
and already consider the convergence of each of the series.
But as far as I understand, this is not quite true, because we are changing the summation order. And it is not clear what the convergence of an ordinary series and an alternating series will tell us about convergence.
The main problem arises from the fact that
$$ \left | \frac{2+(-3)^n}{4^n} \right | \neq \frac{2+3^n}{4^n} $$
that's why I can't use the Leibniz attribute and work with it any further.
Maybe I don't understand something and then everything is just solved.

A: Your way is fine since both series converge indeed
$$ \sum_{n=1}^{\infty} \frac{2}{4^n} + \sum_{n=1}^{\infty} \frac{(-3)^n}{4^n}= 2\sum_{n=1}^{\infty} \left(\frac{1}{4}\right)^n + \sum_{n=1}^{\infty} \left(-\frac 3 4\right)^n$$
which are two geometric series.