text:
Q: Evaluate a limit using l'Hospital rule Evaluate $$\lim_{x\to0} \frac{e^x-x-1}{3(e^x-\frac{x^2}{2}-x-1)^{\frac{2}{3}}}$$
I tried to apply l'Hospital rule in order to get the limit to be equal to
$$\lim_{x\to0}\frac{e^x-1}{2(e^x-\frac{x^2}{2}-x-1)^{-\frac{1}{3}}(e^x-x-1)}$$
but the new denominator has an indeterminate form itself and by repeatedly applying l'Hospital rule, it doesn't seem to help... This is where I got stuck.

A: Use L'Hospital's Rule once to show that $$\lim_{x\to 0}\frac{e^{x}-1-x}{x^{2}}=\frac{1}{2}\tag{1}$$ and using this limit and L'Hospital's Rule once more show that $$\lim_{x\to 0}\dfrac{e^{x}-1-x-\dfrac{x^{2}}{2}}{x^{3}}=\frac{1}{6}\tag{2}$$ Now divide the numerator and denominator of the original expression (whose limit is to be evaluated here) by $x^{2}$ (for denominator write $x^{2}=(x^{3})^{2/3}$) and take limits (and use limits $(1),(2)$) to get the answer as $$\dfrac{\dfrac{1}{2}}{3\left(\dfrac{1}{6}\right) ^{2/3}}=\frac{1}{\sqrt[3]{6}}$$ One must always use certain algebraic manipulation before the application of advanced techniques like L'Hospital's Rule or Taylor series unless the question is especially suited to these techniques. Your direct application of L'Hospital's Rule only leads to complicated expressions.

A: You can use $e^x=1+x+\frac{x^2}{2}+\frac{x^3}{6}+\frac{x^4}{24}+o(x^5)$
$$\qquad{\lim_{x\to0} \frac{e^x-x-1}{3(e^x-\frac{x^2}{2}-x-1)^{\frac{2}{3}}}=\\
\lim_{x\to0} \frac{(1+x+\frac{x^2}{2}+\frac{x^3}{6}+\frac{x^4}{24}+o(x^5))-x-1}{3((1+x+\frac{x^2}{2}+\frac{x^3}{6}+\frac{x^4}{24}+o(x^5))-\frac{x^2}{2}-x-1)^{\frac{2}{3}}}=\\
\lim_{x\to0} \frac{(\frac{x^2}{2}+\frac{x^3}{6}+\frac{x^4}{24}+o(x^5))}{3((\frac{x^3}{6}+\frac{x^4}{24}+o(x^5)))^{\frac{2}{3}}}=\\
\lim_{x\to0} \frac{x^2(\frac{1}{2}+\frac{x}{6}+\frac{x^2}{24}+o(x^3))}{3(x^3(\frac{1}{6}+\frac{x}{24}+o(x^2)))^{\frac{2}{3}}}=\\
\lim_{x\to0} \frac{x^2(\frac{1}{2}+\frac{x}{6}+\frac{x^2}{24}+o(x^3))}{3x^{3\times\frac{2}{3}}((\frac{1}{6}+\frac{x}{24}+o(x^2)))^{\frac{2}{3}}}=\\
\lim_{x\to0} \frac{(\frac{1}{2}+\frac{x}{6}+\frac{x^2}{24}+o(x^3))}{3((\frac{1}{6}+\frac{x}{24}+o(x^2)))^{\frac{2}{3}}}=\\
 \frac{\frac{1}{2}}{3(\frac{1}{6})^{\frac{2}{3}}}}
$$

A: Using L'Hospital's rule. Note the limit can be transformed for convenience as follows:
$$L=\frac13 \sqrt[3]{\lim_{x\to 0} \frac{(e^x-x-1)^3}{(e^x-\frac{x^2}{2}-x-1)^2}}=(L'H)=$$
$$\frac13 \sqrt[3]{\lim_{x\to 0} \frac{3(e^x-x-1)^2(e^x-1)}{2(e^x-\frac{x^2}{2}-x-1)(e^x-x-1)}}=(L'H)=$$
$$\frac{1}{\sqrt[3]{18}}\cdot \sqrt[3]{\lim_{x\to 0} \frac{2e^{2x}-3e^x-xe^x+1}{e^x-x-1}}=(L'H)=$$
$$\frac{1}{\sqrt[3]{18}}\cdot \sqrt[3]{\lim_{x\to 0} \frac{4e^{2x}-4e^x-xe^x}{e^x-1}}=(L'H)=$$
$$\frac{1}{\sqrt[3]{18}}\sqrt[3]{\lim_{x\to 0} \frac{8e^{2x}-5e^x-xe^x}{e^x}}=\frac{1}{\sqrt[3]{18}} \cdot \sqrt[3]{3}=\frac{1}{\sqrt[3]{6}}.$$


text:
Q: C# send a string and Java received wrong string via Socket I have a problem when sending and receiving a string via socket. My application includes a c# client and java server. C# will send a string:
c# code:
 this.WriteByteArray(Encoding.Unicode.GetBytes(variable))
 this.WriteByteArray(Encoding.Unicode.GetBytes(value.ToString()));
 reader.ReadBoolean();

 private void WriteByteArray(byte[] buffer)
    {
        writer.Write(buffer.Length);
        if (buffer.Length > 0)
        {
            writer.Write(buffer);
        }
    }

and Java receive :
int lenght=readIntFromDotNet(reader);
        if(lenght>0)
        {
            byte[] buffer = new byte[lenght];
            reader.read(buffer, 0, lenght);
            return new String(buffer);
        }

Problem: the received string is wrong .
example: C# send "Variable" and java receive "V a r i a b l e"
What's wrong in my code?
Solved: i have used "UTF-16LE"
return new String(buffer,"UTF-16LE");

A: May be this would do the trick for you
this.WriteByteArray(variable)
reader.ReadBoolean();
void WriteByteArray(String message)
{
    byte[] buffer = Encoding.UTF8.GetBytes(message);
    AsyncCallback ac = new AsyncCallback(SendStreamMsg);
    tcpClient.GetStream().BeginWrite(buffer, 0, buffer.Length, ac, null);
}

on the Java side
Charset utf8 = Charset.forName("UTF-8");
bufferReader = new BufferedReader(new InputStreamReader(sockServer.getInputStream(),utf8));
String message = br.readLine();

redpajama_set_name: RedPajamaStackExchange


text:
Q: Java EE Multiple SessionBeans with TimerService I have a Stateless Session Bean with a TimerService.
On timeout, it starts consuming a JMS queue. In the processing of the message it requires access to an external resource which may be temporary unavailable. The timeout method calls MessageConsumer.receiveNoWait() in a loop until:

*

*There are no more messages to process: it registers a new timer= now + 10minutes. And ends.

*an error occured during the processing: it rollbacks the message and registers a new timer: now + 30minutes. And ends.

This way I'm in control when to restart and I have no sleeping threads thanks to the TimerService callback.
I would like to have multiple occurances of this session bean to anticipate bottlenecks on the queue:
                    +-----<ejb>-------+
                    | timerService    |
                    |                 |              +---------------------+
                ----| onTimeout() {}  | -----------> | external dependency |
               /    |                 |         /    +---------------------+
              /     +-----------------+        /
             /                                /
+---------+ /                                /
|||queue|||K                                /
+---------+ \                              /
             \      +-----<ejb>-------+   /
              \     | timerService    |  /
               \    |                 | /
                ----| onTimeout() {}  |
                    |                 |
                    +-----------------+

My session bean looks like this (simplified of course):
@Stateless
public class MyJob {

    @Resource
    private TimerService timerService;

    @PostConstruct
    public void init() {
        registerNewTimer(1000L); // -> problem: timerService not accessible
        System.out.println("Initial Timer created");
    }

    private void registerNewTimer(long duration) {
        TimerConfig config = new TimerConfig();
        config.setPersistent(false);
        timerService.createSingleActionTimer(duration, config);
    }

    @Timeout
    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public void execute() {
        try {
            // instantiate JMS session and consumer
            while ((message = consumer.receiveNoWait()) != null) {
                // business logic with message
                message.acknowledge();
            }
            // queue empty, let's stop for now and register a new timer + 10min
            registerNewTimer(10*60*1000);
        } catch (ResourceException re) {
            // external resource unavailable, let's wait 30min
            registerNewTimer(30*60*1000);
            // last message not acknowledged, so rolled back
        }
    }
}

I don't want to use Message Driven Beans as I would like to stay in control when to consume messages (see the delay logic in case of errors).
The problem:
The error is in the @PostConstruct annotated init() method: at this moment it is not allowed to use the timerService. It is allowed when I make the sessionbean @Singleton but then I lose the possibility to process the queue in parallel. Does anyone has an idea how to solve this ? If TimerService is not the right mechanism, what can be an alternative. Is there a PostConstruct alternative which allows access to the referenced resources and is only called once after instantiation ?
Thanks in advance for any constructive information.

A: I've found a solution myself so I post it here so it may help others.
I added a new Singleton,Startup bean which holds a list of all beans implementing the MyJobExecutor interface thanks to CDI. In a JEE environment, CDI works well with EJBs and so it injects session beans! Warning: CDI will only inject classes which directly implement MyJobExecutor so it does not work if you have an abstract class implementing MyJobExecutor and a concrete bean extending from this abstract class. It must explicitly implements MyJobExecutor.
In the postconstruct of the startup class, I call every MyJobExecutor bean to register a new timer in its TimerService. This way I can create the first singleActionTimer(s) for every session bean.
public interface MyJobExecutor {
    // how many timers to register for this bean meaning how many parallel processes.
    public int nrOfParallellInstances();
}

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;

@Singleton
@Startup
public class MyJobStartup {

    @Inject
    @Any
    private Instance<MyJobExecutor> myJobs;

    @PostConstruct
    public void startIt() {
        for (MyJobExecutor ajob : myJobs) {
            for(int i=0; i<ajob.nrOfParallellInstances(); i++)
                // register every instance with a 1 second delay between each timeout
                ajob.registerNewTimer(1000L*(i+1));
        }
    }
}

The inner loop will register multiple timers for the same bean based on the ajob.nrOfParallellInstances() value.
However, a TimerService will not trigger a timeout when the previous timeout is still running. This blocks the parallel processing as expected :(
To solve this, I adapted the timeout method to not perform the business logic itself but to launch a managed thread which performs the business logic. This way the onTimeout method quickly ends and the timer service will launch the next timeout resulting in multiple parallel executions (each in a managed thread):
import javax.enterprise.concurrent.ManagedThreadFactory;
import javax.naming.InitialContext;

@Resource(name = "concurrent/AsyncJobThreadFactory")
private ManagedThreadFactory threadFactory;

@Timeout
private void onTimeout(Timer timer) {
    LOG.info("Timeout triggered for " + timer.getInfo());
    Thread thread = threadFactory.newThread(new AsyncExecRunnable((String) timer.getInfo()));
    if (thread != null) {
        thread.start();
    } else {
        LOG.warn("No thread available for this job. Retry in 5 minutes.");
        registerNewTimer(1000L * 60 * 5);
    }

}
private static class AsyncExecRunnable implements Runnable {

    private String extra info;

    public AsyncExecRunnable(String info) {
        this.info = info;
    }

    @Override
    public void run() {
        try {
            LOG.info("Job executor thread started for " + info);
            InitialContext ic=new InitialContext();
            // business logic. With ic you can lookup other EJBs
        } catch (Exception e) {
            LOG.error("Problem executing AsyncJobExecutor:", e);
        }
    }
}

With this setup I have:

*

*automatic registration of the first timer at deployment for all Session beans which implement the MyJobExecutor interface.

*posibility to register multiple timers with the same time and they will be running in parallel.

*By using a ManagedThreadFactory, also the threads have access to the JNDI context and can lookup EJBs.


text:
Q: Android Studio assert not working I'm calling findViewById and Android Studio (version 3.1, stable) prompts me to put an assertion:

When I select it, it adds the following line above the selected line:
assert v != null;
Great. I run the app, and the View v is null. However, assertion doesn't work and it jumps to the line below it in debugger:

How is this even possible? It was Android Studio's own suggestion, and I didn't change a thing. Its own recommendation/autogenerated code is not working. Am I missing something obvious?

A: Apparently, (as stated in the comments) assertions are disabled by default but encouraged by Android Studio.
In this manner, the "problem" can be classified as a misleading UX issue rather than a technical problem.


text:
Q: How to disable panel resize/dragging? I have Ubuntu 16.04.2 LTS running Xfce 4.12. The panel resizes/drags everything horizontally depending the amount of apps open. How do I disable this? For example, if I have 1 or 2 windows open I have the clock at the middle of the panel, If I open more windows the clock and every other thing gets dragged to the right until the bar is at max width. I got some screenshots just in case.
Screenshot 1
Screenshot 2

A: This looks like a problem I've had before....
Anyway,
You might be missing a Separator...

*

*Right click your panel and select panel preferences

*Click on the "Items" Tab

*If you don't see a separator between "Window buttons" and "Workspace switcher,"(or whatever they're called...) Click on the Plus sign. Otherwise, skip to the bottom.

*Look for the separator.

*Add it.

Now, to put it between the Window Buttons and the Workspace Switcher items, use the up and down arrows at the right side of the window. Next, click on the gear (you must have your new Separator selected). In the small window, change the style to "Transparent," and then click expand.
You're done!


text: Q: Commutability to prove one matrix represented as polynomial of another For two square matrices $A$ and $B$. If $B$ commutes with all the matrices that commutes with $A$, prove that $B$ can be represented as a polynomial of $A$. It is very complicated if we do it by matrix analysis directly. Can someone give me an easy prove in some special algebraic way?


text:
Q: Why my browser breaks up in the beginning of the test? I am having problems starting TestCafé on my Windows 10 machine. As soon as I start the test, the browser pops up and then closes again with the following error message:
TypeError: Cannot read properties of null (reading 'tests')
at LiveModeRunner._finishPreviousTestRuns (C:\Users…\test-runner.js:149:38)
at LiveModeRunner.runTests (C:\Users…\test-runner.js:36:21)
at C:\Users…\test-runner.js:111:30
at processTicksAndRejections (node:internal/process/task_queues:96:5)
ERROR Was unable to open the browser "chrome:" due to error.
Error: spawn UNKNOWN
at ChildProcess.spawn (node:internal/child_process:413:11)
at spawn (node:child_process:700:9)
at execFile (node:child_process:327:17)
at C:\Users…\index.js:29:7
at invokeResolver (C:\Users…\testcafe\node_modules\pinkie\index.js:44:3)
at new Promise (C:\Users…\testcafe\node_modules\pinkie\index.js:181:2)
at C:\Users…\testcafe\node_modules\pify\index.js:12:10
at ret (C:\Users…\testcafe\node_modules\pify\index.js:56:34)
at Object.execFile (C:\Users…\testcafe\node_modules\testcafe-browser-tools\src\utils\exec.js:121:22)
at runFindWindowBinary (C:\Users…\testcafe\node_modules\testcafe-browser-tools\src\api\find-window.js:23:22)
I work in a special environment. On Windows 7 everything works fine, however I have problems with Windows 10
Version:
TestCafé: 1.9.4
Windows 10: 1809
Node.js: 16.15.0
Chrome: 103.0.5060.53
Firefox: 91.11.0esr (64-Bit)
Commandline:
${env:NODE_OPTIONS}='–require "c:/Program Files/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js" --max-http-header-size=640000 --inspect-publish-uid=http'; ${env:VSCODE_INSPECTOR_OPTIONS}='{"inspectorIpc":"\.\pipe\node-cdp.2508-1.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\Program Files\nodejs\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\Users\…\AppData\Local\Temp\node-debug-callback-ecd154ca5b61a763"}'; & 'C:\Program Files\nodejs\node.exe' '…\node_modules\testcafe\bin\testcafe.js' '–live' 'chrome' '–skip-js-errors' 'c:\Users…\debugTest.ts'


text:
Q: What use is the INVD instruction? The x86 INVD invalidates the cache hierarchy without writing the contents back to memory, apparently.
I'm curious, what use is such an instruction? Given how one has very little control over what data may be in the various cache levels and even less control over what may have already been flushed asynchronously, it seems to be little more than a way to make sure you just don't know what data is held in memory anymore.

A: Excellent question!
One use-case for such a blunt-acting instruction as invd is in specialized or very-early-bootstrap code, such as when the presence or absence of RAM has not yet been verified. Since we might not know whether RAM is present, its size, or even if particular parts of it function properly, or we might not want to rely on it, it's sometimes useful for the CPU to program part of its own cache to operate as RAM and use it as such. This is called Cache-as-RAM (CAR). During setup of CAR, while using CAR, and during teardown of CAR mode, the kernel must ensure nothing is ever written out from that cache to memory.
Cache-as-RAM
Entering CAR
To set up CAR, the CPU must be set to No-Fill Cache Mode and must designate the memory range to be used for CAR as Write-Back. This can be done by the following steps:

*

*Set up an MTRR (Memory Type Range Register) to designate a chunk of memory as WB (Write-Back).

*invd the entire cache, preventing any cached write from being written out and causing chaos.

*Set caching mode to Normal Cache Mode (cr0.CD=0).

*While in Normal Cache Mode, "touch" all cachelines of the memory span to be used as CAR by reading it, and thus filling the cache with it. Filling cachelines can only be done in Normal Cache Mode.

*Set caching mode to No-Fill Cache Mode (cr0.CD=1).

Using CAR
The motivation for setting up CAR is that once set up, all accesses (read/write) within the CAR region will hit cache and will not hit RAM, yet the cache's contents will be addressable and act just like RAM. Therefore, instead of writing assembler code that only ever uses registers, one can now use normal C code, provided that the stack and local/global variables it accesses are restricted to within the CAR region.
Exiting CAR
When CAR is exited, it would be a bad thing for all of the memory writes incurred in this "pseudo-RAM" to suddenly shoot out from cache and trash any actual content at the same address in RAM. So when CAR is exited, once again invd is used to completely delete the contents of the CAR region, and then Normal Cache Mode is set up.
Intel 80486 Manual
Intel alluded to the Cache-as-RAM use in the i486 Microprocessor Programmer's Reference Manual. The Intel 80486 was the CPU that first introduced the invd instruction. Section 12.2 read:

12.2 OPERATION OF THE INTERNAL CACHE
Software controls the operating mode of the cache. Caching can be enabled (its state following reset initialization), caching can be disabled while valid cache lines exist (a mode in which the cache acts like a  fast, internal RAM), or caching can be fully disabled.
Precautions must be followed when disabling the cache. Whenever CD is set to 1, the i486 processor will not read external memory if a copy is still in the cache. Whenever NW is set to 1, the i486 processor will not write to external memory if the data is in the cache. This means stale data can develop in the i486 CPU cache. This stale data will not be written to external memory if NW is later set to 0 or that cache line is later overwritten as a result of a cache miss. In general, the cache should be flushed when disabled.
It is possible to freeze data in the cache by loading it using test registers while CD and NW are set. This is useful to provide guaranteed cache hits for time critical interrupt code and data.
Note that all segments should start on 16 byte boundaries to allow programs to align code/data in cache lines.

Examples of Usage
coreboot has a slide-deck presenting their implementation of CAR, which describes the above procedure. The invd instruction is used on Slide 21.
AMD calls it Cache-as-general-storage in §2.3.3: Using L2 Cache as General Storage During Boot.
Other Uses
In certain situations involving cache-incoherency due to DMA (Direct Memory Access) hardware, invd might also prove useful.

A: To elaborate on IwillnotexistIdonotexists answer about CAR:
I think how it's actually done is

*

*Set up a WB MTRR (and not PAT because paging has to be disabled; PAT operates in the PMH and MTRR operates in load / store buffer or L1d) to cover the desired CAR space. The CAR range I think needs to be mapped in the SAD correctly and there needs to be a backing store – In this case, it makes sense to use the address range which is mapped to the SPI flash and that the code is actually at, then you only need to read it into the cache. You could have this range UC and read it into the cache and then write it to the WB range mapped to somewhere else – there may not need to be a physical device backing, but there does need to be a mapping in the SAD otherwise you might get an MCA either any time it hits the L3 or only when it needs to access the backing store. You do actually need to bring in valid lines from that address range in the first place before switching to CAR mode (unless you can perform a no RFO write to the range such that it doesn't need to bring in any lines, and rep stos is supposed to use a no-RFO protocol like ItoM, I.e. it only sends an invalidate and not an RFO), so I would think it needs to be mapped to an actual device, like SPI flash, because when reading from a device that has a mapping in the SAD but there is no receiving device when it gets to the IIO or the IMC, you'd get an MCA I think. If you actually get 0s when doing this, or use rep stos, then it would be a possible alternative.

*You don't need to INVD the cache unless you know there is something in the cache that will be taking up unnecessary space, which is typically not the case at the stage of boot before the memory controller and RAM memory map has been configured.

*Read the data into the cache

*CR0.CD = 1. You're probably only disabling cache on the BSP, so you'll only be disabling the L1 and L2 by doing this (I don't know whether it disables the L2 for just that logical core or both, I think just that logical core, because I believe CD=1 is a property of the load/store itself within the store buffer, and it doesn't evict anything for that load/store). Evictions will never occur to L3 because the cache is not filled in CAR mode, but you might get a hit on something that was pushed to L3 during the write before CAR was enabled. L3 can't be disabled as there are no ia32_misc_enables and will function normally but it's a possibility that the core can inform the L3 slice CBo that it is operating in no fill cache mode, and won't fill the L3 on a miss. Alternatively, it might bypass the L3 entirely by issuing an UC request to the Cbo. I don't know whether cache coherency is maintained for writes hits, and whether coherent requests from other cores are handled, but a couple of sources claim this is the case, but this is irrelevant when you know only the BSP is active. If it does hit in a lower cache then it doesn't bring it up higher.

*In CAR, read hits will read from the cache line, read misses will read from memory but will not fill a cache line. Write hits will write to the cache line, write misses will write to memory and not fill a cache like. This way, no evictions (from L1/L2) can ever occur and cause havoc. Using INVD during this state would effectively completely disable the cache because nothing would hit in the cache, so INVD isn't used during CAR, only at the end.

*When finished, INVD. If the CAR region is backed by SPI flash, it will not match the contents of the SPI flash 100%. It still be writing I.e. a stack over some random code, which you don't want to write back to SPI flash accidentally, so you must INVD and not WBINVD,  and if the SPI Flash rejects the write you'd get an MCA probably. The fact the instruction was introduced on 486 when the first mention of CAR was, suggests the instruction was introduced for this very purpose and I don't think there's another use case.

*CR0.CD = 0

On Intel, CAR is set up by microcode to run the Startup ACM, therefore it doesn't need a specific macroinstruction for this. INVD and CAR is however used by the ACM itself and the SEC core before the memory controller has been initialised, which of course requires the INVD macroinstruction. I'll have to check whether SEC core enables CAR or whether it's already enabled, but I do know that the IBB blocks containing the SEC + PEI are in L3.
An important thing to mention is that when you load code into the cache, you need to make sure it's pushed out of the L1d and into L2, otherwise it won't be accessible by the instruction cache. This can be achieved by loading the code then loading something larger that the size of L1d (which is shared, not statically partitioned between threads, so it needs to be larger than the full size of L1d). I think this is because L1d is not coherent with L1i, although there is something called SMC so I'm not sure to what degree that is true.


text:
Q: 64 bit FP hardware with two 32 bit FP units When a GPU claims different performance for FP64 vs FP32, does it mean it has separate circuits for FP32 and FP64? Or is it combining FP32 units into FP64 units?
I'm asking this because I'm wondering about the best way to implement FP units on an FPGA, in particular, I want to have both FP16 and FP32 capabilities.


text:
Q: Web application which runs R I have written my R script with some functions to do some calculations. On the output of my calculations, I have created plots in shiny(4 tab panels in that as of now, which is using the data specified in my global.R). Now I am trying to automate the process and deliver it to non technical users. So something like, users feed in 2 csv files in web UI and click a button in the web UI, which will then call my r scripts to do the calculations, then my server.R script should build plots on the output of it. Any similar examples? I tried different links, but nothing seems to be relevant.

*

*If I add my R script using source(**.R) and use the functions mentioned in there. Or Do I still have to save output in data folder and specify something in global.R or just use the output of the function in my plot construction?

*If I have the fileInput option in first tab in my tabpanels, how can I make stop the user from viewing the other tabs(tabs with graphs) without loading the input csv files and clicking the "Go" button?

*Can I do this whole thing in Shiny ? Or better to go for rook or some other framework which calls my r script just for calculations?


text:
Q: A redirecting site (dereferrer) like anonym.to in PHP - Check URL parameter - Security? I wand to build a simple dereferrer site like anonym.to
When you visit http://www.mydereferrer.tld/?http://www.sitename.tld you should be redirected to http://www.sitename.tld by a meta-refesh tag.
Here's what I have:
<?
if(($pos = strpos($_SERVER['REQUEST_URI'], '?')) !== false) {
    $url = trim(substr($_SERVER['REQUEST_URI'], $pos + 1));
}
if (strlen($url) > 50) {
    $url_short = substr($url, 0, 48) . "..";
} else {
    $url_short = $url;
}
?>
<!DOCTYPE html>

<meta charset="utf-8">
<?
if(!empty($url)) {
?>
<meta http-equiv="refresh" content="1; URL=<? echo $url ?>" />
<?
}
?>
<title>.. Redirecting</title>

        <?
        if (isset($url)) {
        ?>

.. Redirecting

<a href="<? echo $url; ?>"><? echo $url_short; ?>

        <?
        } else {
        ?>

.. No valid URL given

        <?
        }
        ?>

this works quite fine. But what security checks should I do?

A: What CBroe is referring to is that you just include $url and $url_short without any character escaping. Because of that you are susceptible to XSS. As a quick example assume $url is
www.google.com" /><br style="

then
<meta http-equiv="refresh" content="1; URL=<? echo $url ?>" />

gets evaluated to
<meta http-equiv="refresh" content="1; URL=www.google.com" />

OWASP has an excellent guide on how you embed untrusted data into your page.


text:
Q: Do something after check mark success icon shows? In dropzone, after an image is successfully loaded, there's a round icon with a check mark that shows to indicate things were successful. Is there an event that I can latch on to so I can do something after that icon appears and not before? I want to redirect users to another page upon successful upload but at the moment it's happening pretty much instantly as soon as I select my image using:
    init: function () {
        this.on("success", function(file, response) {
            window.location.href = 'google.com';
        });
    }

I just want to slow things down a bit, if you will.

A: If you just want to wait for a little bit to give the user a chance to see what's happening, use a timeout.
init: function () {
    this.on("success", function(file, response) {
        window.setTimeout(function() {
            window.location.href = 'http://google.com';
        }, 3000);
    });
}

A: Well... I seemed to have answered my own question for anyone who may find this later.
I used this:
    init: function () {
        this.on("uploadprogress", function(file, progress) {
            if(progress == 100) {
                window.location.href = 'http://www.google.com';
            }
        });
    }


text:
Q: ¿Cómo aumentar y disminuir el valor que hay en textview atraves de botones usando java en Android studio? hola soy nuevo en esto de la programcion en android (JAVA) queria de su gran ayuda
tengo dos botones y un textview  una para aumentar y otra restar
y quiero aumentar el numero  que hay en texto atravez de los botones
este es mi codigo
  private static int valor =1;

   TextView cantidad=view.findViewById(R.id.txtcantidad);
    Button aumentar=view.findViewById(R.id.btnaumntar);
    Button disminuir=view.findViewById(R.id.btndisminuir);

lo que no se  como aumentar o disminuir mi textview atraves de los botones
gracias por su ayuda

A: Solo agrega un listener (OnClickListener) a los botones, aumentas o disminuyes el valor de la variable. Es importante convertir a String el valor que aumentas o disminuyes usando String.valueOf(...), esto antes de agregarlo a el TextView:
    TextView cantidad=view.findViewById(R.id.txtcantidad);
    Button aumentar=view.findViewById(R.id.btnaumntar);
    Button disminuir=view.findViewById(R.id.btndisminuir)

    aumentar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            cantidad.setText(String.valueOf(++valor));

        }
    });
    disminuir.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            cantidad.setText(String.valueOf(--valor));
        }
    });


text:
Q: How to find date among different strings and convert it to correct date format? I have one problem,
I am using angularjs for the front end, so I have date picker in the directive.
<input  " + required + "  id='" + elementName + "' name='" + elementName + "' ng-model='question.answer.SelectedAnswer' readonly='' ng-click='opened=!opened' type='text' placeholder='Date'   datepicker-popup='" + format + "' is-open='opened' min-date='minDate' datepicker-options='dateOptions' close-text='Close' />

when I select a date like 17-6-1992 and sending it to DB , it's saving in DB like
2016-06-16T18:30:00.000Z instead of 17-6-1992, but when I get it back from DB I am getting it as 2016-06-16T18:30:00.000Z, but while showing it in the same input field its coming like 17-6-1992.
basically in DB its saving as the previous date but in UI its showing the correct.
why this issue is coming.
now I want to export this date as CSV in the controller. in CSV file the result coming as 2016-06-16T18:30:00.000Z . instead of this in CSV also I want to show what is showing in UI as I mentioned above.
in CSV file it should be like 17-6-1992, no date needed.
string answerString = string.Join(",", answers.Where(i => string.IsNullOrWhiteSpace(i.Answer) == false).Select(j => j.Answer).ToArray());

this is what I am using to write CSV file, I will catch all answers as the string and print it.  these answers contains that date , so I want to find which is in date format among answers and need to convert it to proper date format.

A: "Z" is kind of a unique case for DateTimes. The literal "Z" is actually part of the ISO 8601 datetime standard for UTC times. When "Z" (Zulu) is added on the end of a time, it indicates that that time is UTC, so really the literal Z is part of the time. This probably creates a few problems for the date format library in .NET, since it's actually a literal, rather than a format specifier.
You can Simply use $filter in angular to filter the date, Here is the Link
Sample code are as follows
Script.js
var app = angular.module('app', []);
app.controller('MyCtrl', function ($scope, $filter) {
    var jsonvalue = '2016-06-16T18:30:00.000Z';
    $scope.time = new Date(jsonvalue);
    $scope.parsed = $filter('date')($scope.time, "yyyy-MM-dd HH:mm:ss");
});

HTML

Actual Parsed Date

{{parsed}}

With Time

{{time | date:'dd-MM-yyyy HH:mm:ss'}}

WithOut Time

{{time | date:'dd-MM-yyyy'}}


text:
Q: I have pattern matching problem in case command in bash I usually use pattern matching in [[ command,
but I wanted to use it in case command.
#!/bin/bash
bash -version|head -1
# Test 1:
[[ apple79 == apple@(14|38|79|11) ]] && echo ok 1
# Test2:
case apple79 in apple@(14|38|79|11)) echo ok 2;; *) ;; esac

When I run the above test.sh at terminal with . command everything is normal.
. test.sh
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
ok 1
ok 2

But when I try to run it so:
./t.sh
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
ok 1
./t.sh: line 6: syntax error near unexpected token `('
./t.sh: line 6: `    case apple79 in apple@(14|38|79|11)) echo ok 2;; *) ;; esac'

I have received an error messages for the case command.
I have seen some bash pattern matching doc eg.:
https://www.linuxjournal.com/content/pattern-matching-bash
But I have no any idea for this problem.

A: The extglob option is implicitly enabled inside [[ ... ]] for pattern matching, but you need to enable it explicitly to use it with the case statement.
#!/bin/bash

shopt -s extglob

[[ apple79 == apple@(14|38|79|11) ]] && echo ok 1
case apple79 in apple@(14|38|79|11)) echo ok 2;; *) ;; esac

A: The error is most likely because you have turned on extglob option in your current shell. Because sourcing the script takes the current shell's options and extended options, it works when sourcing the script.
But when doing the ./t.sh you are launching an explicit shell which does not have the option turned on by default. Since [[ operator with == turns on extglob by default, it works for the first test but fails for the case statement. To enable the option explicitly in scripts do shopt -s extglob at the top of your script.
As you can see below the pattern works with case only if the option is enabled. Try removing -O extglob from below command and you can see it doesn't work.
bash -O extglob -c 'case apple79 in apple@(14|38|79|11)) echo ok 2;; *) ;; esac'

As far why your attempt didn't work, try adding a line shopt extglob to your t.sh and repeat your tests. You'll notice that when the script is sourced you'll see extglob         on and for the executed case get extglob         off

A: The difference is between interactive and non-interactive shell options.
By default extglob are turned off for non-interactive shells, so you can do:
bash -i t.sh

or add
shopt -s extglob

at the beginning of your script


text:
Q: Laravel verify email Actually that is my second question with the same problem. Well.
I need the private function like this:
if(email is verified){
Route::get('personal_cabinet', function () {
    return('hey you are a good person');
});
}
else{
Route::get('personal_cabinet', function () {
    return('pls verify your email address');
});
}

Someone can help me with that? I m a beginner in this framework

A: If you want to correct the same code you wrote, this helps :
 Route::get('personal_cabinet', function () {
 if(email is verified)
      return('hey you are a good person');
   else
      return('pls verify your email address');
 });

But it's better to check verification in the controller, like this :
// Route file
Route::get('personal_cabinet', 'HomeController@pcabinet');

// HomeController.php
class HomeController extends Controller
{
  public function pcabinet()
  {
      if(emailver == 1)
         return('hey you are a good person');
      else
         return('pls verify your email address');

  }
 }


text:
Q: How to add an attribute to element-centric FOR XML PATH query I'm building some HTML to be included in the body of an email and sent using sp_send_dbmail. I'd like to right-align some of the columns. Is there an easy way to do this (short of rewriting it using FOR XML EXPLICIT)?
declare @html varchar(max)

set @html = '
'

set @html +=
  cast(
    (select
      'Column1' as td, '',
      'Column2' as td, '',
      'Column3' as [td align=right] /* Would like to do something like this */
    for xml path('tr')) as varchar(max)
  )

set @html += '
'

A: This should do it. Note that you don't need to manually add the
 and
 tags to your html string. Those are given to you as part of the for xml path('tr'). You probably meant to add
 to the end instead.
declare @html varchar(max)

set @html = '
'

set @html +=
  cast(
    (select
      'Column1' as td, '',
      'Column2' as td, '',
      'right' as [td/@align], 'Column3' as td, ''
    for xml path('tr')) as varchar(max)
  )

set @html += '
'

select @html

Output is:

Column1	Column2	Column3


text:
Q: Django queryset in multiple tables I have this kind of query using PostgreSQL:
SELECT
tbl_project_lu.project_id,
tbl_project_lu.house_id,
tbl_project_lu.project_name AS project,
tbl_house_lu.house_name,
tbl_project_lu.description,
tbl_house_mbr.person_id
FROM ((tbl_house_lu INNER JOIN tbl_house_mbr ON tbl_house_lu.house_id = tbl_house_mbr.house_id)
  INNER JOIN tbl_project_lu ON tbl_house_lu.house_id = tbl_project_lu.house_id)
  INNER JOIN tbl_proj_mbr ON (tbl_project_lu.project_id = tbl_proj_mbr.project_id)
  AND (tbl_house_mbr.house_mbr_id = tbl_proj_mbr.house_mbr_id)
WHERE person_id = 'foo';

Here's the model.py:
class tbl_house_lu(models.Model):
    house_name =    models.CharField(max_length=30, null=False)
    house_id =      models.AutoField(primary_key=True, null=False)

class tbl_house_mbr(models.Model):
    house_id =      models.ForeignKey(tbl_house_lu, db_column='house_id', on_delete=models.CASCADE)
    person_id =     models.ForeignKey(tbl_person_lu, db_column='person_id', on_delete=models.CASCADE)

class tbl_project_lu(models.Model):
    project_id=     models.AutoField(primary_key=True, null=False)
    house_id=       models.ForeignKey(tbl_house_lu, db_column='house_id', on_delete=models.CASCADE)
    project_name=   models.CharField(max_length=100, null=False)
    description=    models.CharField(max_length=100, null=True)

class tbl_proj_mbr(models.Model):
    project_id=     models.ForeignKey(tbl_project_lu, db_column='project_id', on_delete=models.CASCADE)
    house_mbr_id=   models.ForeignKey(tbl_house_mbr, db_column='house_mbr_id', on_delete=models.CASCADE)

What is the best way to use this kind of query in django? Can Django ORM handle this kind of query or do I have to use stored proc for this?

A: Using select_related() will pre-populate the appropriate attributes:
one Example  define with 3 model(City,Person,Book) and their dependency.
see select_related doc


text:
Q: Ranking the factor variable and the logic I am trying to rank a factor variable. Though i am able to rank however i am not able to understand the logic behind this.Please let me know if i can use the ranking for my correlation in combination with the numerical variables?And how is ranking logic?
> dput(train <- data[train_ind, ])
structure(list(CATEGORY_NAME = structure(c(7L, 8L, 4L, 4L, 5L,
6L, 7L, 13L, 10L, 8L, 5L, 2L, 6L, 14L, 4L, 4L, 6L, 5L, 13L, 7L,
5L, 14L, 13L, 14L, 10L, 13L, 7L, 6L, 14L, 8L, 6L, 3L, 2L, 8L,
8L, 2L, 6L, 6L, 6L, 2L, 3L, 14L, 4L, 15L, 6L, 5L, 14L, 7L, 13L,
12L, 14L, 13L, 4L, 8L, 6L, 8L, 7L, 7L, 7L, 13L, 7L, 14L, 8L,
14L, 3L, 3L, 4L, 6L, 6L, 4L, 2L, 14L, 14L, 13L, 4L, 5L, 3L, 14L,
6L, 6L, 8L, 14L, 6L, 14L, 4L, 14L, 5L, 8L, 3L, 8L, 5L, 14L, 14L,
2L, 4L, 5L, 8L, 4L, 5L, 6L, 14L, 14L, 14L, 4L, 14L, 5L, 6L, 14L,
3L), .Label = c("AUDIT", "DEFAULT", "DOCUMENTATION - BILLING",
"DOCUMENTATION - COLLECTIONS", "DUPLICATE CLAIM", "INCORRECT CLAIM",
"INCORRECT PAYER", "INVALID AUTHORIZATION", "INVALID DIAGNOSIS",
"INVALID PRESCRIBER/PROVIDER", "NULL", "PATIENT NOT COVERED",
"SERVICE NOT COVERED - CLEARANCE", "SERVICE NOT COVERED - COLLECTIONS",
"TIMELY FILING"), class = "factor"), THERAPY2013ROLLUP = structure(c(2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 4L, 1L, 4L, 1L, 1L, 1L, 3L,
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L,
1L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 1L,
2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 2L, 2L, 1L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 2L, 2L), .Label = c("ADVANCED",
"CORE", "ONCOLOGY", "RARE"), class = "factor"), PAT_PAYOR_NAME = structure(c(221L,
63L, 227L, 8L, 8L, 63L, 67L, 280L, 375L, 64L, 8L, 447L, 187L,
276L, 450L, 116L, 185L, 159L, 447L, 221L, 247L, 442L, 447L, 153L,
484L, 8L, 395L, 113L, 205L, 63L, 447L, 169L, 275L, 63L, 69L,
187L, 211L, 66L, 403L, 447L, 64L, 185L, 208L, 447L, 185L, 185L,
205L, 63L, 280L, 447L, 185L, 63L, 64L, 63L, 113L, 468L, 66L,
287L, 67L, 8L, 67L, 185L, 185L, 63L, 442L, 447L, 67L, 447L, 447L,
57L, 8L, 375L, 447L, 280L, 8L, 450L, 70L, 8L, 185L, 185L, 63L,
442L, 185L, 377L, 185L, 459L, 326L, 447L, 447L, 276L, 8L, 187L,
288L, 86L, 185L, 252L, 468L, 447L, 210L, 277L, 219L, 185L, 113L,
447L, 88L, 450L, 187L, 375L, 185L), .Label = c("AARP", "AARP HEALTHCARE OPTIONS",
"ABBOTT LABORATORIES", "ACCLAIM", "ACCOUNTABLE HEALTH CARE IPA",
"ADMINISTRATIVE CONCEPTS", "ADVOCATE HEALTH CARE", "AETNA", "AETNA - LUXTURNA ONLY",
"AETNA - LUXTURNA ONLY\t\t", "AFFINITY MEDICAL GROUP", "AFLAC",
"ALL SAVERS HEALTH PLAN", "ALLCARE- IPA", "ALLEGIANCE BENEFIT PLAN MANAGEMENT",
"ALLEN COUNTY REGIONAL HOSPITAL", "ALLIANCE HEALTH AND LIFE",
"ALLIANT HEALTH PLAN", "ALLIED BENEFIT SYSTEMS INC", "ALLSTATE INSURANCE COMPANY",
"ALLWAYS HLTH PRTNRS-FKA NHP MASS", "ALTA BATES MEDICAL GROUP",
"AM FIRST", "AMA INSURANCE AGENCY", "AMBETTER AZ COMPLETE HLTH-LUXTURNA",
"AMEDISYS HOSPICE\t\t", "AMERAPLAN HRA", "AMERIBEN SOLUTIONS",
"AMERICAN MEDICAL SECURITY", "AMERICAN NATIONAL INSURANCE COMPANY",
"AMERICAN POSTAL WORKERS UN HLTH PLN", "AMERICAN POSTAL WORKERS UNION",
"AMERICAN REPUBLIC INS", "APPLECARE MEDICAL GROUP DRUG ONLY",
"APWU HEALTH PLAN", "APWU HEALTH PLAN PD NURSING ONLY", "ARISE HEALTH PLAN (FORMERLY WPS)",
"ASHWAUBENON SCHOOL DISTRICT", "ASSOC AND SOCIETY INSURANCE",
"ASURIS NORTHWEST HEALTH", "ATLANTIC HEALTH", "AULTCARE", "AURORA HEALTH CARE",
"AUXIANT", "AUXIANT HEALTH", "AVMED", "BANKERS LIFE & CASUALTY",
"BAYCARE HOMECARE / MNGD CARE OFF", "BAYLOR UNIVERSITY MEDICAL CENTER",
"BCBS MT-HEALTH CARE SVC CORP DRUG", "BEAVER MEDICAL GROUP",
"BORGESS MEDICAL CENTER", "BOSTON MEDICAL CENTER", "BRAZOSPORT REG HEALTHCARE SYSTEMS",
"BRIGHAM AND WOMEN'S HOSPITAL", "BROOKDALE WESTLAKE HILLS SNF",
"BROWN & TOLAND MEDICAL GRP", "BROWN & TOLAND PHYSICIANS EAST BAY",
"BROWN & TOLAND PHYSICIANS WEST BAY", "BUCHANAN METAL FORMING",
"BUTTERWORTH HOSPITAL", "CAPITAL DISTRICT PHYSICIANS HLTH PL",
"CARECENTRIX", "CARECENTRIX DRUG ONLY", "CARECENTRIX FL BLUE DRUG ONLY",
"CARECENTRIX FL BLUE PD PRNV", "CARECENTRIX HORIZ BCBS NJ DRUG ONLY",
"CARECENTRIX HORIZ BCBS NJ PD PRNV", "CARECENTRIX PD/PRNV ONLY",
"CARESOURCE", "CAROLINA HEALTH SYSTEMS", "CARPENTERS HEALTH & WELFARE",
"CARPENTERS UNION", "CAYUGA ONONDAGA AREA SCHOOLS", "CEDARS SINAI HEALTH ASSOCIATES",
"CEDARS SINAI MEDICAL GROUP", "CENTRAL RESERVE LIFE", "CHANGE HEALTHCARE",
"CHILDREN'S NATIONAL MEDICAL CTR", "CHILDRENS COMMUNITY HEALTH PLAN",
"CHILDRENS HOSPITAL", "CHILDRENS HOSPITAL OF PHILADELPHIA", "CHRISTIAN BROTHERS SERVICES",
"CHRISTIAN CARE MINISTRY MEDI-SHARE", "CHRISTUS SPOHN HOSP SHORELINE",
"CIGNA", "CIGNA - LUXTURNA ONLY", "CIGNA HEALTHCARE", "CIGNA MEDICAL",
"CIGNA MEDICAL DRUGS ONLY", "CIGNA MEDICAL FEDEX", "CIGNA MEDICAL FEDEX DRUGS ONLY",
"CIGNA MEDICAL NURSING ONLY", "CIGNA MEDICAL PER DIEMS ONLY",
"CIGNA MEDICAL UPS", "CIGNA MEDICAL UPS DRUGS ONLY", "CINCINNATI CLAIMS FOR WORKERS COMP",
"CITY OF LEXINGTON", "CLALIT HEALTH SERVICES", "CLARION HLTH METHODIST HOSPITAL",
"CLARK COUNTY SCHOOL DISTRICT", "CLEVELAND CLINIC", "COASTAL COMM PHYSICIAN NETWORK IPA",
"COFINITY", "COLONIAL MEDICAL INSURANCE CO", "COMBINED INSURANCE CO OF AMERICA",
"COMMON GROUND HEALTHCARE", "COMMUNITY CARE", "COMMUNITY CARE HEALTH & LIFE",
"COMMUNITY FIRST HEALTH PLANS", "COMMUNITY HEALTH CHOICE", "COMP MANAGEMENT HEALTH SYSTEMS-SXC",
"COMPASS ROSE HEALTH PLAN", "COMPMANAGEMENT HEALTH SYSTEMS",
"CONIFER HEALTH SOLUTIONS", "CONNECTICARE", "CONTRA COSTA HEALTH PLAN",
"COOK AND COMPANY", "CORPORATE MGD HLTH SVCS-DIVERSIFIED", "COUNTRY LIFE",
"COVENTRY HEALTH CARE", "COVENTRY HEALTH CARE-MERCY HEALTH",
"CROWN CORK & SEAL COMPANY INC", "CUSHMAN AND WAKEFIELD", "CVS PHARMACY INC-ZOLGENSMA",
"DAKOTACARE", "DEAN HEALTH PLAN INC", "DECATUR MEM HOSP-CENTRAL IL HLTH",
"DESERET MUTUAL BENEFITS", "DEX IMAGING", "DIGNITY HEALTH MEDICAL FOUNDATION",
"EAST BATON ROUGE SHERIFFS OFFICE", "EAST BOSTON NEIGHBORHOOD HLTH CTR",
"EASTERN MAINE HEALTH SYSTEM", "EBIX HLTH ADMIN EXCHANGE", "EBMS-EMPLOYEE BENEFIT MGMT SVC",
"EDUCATORS MUTUAL", "EDWARD C. LEVY", "ELLIS HOSPITAL", "EMBASSY OF SAUDI ARABIA",
"EMBASSY OF SAUDI ARABIA AFO", "EMBASSY OF THE STATE OF KUWAIT HLTH",
"EMBASSY OF THE STATE OF QATAR", "EMBASSY OF THE UNITED ARAB EMIRATES",
"EMI HEALTH", "EMPIRE PHYSICIANS MEDICAL GROUP", "EQUIAN-CATAMARAN",
"EQUITABLE", "ERIE INSURANCE", "FACILITY HOSPITAL/ PHARMACY",
"FACILITY HOSPITAL/PHARMACY", "FALLON COMMUNITY HEALTH PLAN",
"FAMILY CARE SPECIALIST", "FAMILY CARE SPECIALISTS", "FARMERS TELEPHONE COOPERATIVE",
"FEDERAL REPUBLIC OF GERMANY", "FIDELIS CARE OF NEW YORK", "FIRST CARE",
"FIRST CAROLINA CARE", "FIRST CHOICE HEALTH", "FIRST CHOICE HEALTH PLAN",
"FIRST CHOICE MEDICAL GROUP", "FIRSTCARE HEALTH PLANS", "FISHBACK FINANCIAL CORPORATION",
"FMH BENEFIT SERVICES", "FMH BENEFITS-CORESOURCE", "FORT SANDERS REGIONAL MEDICAL CTR",
"GARNETT AND COWLES INSURANCE", "GEHA", "GEHA(GOVT EMP HLTH ASSOC)",
"GEISINGER HEALTH PLAN", "GENERAL BUILDING LABORORS LOCAL 66",
"GERBER LIFE INSURANCE", "GILBERT PUBLIC SCHOOL", "GILSBAR INC",
"GLOBAL CARE", "GOLDEN RULE INSURANCE CO", "GOLDEN TRIANGLE SPEC NTWRK DRG ONLY",
"GOLDEN TRIANGLE SPECIALTY NETWORK", "GREAT AMERICAN LIFE INS",
"GREENSPRING VILLAGE", "GREENVILLE MEMORIAL MED CNTR", "GROUP & PENSION ADM",
"GROUP HEALTH COOP SC WISCONSIN", "GROUP HEALTH INC (GHI)", "GROUP HEALTH INC (GHI)-HOME",
"GROUP HEALTH INC (GHI)-OFFICE", "HALFF ASSOCIATES", "HARTFORD INSURANCE CO",
"HARTFORD LIFE INSURANCE CO", "HARVARD PILGRIM HEALTH CARE INC",
"HARVARD PILGRIM HEALTH CARE INC1133", "HEALTH ALLIANCE PLAN",
"HEALTH ALLIANCE PLAN OF MICHIGAN", "HEALTH CARE LA IPA", "HEALTH CARE PARTNERS",
"HEALTH CHOICE", "HEALTH CHOICE OF OK", "HEALTH CHOICE OF OKLAHOMA",
"HEALTH DESIGN PLUS", "HEALTH EZ", "HEALTH FIRST HEALTH PLANS",
"HEALTH FIRST HEALTH PLANS FLORIDA", "HEALTH NET OF AZ", "HEALTH NET OF CA",
"HEALTH NET OF OR", "HEALTH NEW ENGLAND", "HEALTH PARTNERS",
"HEALTH PARTNERS OF MN", "HEALTH PLAN OF NEVADA", "HEALTH PLAN OF UPPER OHIO VALLEY",
"HEALTH PLANS INC", "HEALTH PLUS PHYSICIANS ORGANIZATION", "HEALTH SELECT",
"HEALTHCARE PARTNERS", "HEALTHCARE PARTNERS OF NV- IPA", "HEALTHFIRST",
"HEALTHGRAM", "HEALTHLINK", "HEALTHSCOPE", "HEALTHSMART", "HEALTHSOUTH REHABILITATION HOSPITAL",
"HENDRICK MANAGEMENT", "HIGH DESERT MEDICAL GROUP", "HILL COUNTRY MEMORIAL HOSPITAL",
"HILMAR CHEESE COMPANY", "HIP OF NY", "HIP OF NY-HOME", "HISPANIC PHYSICIANS IPA",
"HOMETOWN HEALTH PLAN", "HOSPICE OF THE WEST", "HOSPITAL/MEDICAL CTR",
"HUMANA", "HUMANA INC", "HYDRO-GEAR", "IBEW", "IBEW LOCAL 25 HEALTH & BENEFIT FUND",
"IBEW LOCAL UNION 3", "ILWU-PMA COASTWISE", "IMPERIAL HEALTH HOLDINGS",
"INDEPENDENT HEALTH ASSOCIATION", "INDIAN HEALTH SERVICES", "INNOVAGE CA PACE",
"INSURANCE SERVICES OF LUBBOCK", "IOUE LOCAL 825", "JOHNS HOPKINS HEALTHCARE",
"JOINT IND BRD ELECTRICAL", "JP FARLEY CORPORATION", "KAISER EDI TESTING ONLY",
"KAISER FOUNDATION HEALTH PLAN", "KAISER FOUNDATION HEALTH PLAN INC",
"KAISER FOUNDATION HLTPLN WA FKA GHC", "KAISER PERMANENTE", "KAISER PERMANENTE NORTHERN CA",
"KAISER PERMANENTE OF GEORGIA", "KAISER PERMANENTE OF HAWAII",
"KAISER PERMANENTE OF NORTHWEST", "KAISER PERMANENTE SELF FUNDED PLAN",
"KAISER PERMANENTE SOUTHERN CA", "KEARNY MESA RHAB CTR", "KINDRED HOSPICE",
"KINDRED HOSPITAL", "LIBERTY NATIONAL", "LOCAL 342 WELFARE FUND",
"LSU FIRST", "M S HERSHEY MEDICAL", "MAGNACARE", "MAILHANDLERS",
"MARIS GROVE INC", "MARSH AFFINITY GROUP SERVICES", "MASSACHUSETTS GENERAL HOSPITAL",
"MAYO HEALTH SYSTEMS", "MCLAREN HEALTH PLAN", "MCS  LIFE INSURANCE",
"MED PAY", "MEDICA", "MEDICA CHOICE", "MEDICAL CENTER", "MEDICAL CENTER OF GEORGIA",
"MEDICAL MUTUAL OF OHIO", "MEDONE PHARMACY SERVICES", "MEMBERS HEALTH INSURANCE",
"MEMORIAL HEALTH CARE IPA", "MEMORIAL HEALTHCARE SYSTEM", "MERCY CARE HEALTH PLAN",
"MERCY PHYSICIANS MEDICAL GROUP", "MERITAGE MED NTWK FKA MARIN SONOMA",
"MERITAIN HEALTH", "MIDWEST POULTRY SERVICES", "MISSION HOSPITAL INCORPORATED",
"MODA HEALTH", "MOHEGAN TRIBE OF CT", "MONARCH HEALTHCARE", "MONARCH MEDICAL GROUP",
"MONTEFIORE CMO", "MUSICIANS LOCAL 802", "MUTUAL OF OMAHA", "MVP HEALTH PLAN",
"MVP HEALTHCARE", "NASI - NATIONAL AUTOMATIC SPRINKLER", "NATIONAL BENEFIT FUND 1199",
"NATIONAL POSTAL MAIL HANDLERS", "NATIONWIDE INSURANCE", "NEIGHBORHOOD HEALTH PLAN MASS",
"NETWORK HEALTH PLAN MCARE ADVANTAGE", "NEW MEXICO MEDICAL INSURANCE POOL",
"NEW MEXICO MEDICAL INSURANCE POOL\t", "NEW MEXICO MEDICAL INSURANCE POOL\t\t",
"NEW YORK CITY LAW DEPT", "NEW YORK HOTEL TRADE", "NEW YORK UNIVERSITY",
"NEXCALIBER", "NIVANO PHYS DBA SIERRA NV MED ASSOC", "NJ CARPENTER HEALTH FUND",
"NOBLE HORIZONS", "NORTH AMERICA ADMINISTRATORS", "NORTH TX SPECIALTY PHYSICIANS",
"NORTH TX SPECIALTY PHYSICIANS\t\t", "NORTHEAST GA MEDICAL HLTH PARTNERS",
"NORTHERN IL HEALTH PLAN", "NYSTROM & ASSOCIATES LTD", "OCONEE REGIONAL",
"OLYMPUS MANAGED HEALTHCARE INC", "ONEIDA NATION OF WISCONSIN",
"OPTIMA", "OPTIMA HEALTH", "OPTIMA HEALTH PLAN", "OPTUM CARE NETWORK CONNECTICUT",
"OSI ENVIRONMENTAL", "OXFORD HEALTH PLAN", "PACE WORKERS COMP-MAGELLAN",
"PACIFIC SOURCE HEALTH PLANS", "PALM BEACH COUNTY FIREFIGHTERS",
"PAM SPECIALTY HOSPITAL COVINGTON", "PARAGON BENEFITS INC", "PARAMOUNT",
"PARK CITY PRESBYTERIAN", "PEKIN LIFE INSURANCE", "PETERSON, BEYENHOF & ZAHLER LTD",
"PHP OF MID MICHIGAN", "PHYSICIANS MED GRP SANTA CRUZ", "PHYSICIANS OF SW WASHINGTON",
"PHYSICIANS PLUS INSURANCE CORP", "PLANNED ADMINISTRATORS INC (PAI)",
"PLUMBERS & PIPEFITTERS", "POMCO", "POMONA VALLEY MEDICAL GROUP",
"PREFERRED HEALTH PROFESSIONALS", "PREFERRED ONE ADMINISTRATIVE SERVIC",
"PREFERRED ONE COMMUNITY HEALTH PLAN", "PRESBYTERIAN HEALTH PLAN",
"PRIMECARE MED NTWK-CORONA", "PRIMECARE MED NTWK-HEMET VALLEY",
"PRIMECARE MED NTWK-PHYSICIAN NTWK", "PRIMECARE MED NTWK-TEMECULA",
"PRIMECARE MED NTWK - CORONA", "PRINCIPAL LIFE INSURANCE COMPANY",
"PRIORITY HEALTH", "PRIVATE HEALTH CARE SYSTEMS", "PROSPECT MEDICAL GROUP",
"PROVIDENCE HEALTH PLAN", "PROVIDRS CARE NETWORK FKA WPPA", "PUBLIC EMPLOYEES HEALTH PLAN",
"QUAL CHOICE OF ARKANSAS", "QUALCARE", "QUALCHOICE OF ARKANSAS",
"QUIKTRIP", "RATHJE ENTERPRISES INC", "REGAL MEDICAL GROUP",
"REHABILITATION HOSPITAL OF IN", "RIVER CITY MEDICAL GROUP",
"RUSH UNIVERSITY MEDICAL CENTER", "SALT RIVER PROJECT", "SAMBA",
"SANFORD HEALTH PLAN", "SANTA BARBARA SELECT", "SCOTT & WHITE HEALTH PLAN",
"SCOTTSDALE HEALTH CARE", "SEAMAN CORPORATION", "SEAVIEW MEDICAL GROUP",
"SECURITY HEALTH PLAN", "SELECT CARE", "SELECT HEALTH FKA INTERMOUNTAIN",
"SELECT HEALTH FORMERLY IHC", "SELMAN AND COMPANY", "SENTARA HEALTH MANAGEMENT",
"SENTARA HEALTHCARE", "SENTRY INSURANCE WORKERS COMP", "SERVICE EMPLOYEES INTL UNION (SEIU)",
"SHARP COMMUNITY MEDICAL GROUP", "SHARP HEALTH CARE", "SHARP HEALTH PLAN",
"SHEPPARD PRATT HOSPITAL", "SHILAND FAMILY MEDICINE", "SIERRA HEALTH & LIFE",
"SIERRA HEALTH AND LIFE", "SIERRA HEALTH SERVICES", "SIERRA MEDICAL GROUP",
"SOUTHEAST GEORGIA REG MED CENTER", "SOUTHWESTERN HEALTH RESOURCES",
"SPECTRA ENERGY", "SPRAYING SYSTEMS CO", "ST JOSEPH HERITAGE HEALTH",
"ST JOSEPH HERITAGE HEALTHCARE", "ST JOSEPH HOSPITAL", "ST JUDE HERITAGE MEDICAL GROUP",
"ST MARYS HOSPITAL", "ST VINCENT MEDICAL GROUP", "ST. JOHN'S HOSPITAL",
"STATE FARM HEALTH CARE CLAIMS", "STATE OF ILLINOIS EMPLOYEES",
"STATE OF NEVADA", "STEWART C MILLER COMPANY INC", "STEWART TILE",
"STONERIVER PHARMACY SOLUTIONS", "SUBURBAN EMPLOYEE SERVICES",
"SUFFOLK COUNTY RISK MANAGEMENT", "SUMMACARE", "SUTTER HEALTH",
"SUTTER MEDICAL FOUNDATION", "SYCUAN BAND OF THE KUMEYAAY NATION",
"SYRACUSE CITY SCHOOLS", "TAMPA GENERAL HOSPITAL", "TEAMSTERS HEALTH & WELFARE",
"TEAMSTERS WESTERN REGION LOCAL 177", "TERREBONNE SCHOOL BOARD",
"THE EDGEWOOD CENTRE", "THE HEALTH PLAN OF THE UPPER OH VLY",
"TOLEDO ELECTRICAL WELFARE FUND", "TRANSAMERICA LIFE (FKA STONEBRIDGE)",
"TRI STATE HEALTH AND WELFARE", "TUFTS HEALTH PLAN", "UC SAN DIEGO HEALTH",
"UCLA MEDICAL GROUP DRUG ONLY", "UFCW", "UFCW-UNITE", "UFCW & EMPLOYERS AZ HEALTH TRUST",
"UFCW & PFIE HEALTH AND WELFARE", "UHC - ALL SAVERS PLAN", "UHC PASSPORT CONNECT HARVARD PILGR.",
"UHC WEST FKA PACIFICARE", "UMR", "UNICARE HEALTH PLAN", "UNICARE STATE INDEMNITY PLAN",
"UNIFIED GROUP SERVICES", "UNITED FOOD & COMMRCL WORKERS 880",
"UNITED HEALTH CARE", "UNITED HEALTH ONE", "UNITED HEALTH SHARED SERVICES",
"UNITED HEALTHCARE", "UNITED HEALTHCARE-EMPIRE", "UNITED HEALTHCARE-EMPIRE.",
"UNITED HEALTHCARE-SIERRA HEALTH", "UNITED HEALTHCARE - HCAP",
"UNITED HEALTHCARE  EMPIRE PLAN", "UNITED HEALTHCARE CHOICE PLUS-ZLGN",
"UNITED HEALTHCARE HCAP", "UNITED HEALTHCARE INTERNATIONAL",
"UNITED HEALTHCARE STUDENT RESOURCES", "UNITY HEALTH PLAN", "UNIV HOSPTAL NORTH SHORE",
"UNIV OF MEDICINE & DENISTRY OF NJ", "UNIVERA HEALTHCARE", "UNIVERSITY HEALTH ALLIANCE",
"UNIVERSITY HEALTH CARE PLUS", "UNIVERSITY OF UTAH HEALTH PLAN",
"UNIVERSITY OF UTAH NETWORK", "UPMC HEALTH PLAN", "UPMC HEALTH PLAN ESI PD PRNV",
"US DEPT OF LABOR", "USAA LIFE INSURANCE", "UTE ENERGY", "VALLEY CARE IPA",
"VALLEY HEALTH PLAN", "VALLEY PRESBYTERIAN HOSPITAL", "VANTAGE MEDICAL GROUP",
"VIDANT HEALTH", "VILLIAGE OF ROSEMONT", "WA STATE FUND DEPT OF LABOR",
"WASHINGTON STATE HEALTH INS POOL", "WASHOE COUNTY SCHOOL DISTRICT",
"WEA TRUST", "WEB TPA", "WEBTPA", "WELLDYNERX", "WELLMED FL",
"WELLMED TX", "WESTAR ENERGY", "WESTCHESTER COUNTY BENEFITS",
"WESTERN HEALTH ADVANTAGE", "WESTERN SOUTHERN LIFE", "WESTWOOD CENTER",
"WINCHESTER MEDICAL CENTER", "WORLD INSURANCE", "WTC HEALTH PROGRAM",
"WV PEIA", "YAVAPAI REGIONAL MEDICAL CENTER", "YORK RISK SERVICES-EXPRESS SCRIPTS"
), class = "factor")), row.names = c(NA, -109L), class = c("tbl_df",
"tbl", "data.frame"))

Below is the code for ranking
train_rank<-train%>%select_if(is.factor)%>%mutate_all(funs(dense_rank(desc(.))))

A: It doesn't make any sense at all. If you look at your levels now:
levels(train$CATEGORY_NAME)
 [1] "AUDIT"                             "DEFAULT"
 [3] "DOCUMENTATION - BILLING"           "DOCUMENTATION - COLLECTIONS"
 [5] "DUPLICATE CLAIM"                   "INCORRECT CLAIM"
 [7] "INCORRECT PAYER"                   "INVALID AUTHORIZATION"
 [9] "INVALID DIAGNOSIS"                 "INVALID PRESCRIBER/PROVIDER"
[11] "NULL"                              "PATIENT NOT COVERED"
[13] "SERVICE NOT COVERED - CLEARANCE"   "SERVICE NOT COVERED - COLLECTIONS"
[15] "TIMELY FILING"

The levels will decide how your variables are ranked. And you can see now they are  sorted alphabetically. When you call rank, this is what happens:
data.frame(fac=head(train$CATEGORY_NAME),rank=head(rank(train$CATEGORY_NAME),6))
                          fac rank
1             INCORRECT PAYER 59.0
2       INVALID AUTHORIZATION 69.5
3 DOCUMENTATION - COLLECTIONS 20.0
4 DOCUMENTATION - COLLECTIONS 20.0
5             DUPLICATE CLAIM 32.0
6             INCORRECT CLAIM 46.0

You get a rank based on their alphabetical order... and if you do correlation with this on other columns, it makes absolutely no sense at all.


text:
Q: Java: getting a value from an array from a defined location I have an array of numbers and would like to retrieve one of the values from location "index".
I've looked at the Java documentation http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Array.html but my code still isn't compiling.
here is my method:
public class ConvexPolygon implements Shape
{
    java.awt.Point[] vertices;

    public ConvexPolygon(java.awt.Point[] vertices)
    {
        this.vertices = vertices;
        this.color = color;
        this.filled = filled;
    }

java.awt.Point getVertex(int index)
{
    Point vertex;
    vertex =  get(Point vertices, int index);
}

I have numbers in an array representing Points. The value index is going to be the location of the array verities.
What can I do to make this work? Thanks !

A: I think you're just looking for:
 Point vertex = vertices[index];

At least - if you're not looking for that, please expand on what the difference is between using the array index and what you do want :)

A: In Java, array indexes are denoted by the square brackets.  You can replace your get(vertices, index) call like so:
  vertex = vertices[index];

In looking at your code, it appears you are coming from a language that defines a global get() function for such operations.  Be aware that, in Java, there are no global functions.  Each class you create defines its own functions, and any function call without an object or class preceding it is assumed to be defined in the local class.
So, your call to get(Point[], int) could work only if you define that function on this class:
  public Point get(Point[] vertices, int index) {
     return vertices[index];
  }

Or define it statically on another class and precede the call with the class name:
public class PointArrayHelper {

  public static Point get(Point[] vertices, int index) {
    return vertices[index];
  }
}

PointArrayHelper.get(vertices, index);

Now, be warned that I don't think you should do either of these!  I just thought it might help you understand Java a little better.

A: Hope it works!
java.awt.Point getVertex(int index)
{
    return vertices[index];
}


text:
Q: How to configure Tomcat to not encode the session id into the URL when HttpServletResponse.encodeURL() is invoked Seems like a stupid question to which the answer would be "Don't use encodeURL()!" but I'm working with a codebase that uses netui anchor tags in the JSPs and I need to disable the writing of JSESSIONID into the URLs as it is a security risk.
In WebLogic, you can configure this by configuring url-rewriting-enabled in weblogic.xml (I know because I wrote that feature in the WebLogic server!). However, I can't find an equivalent config option for Tomcat.

A: Tomcat 6 supports the disableURLRewriting attribute that can be set to true in your Context element:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Common_Attributes

A: No setting comes to mind. But this is fairly easy to do by creating a first-entry Filter listening on the url-pattern of interest (maybe /* ?) and replaces the ServletResponse by a HttpServletResponseWrapper implementation where the encodeURL() returns the very same argument unmodified back.
Kickoff example:
public void doFilter(ServletRequest request, ServletResponse response) throws ServletException, IOException {
    chain.doFilter(request, new HttpServletResponseWrapper((HttpServletResponse) response) {
        public String encodeURL(String url) {
            return url;
        }
    });
}

A: As found in https://fralef.me/tomcat-disable-jsessionid-in-url.html - There is a servlet spec feature to do this
<session-config>
   <tracking-mode>COOKIE</tracking-mode>
</session-config>


text:
Q: Synchronous and async methods in a web.api Can someone please explain if this code is a potential deadlock.
Mixing sync database calls with async database calls like the code below. Or if the async call was executed first, is that the risk for deadlock.
    [Route("{id}/someobjects")]
    [ResponseType(typeof(IEnumerable<SomobjectDto>))]
    public async Task<IHttpActionResult> GetSomeobjects(string id)
    {
        var syncMethodResult = SyncDBCallMethod(); //In this method there is a databas call..

        var asyncMethodresult = await AsyncDBMCallMethod(1L);  //In this method there is a Async databas call..

A: In this case, the async AsyncDBMCallMethod call wont start till the synchronous SyncDBCallMethod finishes.
Once you are not mixing blocking calls like Result or .Wait in async/await functions, and properly await async functions, you should be able to have async and sync calls together.
Reference Async/Await - Best Practices in Asynchronous Programming


text:
Q: Cant copy from requester pays bucket to my own bucket using the s3 module of aws cli, while I can copy to my machine fine aws s3 cp s3://arxiv/pdf/arXiv_pdf_0001_001.tar s3://bucket --request-payer requester

fails with

fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden

But if I do
aws s3 cp s3://arxiv/pdf/arXiv_pdf_0001_001.tar . --request-payer requester

it works fine
Additionally this also works, but it only copies one file at a time:
aws s3api copy-object --copy-source arxiv/pdf/arXiv_pdf_0001_001.tar --request-payer requester --key arXiv_pdf_0001_001.tar --bucket arxivmanifest

Whats going on?

A: When I ran the first command, it gave the error:

An error occurred (AccessDenied) when calling the GetObjectTagging operation: Access Denied

This is because the aws s3 cp command does more than just copy the file by also attempting to copy tagging (it seems). It would also seem that the bucket has not granted permissions for the GetObjectTagging API call.
In contrast, the aws s3api copy-object command issues a single API call. In fact, all s3api commands map to a specific API call. The aws s3 commands are 'higher level' commands that do more, such as enabling a --recursive copy).


text:
Q: How to get which integer is in a certain position in a set? Given a set of integers, how can I know which integer is in a certain position, if the elements of a set were ordered in an increasing way? For example, given a set of integers how can I obtain the smaller integer or the second smaller integer etc
Is it possible to do this in logarithmic time? I mean, I know there are obvious ways of doing what I asked, but is there any that works in logarithmic time?

A: The elements of an std::set are stored in increasing order.
No, you can't find the item at position N in logarithmic time though--it requires linear time.
auto start = your_set.begin();
std::advance(start, N);

In theory it could be done in logarithmic time by having each node of the tree store a count of the nodes to its left (i.e., preceding it in order), but std::set doesn't require that or provide a (standardized) interface to use it even if it were present.

A: Yes, if your elements were sorted ("ordered in an increasing way"), then there is a way to search for an arbitrary integer in logarithmic time. Use binary search trees. Obviously, if you want the best possible time span, you will want to use self-balancing trees (such as red-black trees, avl trees, ...). I believe that the C++ options for this are part of std::set.
However, I'm not really sure what you mean by "obtain the smaller integer." If you mean, given a set of integers, find the minimum element, then you will want to look up Heaps. Heaps do the job better than trees, because in the case of Heaps, querying the minimum value will happen in constant time, while insertions and deletions happen in logarithmic time. I believe the C++ options for this are part of std::priority_queue.
Alternatively, if you wanted the fastest way of searching for integers, you can use hash tables, since they allow querying in expected constant time, with constant time insertion. The C++ options for this are std::unordered_set.


text:
Q: How do you migrate a Parse Background Job in light of Parse.com shutting down? I have a general question about Parse shutting down in January 2017.  I have migrated my Monogodb instance and have parse server up and running on heroku.
Do we have to migrate the Parse Dashboard to our own server too or will that continue to run on parse.com?  I ask because I currently schedule cloud jobs through that, and haven't been able to figure out how to migrate these Background Jobs, or send on demand push notifications.

A: cf http://blog.parse.com/announcements/introducing-the-parse-server-dashboard/ I understand that they want you to migrate to your own self hosted parse dashboard.


text:
Q: What is the closure of the circal in this topology? cI have this topology on $\mathbb{R}^2$ $$\sigma=\big\{\emptyset,\{(3,0)\}\big\}\cup\big\{\bigcup_{a\in A}\Omega_a :  A\subseteq \mathbb{R}\cup\{\infty\}\big\}$$
where $$\Omega_a=\{(x,y)\in\mathbb{R}^2 : y-ax+3a=0\},\Omega_{\infty}=\{(x,y)\in \mathbb{R}^2 : x=3\}$$
I need to find the adherence of the $C=\{(x,y)\in \mathbb{R}^2 : x^2+y^2=4\}$
I see that

*

*$(3,0)\notin \rm cl\{C\}$

*the two lines $\Omega_{\dfrac{2}{\sqrt{5}}}$ and $\Omega_{\dfrac{-2}{\sqrt{5}}}$ are tangent to C, so
$$\forall (x,y)\in \big[ \bigcup_{\dfrac{-2}{\sqrt{5}}\leq a\leq \dfrac{2}{\sqrt{5}}}\Omega_a\big]\setminus\{(3,0)\}, (x,y)\in \rm cl\{C\}$$

*$C\subset \rm cl\{C\}$
Is it true if i say that $$\rm cl\{C\}=C\cup \big[ \bigcup_{\dfrac{-2}{\sqrt{5}}\leq a\leq \dfrac{2}{\sqrt{5}}}\Omega_a\big]\setminus\{(3,0)\}$$


text:
Q: I can only get error NSScanner: nil string argument,why When my program crash, I'm only getting this warning NSScanner: nil string argument in the debug window.
And I did not use the class NSScaner
How do I resolve this problem ?

A: You may get this warning if you take a nil object as the argument of some method. So, find out the scope where this error could take place and check all methods carefully, especially those who takes string as the argument


text:
Q: Splitting a string into thirds I am making another encoding test... just testing out some of my knowledge where i hit a spike. I know how to split a string into half String.substring blah blah... but how do i split into thirds? I wish to save to 3 strings, "firsthalf" "secondhalf" and "thirdhalf" anyone help me?
(Code so far):
String text = "abspqrtnf";
    String firsthalf = text.substring(0, text.length() / 3);
    String secondhalf = text.substring(text.length() / 3);
    String thirdhalf = text.substring(text.length() / 3);

A: Continuing on with the way you started:
String text = "abspqrtnf";
int textLength = text.length();
String firsthalf = text.substring(0, textLength / 3);
String secondhalf = text.substring(textLength / 3, text.length() / 3 * 2);
String thirdhalf = text.substring(text.length() / 3 * 2);

*

*secondhalf needs to start where the firsthalf ended and 'go' twice as long

*thirdhalf needs to start where secondhalf ended and go to the end

A: String text = "abspqrtnf";
String firsthalf = text.substring(0, (text.length() / 3));
String secondhalf = text.substring(text.length() / 3,(text.length()*2 / 3));
String thirdhalf = text.substring((text.length()*2 / 3),text.length());
System.out.println(secondhalf + "   " +firsthalf + "   "+ thirdhalf);

A: As stated you need to decide on what to do if string length is not divisible by 3 (truncate or longer last string) and also cater for an input string less than 3.
Suggest writing some unit tests to cover these use cases.
Some simple code below as an alternative partial solution.
    String input = "abcdefghij";

    if( input.length() >= 3 )
    {
        int singleStringLen = input.length() / 3;
        int index = singleStringLen;

        System.out.println( input.substring( 0, index ) );
        System.out.println( input.substring( index, (index += singleStringLen) ) );
        // last string maybe longer if input string not divisible by 3
        System.out.println( input.substring( index, input.length() ) );
    }


text:
Q: Precision of Sin vs Cos functions in Fortran Consider the code,
PROGRAM TRIG_TEST
IMPLICIT NONE

DOUBLE PRECISION, PARAMETER :: PI=4.D0*DATAN(1.0D)

print *, sin(PI/2.0), cos(PI/2.0)

END PROGRAM TRIG_TEST

Compiling with gfortran outputs,
1.0000000000000000 6.1232339957367660E-017

I am aware of the usual floating point issues but is there a reason why the sin function is identically 1, but the cos function is not identically zero?

A: The following assumes double is the IEEE 754 basic 64-bit binary format. Common implementations of the trigonometric routines are less accurate than the format supports. However, for this answer, let's assume they return the most accurate results possible.
π cannot be exactly represented in double. The closest possible value is 884279719003555 / 281474976710656 or 3.141592653589793115997963468544185161590576171875. Let's call this p.
The sine of p/2 is about 1 − 1.8747•10−33. The two values representable in double on either side of that are 1 and 0.99999999999999988897769753748434595763683319091796875, which is about 1 − 1.11•10−16. The closer of those is 1, so the closest representable value to sine of p/2 is exactly 1.
The cosine of p/2 is about 6.123233995736765886•10−17. The closest value representable in double to that is 6.12323399573676603586882014729198302312846062338790031898128063403419218957424163818359375•10−17.
So the results you observed are the closest possible results to the true mathematical values.

A: Let's look at why the result from sin gives 1.  In your code
DOUBLE PRECISION, PARAMETER :: PI=4.D0*DATAN(1.0D0)

This is a floating point approximation to the value of pi.  It's probably pretty close to the real value, but it isn't it.  Also, the sin function has errors in the evaluation of sin.  We hope those are small errors.
We expect that cos(pi/2) has value zero.  Your floating point calculation cos(PI/2) has an error of about 6.1232339957367660E-017 from the mathematical answer.  Let's assume that your sin calculation has a similar magnitude of error.
Now look at the value of epsilon(0d).  This is the smallest number for which 1d0+epsilon(0d0) is not equal to 1d0.  The assumed error is much smaller than this number, in the model (for which you report "~ 2.2e-16").
So, 1 is the closest representable number to the real value of the floating point calculation.
Consider the program
  use, intrinsic :: iso_fortran_env, only : real128, real64
  implicit none

  real(real64), parameter :: PI=4.D0*ATAN(1._real64)
  real(real128), parameter :: PI_approx = PI   ! Not 4*ATAN(1._real128)

  print *, SIN(PI/2), COS(PI/2)
  print *, SIN(PI_approx/2), COS(PI_approx/2)

end

This calculates (possibly) the sin of your PI/2 but at a higher precision (using the same approximation for pi).  My compiler reports a value different from 1 in the second case, but the difference being much less than epsilon(0._real64).

As a style point, in general it is best to avoid datan and use the generic atan.  double precision may also be replaced by appropriate kind parameters.  These are shown in my program above.


text:
Q: Deploy WPF Application with SQLite How do I get a WPF application, with A SQLIte database, on another PC? When running the code on the machine on which the app has been developed, there is no problem. But I cannot get the program to run on another PC.
I have been searching the internet for days. All literature are either vague or does not show the process from A to Z. Following the dozens of instructions on the net gives me results that either 1) Does not include the Database when the application gets installed on another pc, or 2 crashes the program. And the Microsoft literature talks alot but explains nothing.
How does the app knows in which folder to find the Sqlite database?
How does the app knows it must interact with the database?
What should the code look like to work on the other pc? What should the XAML look like to work on the other PC? And, PLEASE, in which classes or windows should they be?
By now I now in detail how to do all of the above for my local PC. I cannot get the app to run on another PC

A: Yes,yes,yes!!!!
I found the solution! In the App.config page, the connectionstring must be as follows:
">"
">"  "connectionString="metadata=res:///SalaryAndWageApp.csdl|res:///SalaryAndWag">"eApp.ssdl|res://*/SalaryAndWageApp.msl;provider=System.Data.SQLite.EF6;provid">"er connection string='data ">"source="|DataDirectory|\WageAndSalaryApp.db"'" ">"providerName="System.Data.EntityClient" />
With the "|DataDirectory|\WageAndSalaryApp." working the magic


text:
Q: How does fasting relate to sea fish? The original text:
...

But in earlier times, when sea fish were eaten only by those who lived
  on the sea coast, when meat was obtainable only for part of the year,
  and when fasts were frequent and universally practised, river fish
  played an important part in the national life.
...
Between the owners of the fisheries and the bargemaster who needed an
  unimpeded passage continuous war was fought, till the importance of
  fresh-water fish lessened as the practice of fasting ceased to be
  universal, as meat became available all the year round, and as the
  transport of sea fish inland became practicable.

How did a fast relate to the consumption of sea fish in the past?

A: When a person "fasts" in a specifically Christian and particularly Catholic context, it does not mean that a person does not eat at all, it means that a person abstains from eating (red) meat, and perhaps from particularly luxurious foods.  Fish and shellfish could be and often were eaten during fasts, particularly the fast of Lent, before Easter. That is, I feel confident, the kind of "universal fasting" that this author is referring to. I presume that he means "in Europe, during the time when pretty much everyone followed Catholic practices", which is a slightly restricted meaning for "universal". Perhaps the context was made clear earlier in the work.
The ads one sometimes still sees for "Friday fish specials" derive from a formerly common practice among Catholics to "fast" in this sense every Friday, leading to much increased fish consumption on Fridays in areas where observant Catholics were numerous.


text:
Q: Is it possible to overlap the whole page in svelte using routing? I am using this as reference for my test front end application.
Is it possible that when I click the other navigation links that the whole page is covered with the component instead of the lower part changing? I have a button that returns to the main page applied on my code so returning isn't an issue.
I have a modal example working but it's not using routes and I want to be able to go directly to the page using the path
example:
localhost:5173/blog

then it will go to the blog page but covering the entire page


text:
Q: Some answers don't allow comments. Why? I found a question similar to what I would ask. I wanted to add subquestion as before others did in grey (dimmed), but I didn't find a way.
In some questions I saw, that there is a posibility to "add comment". Why in some questions such posibility is possible and in some not?

UPD: problems with UTF-8 encoding in PHP

A: You need 50 reputation to comment on questions (that you did not ask yourself) on Stack Overflow, but just 1 to do the same here at Meta. See also How does the comment system and comments work?
Or, without any specific examples, maybe you're referring to migrated questions? Those (and other locked questions) cannot be commented on.


text:
Q: Fazer um GET do banco a partir de um Array Laravel Eu tenho um select onde faço uma busca a partir de um id informado,
No postman faco a um POST
mandando um array no como no exemplo abaixo
[
{
      "id":"1"
},
{
      "id":"2"
}
]

No repositório faço a busca desses id para poder obter todas as informações sobre eles.
como ficaria no meu repositório na hora de fazer a busca e trazer as informações dos ids informados atualmente eu faço uma busca simples com um get();
Repository:
Public function listarId($id)
    {
    return $this->produto = DB::table('produtos')
    ->where('id', $id)
    ->get();
     }

e mando como paramentro no postman um id de cada vez
  {
  "id":"2"
  }

no meu controller atualmente esta da seguinte maneira, eu mando request com a variavel $id, e retorno a select que fiz no repository.
   public function lista(Request $request)
    {

        $id = $request->input('id');

        return $this->produtosRepository->listarId($id);
    }

e eu quero poder mandar um array com varios ids

A: Você em vez de usar o where(); poderia utilizar o whereIn();
Por exemplo:
 return $this->produto = DB::table('produtos')
->where('id_admin', $array_id)
->get();

Aonde esse $array_id seria um array de id's.

OBS.: o whereIn necessariamente precisa receber um array
  unidimensional por exemplo [1,2,3]

Com isso ele va fazer uma query parecida com :
Select * from produtos where id_admin in (1,2);

Espero ter ajudado.


text:
Q: Increase/Decrease Brightness of Image using Jslider not working Jslider is working fine but filtering of image is not occuring.Please help me to find out what is wrong in this code.Is there any other method to change brightness of image?
If so please change the code but using jslider brightness should be increase or decrease.
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.imageio.ImageIO;
import java.io.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.RescaleOp;

public class Bright extends JFrame
{
    Dimension screenwidth=getToolkit().getScreenSize();
    int mx=(int)screenwidth.getWidth();
    int my=(int)screenwidth.getHeight();
    BufferedImage picture1;
    JLabel label3;
    int neww;
    int newh;
    float[] scales = { 0.5f,1f, 1f, 1f };
    float[] offsets = new float[4];
    RescaleOp rescale;

    public Bright()
    {
        JFrame f = new JFrame("Image Editor v1.0");
        f.setLayout(null);
        try{
            File file=new File("e:\\8.jpg");
            picture1=ImageIO.read(file);
        }catch(Exception e)
        {
        }

        JPanel panel2 = new JPanel(); // create GUI to load image i.e picture1
        panel2.setLayout(null);
        panel2.setBounds(101,20,mx-100,my-20);
        f.add(panel2);
        label3 = new JLabel("");

        panel2.add(label3);
        f.setExtendedState(Frame.MAXIMIZED_BOTH);
        f.setVisible(true);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        createimage();
        brightness();
    }

    public void brightness()
    {
        JSlider slider=new JSlider(0,100);
        JPanel sliderpanel = new JPanel();
        JFrame frame1 = new JFrame();

        frame1.setTitle("Vertical JSlider");
        frame1.setContentPane(sliderpanel);
        frame1.setVisible(true);

        slider.addChangeListener(new ChangeListener()
            {
                @Override
                public void stateChanged(ChangeEvent e) {
                    // TODO Auto-generated method stub
                    JSlider slider = (JSlider)e.getSource();
                    System.out.println("Slider: "+slider.getValue());
                    float value = (float) slider.getValue()/100f;
                    scales[3]=value;
                    rescale = new RescaleOp(scales,offsets, null);
                    rescale.filter(picture1,picture1); // what problem is here ??
                }
            });

        frame1.add(slider);

        frame1.setSize(550,100);
        createimage();
    }

    public void createimage()
    {
        BufferedImage bi = null;

        if(picture1.getWidth()>mx-110 ||picture1.getHeight()>my-30 )
        {
            neww= (int) Math.round(picture1.getWidth() * 0.25); // reduce size
            newh = (int) Math.round(picture1.getHeight() *0.25);
        }
        else
        {
            neww=picture1.getWidth();
            newh=picture1.getHeight();
        }

        bi = new BufferedImage(neww,newh,BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) bi.createGraphics();
        g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY));
        g2d.drawImage(picture1,0,0,neww,newh,0,0,picture1.getWidth(),picture1.getHeight(), null);
        label3.setIcon(new ImageIcon(bi));
        label3.setBounds(150,150,neww,newh); //draw image
    }

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

A: The createimage method creates a new BufferedImage, and adds this image to the UI via an ImageIcon. As a result, changes to the picture1 variable will not be reflected in the UI. Further, if you do make changes a call to repaint on the UI object may be necessary (you may be better off and have more flexibility creating your own JPanel and drawing the image using custom painting). There's a lot of other things in that code snippet worth mentioning but not necessarily directly related to your problem:

*

*Avoid null layout's like the plague

*Do you plan on changing brightness, or opacity of the image (eg alpha). If you plan on changing opacity an Image, the Image should have an alpha component (the createimage method creates RGB type with no alpha).

*No reason for your class to extend JFrame if it is not necessary

*You are calling createimage twice.


text:
Q: Check if Paypal-Payment is pre-authorized can i check if the paypal-payment is preauthorized by the user?
If my User select Paypal for payment, i redirect him to Paypal-Site.
The User logs in, and the he authorizes the payment and then paypal redirects the user back to the shopping cart to review the order and finish it by pressing the order button.
Then i do the ApiCall "DoExpressCheckout".
Everything is fine.
But if the User logs in into his Paypal-Account and then click "Cancel" he is redirected to the Shopping-Card and if he then press the Order-Button, i get the Error "Payment not authorized by User".
My question now: Can i check, if the Payment was successfully "Pre"-Authorized by User?
I got the PayerID, i got the Status "Ack=Success", but i dont know if the User really has authorized the payment, right?
Best Regards,
Michael

A: If you call DoExpressCheckoutPayment and it comes back with ACK=Success then you got paid (although the payment could take a few days to clear in some cases). There is no "pre-authorized" state that I know of (unless you mean Billing Agreements but those simply let you run DECP without having the user do a full checkout again).
If they cancel after you call SetExpressCheckout then you shouldn't get any notices. Paypal will redirect them to your CANCELURL url.


text:
Q: Count the Occurences of a text for the whole spreadsheet I have a spreadsheet where in every column I have a list of names. They can repeat, and whats even worse - cells can contain some additional text (apart from the name).
What I want to do is count the occurrences of the name in the whole spreadsheet (only looking at the name, omitting the potential additional text). Is Possible?
I tried the formula =UNIQUE, but it does not work vertically (I'm working with Google Sheets)
Example of a document https://docs.google.com/spreadsheets/d/1STtJr0yisSeuv2w8_JVgQABAL5EDzI8aFmH8Vp2cOko/edit?usp=sharing

A: You can use Countif, Arrayformula, and Regexreplace to accomplish this task
Assuming you have the data range from A2:E12 and the prefilled unique names starting from A14
Formula:
=countif(ARRAYFORMULA(regexreplace($A$2:$E$12,".\(.*","")),A14)

Copy the formula until the last row
Hope it helps!

A: I'm sure that others will provide a much more elegant solution but this takes the data as presented in the spreadsheet and can be implemented in just a few minutes.

*

*Paste this formula in Cell F3
=FILTER({A3:A13;B3:B6;C3:C5;D3:D5;E3:E5;A18:A21;B18:B20;C18:C20;D18:D20;E18:E19}, LEN({A3:A13;B3:B6;C3:C5;D3:D5;E3:E5;A18:A21;B18:B20;C18:C20;D18:D20;E18:E19}))
This creates a single column list compiled from the various smaller lists.

*Highlight the range of names created in Column F (based on the test data = F3:F41), click Copy,

*Highlight cell G3, click Paste special (Paste Values only) - this converts the formula to a list for entries.

*Paste this formula in Cell H3 - this removes any data in brackets
=left(G3,iferror(search(" (",G3)-1,len(G3)))

*Copy the formula down as many rows as there is data in Column G

*Paste this formula in cell I3 - this lists the unique names
=unique(H3:H41)

*Paste this formula in cell J3 and copy down as many rows as there is data in Column I - this counts the number of instances of each unique name in the master list.
=COUNTIF(H:H, I3)


text:
Q: Разбить датафрейм на несколько частей по условию Имеется датафрейм, в котором значения в 1 столбце последовательно повторяются и разделены одной, не имеющей значения, строкой
>>> df['a'].values.tolist()
>>> ['количество', 'итог', 'лишнее', 'количество', 'итог']

Количество значений в датафрейме может быть любое, но гарантировано, что есть как минимум 2 повторяющиеся части и одна лишняя строка, которая их разделяет (значение этой строки тоже может быть произвольным).
Как разделить такой датафрейм на несколько частей, при этом чтоб во втором датафрейме повторялись названия столбцов как в первом
Пример для использования
q = [['a', 'b', 'c'], ['количество', 23, 45], ['итог', 100, 120], ['лишнее', 'лишнее', 'лишнее'], ['количество', 35, 87], ['итог', 76, 90]]
qw = pd.DataFrame(q, columns=q[0])
qw = qw[1:]
qw

Нужно получить два датафрейма
[['a', 'b', 'c'], ['количество', 23, 45], ['итог', 100, 120]]

и
[['a', 'b', 'c'], ['количество', 35, 87], ['итог', 76, 90]]

A: я бы рекомендовал поработать с индексами. например, так:
df = df[df["a"]!="лишнее"]
res = [g[1] for g in df.groupby(df.index.to_series().diff().ne(1).cumsum())]

смотрим, что теперь в res:
[print(x, type(x), sep="\n") for x in res]

            a    b    c
0  количество   23   45
1        итог  100  120
<class 'pandas.core.frame.DataFrame'>
            a   b   c
3  количество  35  87
4        итог  76  90
<class 'pandas.core.frame.DataFrame'>

иными словами, если вы специально не меняли индекс фрейма, то он у вас идет от 0 до какого-то числа с инкрементом в 1. удаляем строки с ключевым словом и группируем по последовательно идущим индексам. voilà!

A: Как-то так чтоли:
import pandas as pd

q = [['a', 'b', 'c'], ['количество', 23, 45], ['итог', 100, 120], ['лишнее', 34, 65], ['количество', 35, 87], ['итог', 76, 90]]
dataframes = []
data = []
check = set()
columns = q[0]
for item in q[1:]:
    if item[0] in check:
        dataframes.append(pd.DataFrame(data=data[:-1], columns=columns))
        data = []
        check = set()
    check.update([item[0]])
    data.append(item)
if data:
    dataframes.append(pd.DataFrame(data=data, columns=columns))

dataframes

Вывод:
[            a    b    c
 0  количество   23   45
 1        итог  100  120,
             a   b   c
 0  количество  35  87
 1        итог  76  90]


text:
Q: Azure DataFactory Merge Filter Array output to inside ForEach Loop LookUp output values I am trying to merge the filter activity output which is outside of the ForEach Loop generated result. based on that, I have using item() value to filter again lookup activity output from azure database table. finally i have two kind of out with my hand. one is outside ForEach Loop acivity we have Filter activity provided one JSON array output. similarly we have inside forEach Loop activity to call lookup generated JSON array output as below like.
Filter Activity output:
{
    "ItemsCount": 9,
    "FilteredItemsCount": 7,
    "Value": [
        {
            "no_day": 60,
            "server": "naserxxxxx",
            "database": "db12",
            "table": "tablename12",
            "asset_id": "1cdsdsadsadsadasdsad",
            "indicator": [
                "value"
            ],
            "sub_indicator": [
                "va"
            ]
        },
        {
            "no_day": 999,
            "server": "sssss",
            "database": "db11",
            "table": "Entity",
            "asset_id": "b3ddd-b56b-4756-b5a5-ffffff",
            "indicator": [
                "val"
            ],
            "sub_indicator": [
                "ef_dt"
            ]
        },
        {
            "no_day": 30,
            "server": "sssssss",
            "database": "db15",
            "table": "tablename11",
            "asset_id": "xxx-yyyyy-ddddddddd",
            "indicator": [
                "val"
            ],
            "sub_indicator": [
                "p_dt"
            ]
        },
        {
            "no_day": 75,
            "server": "servername6",
            "database": "db10",
            "table": "tablenamet10",
            "asset_id": "d8xxx-88d3-4a38-rrr61-xxxxcec",
            "indicator": [
                "val4",
                "val3"
            ],
            "sub_indicator": [
                "time",
                "dt"
            ]
        },
        {
            "no_day": 50,
            "server": "server4",
            "database": "db4",
            "table": "tablename4",
            "asset_id": "ca31cxxxxxx-25099dddddedf",
            "indicator": [
                "valueadsad"
            ],
            "sub_indicator": [
                "val2",
                "val3"
            ]
        },
        {
            "no_day": 100,
            "server": "serverName2",
            "database": "db2",
            "table": "tablename2",
            "asset_id": "dsdssdsdsd-7a9xxxxxx",
            "indicator": [
                "val1",
                "val2"
            ],
            "sub_indicator": [
                "tx_date"
            ]
        },
        {
            "no_day": 60,
            "server": "serverName",
            "database": "dbname",
            "table": "tablename",
            "asset_id": "32232323232323323232",
            "indicator": [
                "key"
            ],
            "sub_indicator": [
                "datedt"
            ]
        }
    ]
}

LookUp acivity each iteration will generate output as below like:
{
    "count": 1,
    "value": [
        {
            "id": 1,
            "name": "tablename",
            "path": "folder/test/<Timestamp>"
        }
    ],
    "effectiveIntegrationRuntime": "AutoResolveIntegrationRuntime",
    "billingReference": {
        "activityType": "PipelineActivity",
        "billableDuration": [
            {
                "meterType": "AzurexxIR",
                "duration": sdsds,
                "unit": "xxx"
            }
        ]
    },
    "durationInQueue": {
        "integrationRuntimeQueue": 0
    }
}

I would like to merge the Filter activity output and Lookup activity output in single manager to pass one of the notebook activity. please help us

A: To get the desired result, follow the below approach.
Here, I have taken your filter array of JSON in a blob file and used a lookup activity. I have given it to ForEach activity. In your case, give the Filter array to ForEach.
Inside ForEach, for this demo I have used the same lookup activity(with same single record output) in every iteration. In your case change the lookup query as per your requirement with @item() in every iteration.
These are my variables for the pipeline. res to store the result and res_show is to show the result array(optional).

Inside ForEach, take an append variable activity and give the below expression to it.
@json(concat('{',substring(string(item()),1,add(length(string(item())),-2)),',',substring(string(activity('My lookup').output.value[0]),1,add(length(string(activity('My lookup').output.value[0])),-2)),'}'))

After Foreach, I have stored the res array into res_show and this is the required array of JSON.

You can use this array of JSON as per your requirement.


text:
Q: PHP cut text from a specific word in an HTML string I would like to cut every text ( image alt included ) in an HTML string form a specific word.
for example this is the string:
<?php
$string = '
cut this text form here
';
?>

and this is what I would like to output

  cut this text

The $string is actually an element of an Object but I didn't wanted to put too long code here.
Obviously I can't use explode because that would kill the HTML markup.
And also str_replace or substr is out because the length before or after the word where it needs to be cut is not constant.
So what can I do to achive this?

A: Ok I solved my problem and I only post an answer to my question because it could help someone.
so this is what I did:
<?php
$string = '
cut this text form here
';
$txt_only = strip_tags($string);
$explode = explode(' from', $txt_only);
$find_txt = array(' from', $explode[1]);
$new_str = str_replace($find_txt, '', $string);
echo $new_str;
?>

This might not be the best solution but it was quick and did not involve DOM Parse.
If anybody wants to try this make sure that your href or src or any ather attribute what needs to be untouched doesn't have any of the chars in the same way and order as in $find_txt else it will replace those too.