text:
Q: Heartbeat won't successfully start up resources from a cold boot when a failed node is present I currently have two ubuntu servers running Heartbeat and DRBD. The servers are directly connected with a 1000Mbps crossover cable on eth1 and have access to an IP camera LAN on eth0.
Now, let's say that one node is down and the remaining functional node is booting after having been shut down. The node that is still functioning won't start up heartbeat and provide access to the drbd resource from a cold boot. I have to manually restart heartbeat by sudo service heartbeat restart to get everything up and running.
How can I get it to start fine from a cold start, when only one server is present?
Here is the ha.cf:
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility none

keepalive 2
deadtime 10
warntime 7
initdead 60
ucast eth1 192.168.2.2
ucast eth0 10.1.10.201
node EMserver1
node EMserver2
respawn hacluster /usr/lib/heartbeat/ipfail
ping 10.1.10.22 10.1.10.21 10.1.10.11
auto_failback off

Some material from the syslog:

harc[4604]: 2012/11/27_13:54:49 info: Running /etc/ha.d//rc.d/status status
mach_down[4632]:    2012/11/27_13:54:49 info: /usr/share/heartbeat/mach_down: nice_failback: foreign resources acquired
mach_down[4632]:    2012/11/27_13:54:49 info: mach_down takeover complete for node emserver2.
Nov 27 13:54:49 EMserver1 heartbeat: [4586]: info: Initial resource acquisition complete (T_RESOURCES(us))
Nov 27 13:54:49 EMserver1 heartbeat: [4586]: info: mach_down takeover complete.
IPaddr[4679]:   2012/11/27_13:54:49 INFO:  Resource is stopped
Nov 27 13:54:49 EMserver1 heartbeat: [4605]: info: Local Resource acquisition completed.
harc[4713]: 2012/11/27_13:54:49 info: Running /etc/ha.d//rc.d/ip-request-resp ip-request-resp
ip-request-resp[4713]:  2012/11/27_13:54:49 received ip-request-resp IPaddr::10.1.10.254 OK yes
ResourceManager[4732]:  2012/11/27_13:54:50 info: Acquiring resource group: emserver1 IPaddr::10.1.10.254 drbddisk::r0 Filesystem::/dev/drbd1::/shr::ext4 nfs-kernel-server
IPaddr[4759]:   2012/11/27_13:54:50 INFO:  Resource is stopped
ResourceManager[4732]:  2012/11/27_13:54:50 info: Running /etc/ha.d/resource.d/IPaddr 10.1.10.254 start
IPaddr[4816]:   2012/11/27_13:54:50 INFO: Using calculated nic for 10.1.10.254: eth0
IPaddr[4816]:   2012/11/27_13:54:50 INFO: Using calculated netmask for 10.1.10.254: 255.255.255.0
IPaddr[4816]:   2012/11/27_13:54:50 INFO: eval ifconfig eth0:0 10.1.10.254 netmask 255.255.255.0 broadcast 10.1.10.255
IPaddr[4804]:   2012/11/27_13:54:50 INFO:  Success
ResourceManager[4732]:  2012/11/27_13:54:50 info: Running /etc/ha.d/resource.d/drbddisk r0 start
Filesystem[4965]:   2012/11/27_13:54:50 INFO:  Resource is stopped
ResourceManager[4732]:  2012/11/27_13:54:50 info: Running /etc/ha.d/resource.d/Filesystem /dev/drbd1 /shr ext4 start
Filesystem[5039]:   2012/11/27_13:54:50 INFO: Running start for /dev/drbd1 on /shr
Filesystem[5033]:   2012/11/27_13:54:51 INFO:  Success
ResourceManager[4732]:  2012/11/27_13:54:51 info: Running /etc/init.d/nfs-kernel-server  start
Nov 27 13:55:00 EMserver1 heartbeat: [4586]: info: Local Resource acquisition completed. (none)
Nov 27 13:55:00 EMserver1 heartbeat: [4586]: info: local resource transition completed.
Nov 27 13:57:46 EMserver1 heartbeat: [4586]: info: Heartbeat shutdown in progress. (4586)
Nov 27 13:57:46 EMserver1 heartbeat: [5286]: info: Giving up all HA resources.
ResourceManager[5301]:  2012/11/27_13:57:46 info: Releasing resource group: emserver1 IPaddr::10.1.10.254 drbddisk::r0 Filesystem::/dev/drbd1::/shr::ext4 nfs-kernel-server
ResourceManager[5301]:  2012/11/27_13:57:46 info: Running /etc/init.d/nfs-kernel-server  stop
ResourceManager[5301]:  2012/11/27_13:57:46 info: Running /etc/ha.d/resource.d/Filesystem /dev/drbd1 /shr ext4 stop
Filesystem[5372]:   2012/11/27_13:57:46 INFO: Running stop for /dev/drbd1 on /shr
Filesystem[5372]:   2012/11/27_13:57:47 INFO: Trying to unmount /shr
Filesystem[5372]:   2012/11/27_13:57:47 INFO: unmounted /shr successfully
Filesystem[5366]:   2012/11/27_13:57:47 INFO:  Success
ResourceManager[5301]:  2012/11/27_13:57:47 info: Running /etc/ha.d/resource.d/drbddisk r0 stop
ResourceManager[5301]:  2012/11/27_13:57:47 info: Running /etc/ha.d/resource.d/IPaddr 10.1.10.254 stop
IPaddr[5509]:   2012/11/27_13:57:47 INFO: ifconfig eth0:0 down
IPaddr[5497]:   2012/11/27_13:57:47 INFO:  Success
Nov 27 13:57:47 EMserver1 heartbeat: [5286]: info: All HA resources relinquished.
Nov 27 13:57:48 EMserver1 heartbeat: [4586]: info: killing /usr/lib/heartbeat/ipfail process group 4603 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBFIFO process 4589 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBWRITE process 4590 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBREAD process 4591 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBWRITE process 4592 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBREAD process 4593 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBWRITE process 4594 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBREAD process 4595 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBWRITE process 4596 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBREAD process 4597 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBWRITE process 4598 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: killing HBREAD process 4599 with signal 15
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4589 exited. 11 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4596 exited. 10 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4598 exited. 9 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4590 exited. 8 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4595 exited. 7 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4591 exited. 6 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4592 exited. 5 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4593 exited. 4 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4597 exited. 3 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4594 exited. 2 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: Core process 4599 exited. 1 remaining
Nov 27 13:57:49 EMserver1 heartbeat: [4586]: info: emserver1 Heartbeat shutdown complete.

Here is some more from the log

ResourceManager[2576]:  2012/11/28_16:32:42 info: Acquiring resource group: emserver1 IPaddr::10.1.10.254 drbddisk::r0 Filesystem::/dev/drbd1::/shr::ext4 nfs-kernel-server
IPaddr[2602]:   2012/11/28_16:32:42 INFO:  Running OK
Filesystem[2653]:   2012/11/28_16:32:43 INFO:  Running OK
Nov 28 16:32:52 EMserver1 heartbeat: [1695]: WARN: node emserver2: is dead
Nov 28 16:32:52 EMserver1 heartbeat: [1695]: info: Dead node emserver2 gave up resources.
Nov 28 16:32:52 EMserver1 ipfail: [1807]: info: Status update: Node emserver2 now has status dead
Nov 28 16:32:52 EMserver1 heartbeat: [1695]: info: Link emserver2:eth1 dead.
Nov 28 16:32:53 EMserver1 ipfail: [1807]: info: NS: We are still alive!
Nov 28 16:32:53 EMserver1 ipfail: [1807]: info: Link Status update: Link emserver2/eth1 now has status dead
Nov 28 16:32:55 EMserver1 ipfail: [1807]: info: Asking other side for ping node count.
Nov 28 16:32:55 EMserver1 ipfail: [1807]: info: Checking remote count of ping nodes.
Nov 28 16:32:57 EMserver1 heartbeat: [1695]: info: Heartbeat shutdown in progress. (1695)
Nov 28 16:32:57 EMserver1 heartbeat: [2734]: info: Giving up all HA resources.
ResourceManager[2751]:  2012/11/28_16:32:57 info: Releasing resource group: emserver1 IPaddr::10.1.10.254 drbddisk::r0 Filesystem::/dev/drbd1::/shr::ext4 nfs-kernel-server
ResourceManager[2751]:  2012/11/28_16:32:57 info: Running /etc/init.d/nfs-kernel-server  stop
ResourceManager[2751]:  2012/11/28_16:32:57 info: Running /etc/ha.d/resource.d/Filesystem /dev/drbd1 /shr ext4 stop
Filesystem[2829]:   2012/11/28_16:32:57 INFO: Running stop for /dev/drbd1 on /shr
Filesystem[2829]:   2012/11/28_16:32:57 INFO: Trying to unmount /shr
Filesystem[2829]:   2012/11/28_16:32:58 INFO: unmounted /shr successfully
Filesystem[2823]:   2012/11/28_16:32:58 INFO:  Success
ResourceManager[2751]:  2012/11/28_16:32:58 info: Running /etc/ha.d/resource.d/drbddisk r0 stop
ResourceManager[2751]:  2012/11/28_16:32:58 info: Running /etc/ha.d/resource.d/IPaddr 10.1.10.254 stop
IPaddr[2971]:   2012/11/28_16:32:58 INFO: ifconfig eth0:0 down
IPaddr[2958]:   2012/11/28_16:32:58 INFO:  Success
Nov 28 16:32:58 EMserver1 heartbeat: [2734]: info: All HA resources relinquished.
Nov 28 16:32:59 EMserver1 heartbeat: [1695]: info: killing /usr/lib/heartbeat/ipfail process group 1807 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBFIFO process 1777 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBWRITE process 1778 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBREAD process 1779 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBWRITE process 1780 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBREAD process 1781 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBWRITE process 1782 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBREAD process 1783 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBWRITE process 1784 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBREAD process 1785 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBWRITE process 1786 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: killing HBREAD process 1787 with signal 15
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1778 exited. 11 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1779 exited. 10 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1780 exited. 9 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1781 exited. 8 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1782 exited. 7 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1783 exited. 6 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1784 exited. 5 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1785 exited. 4 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1786 exited. 3 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1787 exited. 2 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: Core process 1777 exited. 1 remaining
Nov 28 16:33:01 EMserver1 heartbeat: [1695]: info: emserver1 Heartbeat shutdown complete.

If I restarted heartbeat at this point... the resources heartbeat controls would start up fine.... please help!

A: As commanded in the comments here is my initial suggestion in answer form.
If you run a recent enough Ubuntu version (10.04 or newer) you should ditch Heartbeat completely and use Corosync and Pacemaker instead. While this is not a answer or solution to your particular problem it will, as you have seen, make your problem simply disappear.
A great introductory article about Pacemaker was written in Linux Journal and Clusters from Scratch is a great starting point for getting Corosync and Pacemaker up and running. For Ubuntu 10.04 please use the PPA for the official stable backported cluster stack: https://launchpad.net/~ubuntu-ha-maintainers/+archive/ppa
The old Heartbeat stack has many conceptual shortcomings and has been obsoleted for so long now it is not worth trying to debug the problems that are bound to arise if you use it today. Corosync and Pacemaker have been created for this exact reason and they work just so much better than Heartbeat, which isn't even a resource manager, ever could.


text:
Q: Issue to import Adobe photoshop file in Expression Blend 4 I tried to import Adobe photoshop file in Expression Blend 4.But Layer effects(Gradient Overlay,Stroke,etc) are ignored.
What should i do to import the Adobe photoshop file without ignoring layer effects.

A: I think you'll find what you're looking for here. With extra attention to Tutorial #1 & Tutorial #5, as not all your effects will carry over, which is where PixelShaders will come in handy. As for using Photoshop, well if you're just importing a Raster image it's not the same as importing vectors. These tutorials should help clarify.
You likely received the down vote because this is a rather common question that has been asked before on SO, and elswhere on the web so it shows a lack of personal effort before asking it. Hope this helps! :)

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to pack a struct in Visual Studio to 24 bits that contains an uint32_t? I am trying to port over an existing application from a 32-Bit ARM-microcontroller to desktop plattforms such as Microsoft Windows. GCC is used on the ARM and I was able successfully compile the application on windows using a 32-bit MinGW-compiler, however I had no success using Microsoft's Visual Studio Compiler and that is the reason why I am asking here for help.
Here is what my application is doing:
I have some framebuffer consisting of three bytes per pixel, so my memory looks like RGBRGBRGB and so on.
I use a DMA-Channel on the ARM to push the pixels out to the display and my display directly understands this memory layout.
I also want to save some CPU cycles so I want to use ARM's saturated ADD __UQADD8 to draw on my framebuffer, performing saturated add on all three channels using a single operation.
For this to work, I need all three channels to be available in a single integer to be used as argument to __UQADD8.
Thats the reason why I use a union for one pixel of my framebuffer offers access to the separate channels by providing a struct containing each of R,G,B as uint8_t and providing the same memory as a 24 bit wide integer labeled data:
union Rgb {
    struct {
        uint8_t r;
        uint8_t g;
        uint8_t b;
    } ch;
    unsigned int data : 24 __attribute__((__packed__));
}

The width of 24 bits and the attribute packed is added to the data integer to restrict the width of the integer to three bytes. Then I can use the data in the pixel like this:
Rgb Rgb::operator+(const Rgb & op) {
    __UQADD8(data, op.data);
    return Rgb(data);
}

Note that __UQADD8 magically does only write to three of the four bytes of my integer and does not alter the R-channel of the next RGB in my framebuffer.
The following test program proves that my RGB's are all packed tight when using GCC:
#include <iostream>
#include <stdint.h>

union Rgb {
struct {
                uint8_t r;
                uint8_t g;
                uint8_t b;
        } ch;
    unsigned int data : 24 __attribute__((packed));
} ;

int main()
{
    std::cout << "Sizeof(Rgb) = "  << sizeof(Rgb) << std::endl;
    return 0;
}

To compile the example using MSVC, one has to remove the __attribute__packed. The program runs, but gives 4 as output.  There is number of other attributes in MSVC that can be used including #pragma pack, unaligned pointers __attribute__(aligned) and so on, but I found no combination that packs my struct to a size of three bytes.
How to port my application to Microsoft's compiler while keeping functionality and preferable compatibility to GCC?
Bonus question: How to keep functionality when compiling using a 64-bit compiler, either GCC or MSVC?

A: The answer for this SO question and this question mention bit-packing being "implementation defined" and lead to this official MSVC documentation page which says:

Adjacent bit fields are packed into the same 1-, 2-, or 4-byte
  allocation unit...

So it seems you cannot get an exact 3-byte bit field in MSVC. The only alternative I can think of is to do something like:
#pragma pack(push, 1)
union Rgb {
     struct {
          uint8_t r;
          uint8_t g;
          uint8_t b;
     } ch;
    unsigned char data[3];
};
#pragma pack(pop)

which will give you the desired 3-byte union size but may not be compatible with using __UQADD8(), at least directly.


text:
Q: apply display none to a class where another class is available in the same DOM in JS I have HTML codes (present in the same DOM) in which I want to apply a logic that if a particular class is available on DOM, then style display none
should be applied to a different class which is present in the same DOM.
HTML Code#1

   // If vjs-playing vjs-has-started classes are present in a DOM

HTML Code#2
   // then style display none should be applied to HW class
    ABC

This is what I have tried but it doesn't work.
var elementExists = document.getElementsByClassName("vjs-playing vjs-has-started");

if(elementExists)
{
document.getElementsByClassName("HW").style.display = "none";
}

Problem Statement:
I am wondering what changes I need to do in the script above so that when paricular class is available in a DOM then
style display none should be applied to a different class in the same DOM.

A: See what you have before:

var elementExists = document.getElementsByClassName("vjs-playing vjs-has-started");

if(elementExists)
{
document.getElementsByClassName("HW").style.display = "none";
}

   // If vjs-playing vjs-has-started classes are present in a DOM

   // then style display none should be applied to HW class
    ABC

it return Uncaught TypeError: Cannot set property 'display' of undefined which is resulted by getElementsByClassName returning not a direct value but array of all class which contain that name.
See the following:

var elementExists = document.getElementsByClassName("vjs-playing vjs-has-started")[0];
console.log(document.getElementsByClassName("vjs-playing vjs-has-started"));

if(elementExists)
{
console.log(document.getElementsByClassName("HW"));
document.getElementsByClassName("HW")[0].style.display = "none";
}

   // If vjs-playing vjs-has-started classes are present in a DOM

   // then style display none should be applied to HW class
    ABC

Notice the difference between adding [0] which point to first index and without. That's because getElementByClassName returns an array-like object of all child elements which have all of the given class names.


text:
Q: Virtual destructor Arduino Due undefined reference to operator delete When an interface contains a pure virtual method, it is recommended to use a virtual destructor. So for example, I have this code:

    template
    class A {
    protected:
        char buffer[Size];
    public:
        virtual void method() = 0;
        A() = default;
        virtual ~A() = default;
    };

    template
    class B : public A {
    public:
        void method() override;
        B() = default
        ~B() = default;
    };

    int main() {
        B b;
        b.method();
    }

But when I try to compile this with g++ for an Arduino Due, I get the following error:

    main.cpp:(.text._ZN4r2d29robot_arm22uarm_gcode_generator_cILj100EED0Ev[_ZN4r2d29robot_arm22uarm_gcode_generator_cILj100EED5Ev]+0x6): undefined reference to `operator delete(void*, unsigned int)'

However, when I remove the destructor from A entirely, it removes the error, but wouldn't this cause Undifed Behaviour? Also, when I just remove the virtual keyword from the destructor of A it gives me the same error message.

A: It is rather strange that the sole presence of a destructor would introduce a reference to the global operator delete. However, it seems that you're not the first one with this problem: Undefined reference to 'operator delete(void*)'. As pointed out in the comments there, the C++ standard library is not really available on avr-g++ which is most likely what you're using as well.
All that being said, however, I believe I can offer some relief.

When an interface contains a pure virtual method, it is recommended to use a virtual destructor.

A virtual destructor is only necessary when you need to delete an object via a base pointer [expr.delete]/3. Think of a virtual destructor as part of the interface itself. If an interface declares a virtual destructor, that means "objects that implement this interface can be deleted". The operation delete becomes part of the interface.
If you do not need the capability to delete as part of your interface, which, I would argue, should actually be the default, then you don't need a virtual destructor. Simply declare the destructor non-virtual and make it protected. Thus, you remove the operation delete from the interface and pass on the decision whether a type can be deleted further down to more concrete implementations of the interface…


text:
Q: Expression in John R. Taylor Scattering theory book In the book Scattering theory by John R. Taylor He has the following expression at page 138
$$
i \lim _{\epsilon \downarrow 0} \int_{0}^{\infty} d t\left\langle\mathbf{p}^{\prime}\right|V e^{i\left(E_{p}^{\prime}+E_{p}+i \epsilon-2 H\right) t}|\mathbf{p}\rangle=1 / 2 \lim _{\epsilon \downarrow 0}\left\langle\mathbf{p}^{\prime}\right|V G\left(\frac{E_{p^{\prime}}+E_{p}}{2}+i \epsilon\right)|\mathbf{p}\rangle \tag 1
$$
where $G$ is the green operator defined by
$G(z)=(z-H)^{-1}$
But  for me we should have
$$
i \lim _{\epsilon \downarrow 0} \int_{0}^{\infty} d t\left\langle\mathbf{p}^{\prime}\right|V e^{i\left(E_{p}^{\prime}+E_{p}+i \epsilon-2 H\right) t}|\mathbf{p}\rangle=1 / 2 \lim _{\epsilon \downarrow 0} \left\langle\mathbf{p}^{\prime}\right|V G\left(\frac{E_{p^{\prime}}+E_{p}+i \epsilon}{2}\right)|\mathbf{p}\rangle \tag 2
$$
Since we have that
$$\int dt e^{i\left(E_{p}^{\prime}+E_{p}+i \epsilon-2 H\right) t} =\int dt e^{2i\left(\frac{E_{p^{\prime}}+E_{p}+i \epsilon}{2}+ H\right) t} =\frac{1}{2i\left(\frac{E_{p^{\prime}}+E_{p}+i \epsilon}{2}+ H\right)}e^{2i\left(\frac{E_{p^{\prime}}+E_{p}+i \epsilon}{2}+ H\right) t} \tag 3$$
And from $(3)$ we have expression $(2)$.
I am not seeing how did he obtain expression $1$

A: Since $\epsilon$ is a small parameter that is taken to zero at the end of the calculation, and no physical quantities depend on $\epsilon$, it is conventional to "absorb" constant multiplicative factors into $\epsilon$. In your example, you could define $\epsilon'\equiv \epsilon/2$ and carry on with the calculation in terms of $\epsilon'$ instead of $\epsilon$. To save spending mental energy on a detail that is really irrelevant to a quite complex calculation, the convention is not to bother distinguishing $\epsilon'$ from $\epsilon$, and to refer to any $\alpha \epsilon$ (where $\alpha$ is a constant, positive factor) as $\epsilon$.


text:
Q: Full outer join not showing unmatched rows - SQL I am trying to do a full outer join of two tables, matching them with the "PO Product Code" of table 1 and "Product Code" of table 2. Each time I attempt to do this, there are a few product codes that are left out:
CABSCABS0000, DOORINTD0015, FLORCARP0001, EXCL0001, and FLORTILE0000

Each of these product codes are in table 2, but not in table 1.
Here are the screenshots of the tables I am working with.
https://i.imgur.com/pFAfrAb.png
https://i.imgur.com/k0a3o57.png
And here is the code that I have tried:
SELECT cost.[Actual Close]
    ,cost.[Project Name]
    ,cost.[Lot]
    ,cost.[Model]
    ,cost.[Elev]
    ,cost.[PO Product Code]
    ,cost.[Invoiced + Open] AS 'Invoiced + Open'
    ,rev.[Gross Sale] AS 'Gross Sale'

FROM Table1 cost FULL OUTER JOIN
     Table2 rev
    ON rev.[Product Code] = cost.[PO Product Code]
WHERE rev.[Project Name] = cost.[Project Name] AND
      rev.[Lot] = cost.[Lot];

I must also mention that the Product Code is specific to each Project Name and Lot, which is why that is added to the 'WHERE' clause.
Here is the output I got, which is missing the 5 craft codes listed above.
https://i.imgur.com/EoMFc9v.png

A: The FULL JOIN returns NULL values in columns for rows that do not match in either of the tables.  Your WHERE clause filters these out -- because NULL comparisons almost never evaluate to "true" (the exception is IS NULL and NULL-safe comparisons).
What you want to do is move these conditions to the ON clause.  That is where they belong anyway, because they are really JOIN conditions:
FROM Table1 cost FULL OUTER JOIN
     Table2 rev
     ON rev.[Product Code] = cost.[PO Product Code] AND
        rev.[Project Name] = cost.[Project Name] AND
        rev.[Lot] = cost.[Lot];

A: Its because of your where clause
rev.[Project Name] = cost.[Project Name]
AND rev.[Lot] = cost.[Lot];

Since those items that you mentioned are not in table A but are in table B, you are basically removing them via WHERE clause.
If you want those 5 Items to show, try removing the where clause, then run the query again.


text:
Q: Mustache variable for language preference in deepviews? My company is running an email campaign for app downloads using branch.io.  As users may open a given link on a desktop OR on their phone we need to support both cases.
We've implemented a branch "Deepview" because we love the ease of the text-to-download feature. The problem is, there doesn't seem any way to provide a localized version of this view, and we support many different languages.
Because I can't run scripts in the custom deep view (branch.io strips them out, I assume for security reasons), and because I don't have access to a language mustache variable, I can't change content by locale.
Is there any way to localize deepviews based on a URL param or (ideally) based on window.navigator.language(s)?  If I just had a mustache variable exposed for language_code of the user, everything could work.
Here was my attempt at hacking it in:

.lang-en .phone-number-label:after {
    content: "Phone Number";
}
.lang-en .btn-submit-label:after {
    content: "Send Me The App";
}

  <input name="phone" id="phone" placeholder="+1 (123) 123-1234" type="text" class="phone-input"></input>

  <button id="phone-submit" type="submit" class="phone-submit">

  </button>

The 'lang-en' is intended to be generated as follows:

...

I briefly got this to work by highjacking $og_description from the url:
https://bnc.lt/my-branch-link?$og_description<language_code_provided_as_query_param>
but after awhile, the {{link_data.$og_description}} stopped coming through at all into the mustache template (when passed as a url param). This also is probably not great practice.  Let me know if anyone has a solution here, or if branch.io devs are willing to expose this variable in their mustache template data.

A: I have good news! Branch Deepviews use Handlebars, utilizing this will allow you to set the "Get the App" -- "See this content immediately after install" and other variables with your deep linked values. Let me show you some code and a screenshot from an example that I just built for you.
Code example:
{{#if link_data.cta_text_localized}}{{link_data.cta_text_localized}}{{else}}Get The App{{/if}}

The Handlebars come into play for the "Get the app" Button here:
{{#if link_data.cta_text_localized}}{{link_data.cta_text_localized}}{{else}}Get The App{{/if}}

To spell it out, if the deep link value "cta_text_localized" exists within this link, then use that String for the "Get the App" button, otherwise use "Get the App." You can configure deep link data from the marketing section of your Dashboard, at the bottom of an "add link" dialog, attached screenshot:

Screenshot of my ES customized Deepview, note the altered "Get the App" button:

As you can see, using a liquid tag that grabs text from my deep link value "cta_text_localized" I set the "Get the App" button to a custom String. Using this method you would create a link for every language that you wanted to display, setting your deep link values accordingly, while your template always pulled from the same variable.


text:
Q: Troubleshooting PM2 Restart in Cron Update: I was not able to get this working as I desired. I ended up using the pm2 --cron flag since cron couldn't find my pm2 processes.
I am using pm2 restart in a bash script and it always fails on the pm2 restart projectName commands when run by cron (as root) but works when run manually with sudo. I am not sure how to troubleshoot as the pm2 log files don't show anything obvious. It looks like someone else has had the same issue so perhaps it's just a bug? Has anybody else found a way to resolve this issue?
Thank you!
Edit: Adding some context for @kevinnls
Here's the .sh script; I've isolated the command so I can test cron
# Vars
NOW=$(date +"%Y-%m-%d")
LOGS_PATH="/scriptLoc/logs"
LOG_FILE="$LOGS_PATH/$NOW-log.txt"
BE_PATH="/beLoc"

# Start log file
date >> $LOG_FILE
echo "Running..." >> $LOG_FILE

# Temp
cd $BE_PATH
pm2 restart be >> $LOG_FILE
pm2 restart be || echo "ERROR: BE pm2 restart: $?" >> $LOG_FILE
echo "Done." >> $LOG_FILE
exit

*

*If I run the command with sudo ./script.sh it works

*If I run it with cron I see the following output in my log file:

Fri Mar 26 17:35:01 UTC 2021
Running...
Use --update-env to update environment variables
ERROR: BE pm2 restart: 1
Done.

If I view pm2 logs:

*

*I see it exit with code 0 and restart when I run the script manually.

*I see no output for the failed restart from cron

A: The error you got:
[PM2][ERROR] Process or Namespace be not found

What is "be"? seems like pm2 from inside of cron has no idea what to make of it.
If it is a file, when you ran the script in your shell, was the file be in your working directory?

You can make these changes to log your error messages to $LOG_FILE.
This should help you get more details.
#redirect output *and* errors to log
pm2 restart be &>> $LOG_FILE
exit_code=$?
# if previous exit code != 0 do everything after `&&'
[[ $exit_code -ne 0 ]] && echo "ERROR: BE pm2 restart: $exit_code" >> $LOG_FILE

Then try running your script again and share the errors encountered.

A: I was not able to resolve this in the manner I desired. Ultimately I used the -c (cron) flag with pm2 itself.
pm2 cli reference
gitlab issue


text:
Q: Take action when CampaignMemberStatus is Updated or Deleted I'm trying to run some custom code when I detect that a CampaignMemberStatus record has changed or been deleted and am having no real luck.
Cannot create APEX Trigger on CampaignMemberStatus (which would have been ideal)
I can create an APEX Trigger on CampaignMemberStatusChangeEvent, however the Update ChangeEvent is missing key information (Label) and with the Delete ChangeEvent I get the "old" record Id...and I don't know what to do with it.
Here's what is showing in the Update ChangeEvent (the action I took in the UI is simply to rename the status's Label):
{
    Id=1CExx0000001RKFGA2,
    ReplayId=343371,
    ChangeEventHeader=eventbus.ChangeEventHeader[
        getChangedFields=(LastModifiedDate);
        getChangeOrigin=com/salesforce/api/soap/51.0;
        client=SfdcInternalAPI/;
        getChangeType=UPDATE;
        getCommitNumber=10762862893734;
        getCommitTimestamp=1622750489000;
        getCommitUser=00554000008FZUYAA4;
        getDiffFields=();
        getEntityName=CampaignMemberStatus;
        getNulledFields=();
        getRecordIds=(01Y54000000fSs4EAE);
        getSequenceNumber=1;
        getTransactionKey=0005501e-75a3-182f-db68-de750acf5df3;
    ],
    CampaignId=null,
    SortOrder=null,
    IsDefault=false,
    HasResponded=false,
    CreatedDate=null,
    CreatedById=null,
    LastModifiedDate=2021-06-03 20:01:29,
    LastModifiedById=null
}

Is there something I'm missing to have "all" fields in the event? Any suggestions on getting meaningful info from a Delete (I would love to either get Label OR CampaignId)?


text:
Q: Rails 3: sunspot solr : adding search ability for every page How do you add search to a layout so it can search for posts through every page of the site? such as here on stackoverflow.
Tutorials show adding the search method to the index action of the PostsController, and then adding the form and results block in views/post/index.html.erb.
I've been trying to create a form in application.html.erb that sends a get request to the search action of the posts controller. I can't seem to get it right, can someone help explain where I'm going wrong?
Currently I'm getting this error when going to my homepage:
NameError in Pages#home
undefined local variable or method `search_posts_path'
PostsController
   def search
     if params[:q]
       query = params[:q]
       @search = Post.search do
         keywords query
       end
       @posts = @search.results
     end
    end

post model
 searchable do
       text :title, :default_boost => 2
       text :content
  end

routes.rb
  match 'auth/:provider/callback' => 'authentications#create'
  resources :authentications

  devise_for :users, :controllers => {:registrations => 'registrations'}

  resources :posts do
      member do
      get :likers, :search
      end
  end

  resources :relationships, :only => [:create, :destroy]
  resources :appreciations, :only => [:create, :destroy]

  root :to => "pages#home"

 match '/contact', :to => 'pages#contact'
 match '/about',   :to => 'pages#about'
 match '/help',    :to => 'pages#help'
 match '/blog',    :to => 'pages#blog'

  resources :users do
     member do
     get :following, :followers, :likes
     end
     resources :collections
  end

views/layouts/application.html.erb
<%= form_tag search_posts_path, :method => :get do %>
<p>
<%= text_field_tag :q, params[:q] %> <%= submit_tag "Search!" %>
</p>
<% end %>

PagesController
 def home
    @title = "Home"
    if user_signed_in?
      @user = current_user
      @post = current_user.posts.build
      @feed_items = current_user.feed.paginate(:per_page => "10", :page => params[:page])
    else
     #render :layout => 'special_layout'
    end
  end

A: This is a Ruby on Rails routing question.
The member route is for operating on a single record. So you are defining search_post_path(@post) which will route to something like /posts/1/search
What you want is a collection route.
resources :posts do
  member do
    get :likers
  end
  collection do
    get :search
  end
end

This will create the search_posts_path method and route to /posts/search as you are expecting.
See also: http://guides.rubyonrails.org/routing.html#adding-more-restful-actions


text:
Q: Row Group Server Side Yajra DataTables i have problem with yajra datatables to make row group in server side. I want row group show all employee in companies.name. and my current code like this:
public function index(DataTablesBuilderService $builder)
    {
        $columns = [
            'name' => [
                'title' => "company",
                'name'  => 'companies.name'
        ];

        $dataTables = $builder
            ->setUrl(route('api.employee_details.data_tables', request()->all()))
            ->withIndex()
            ->setColumns($columns);

        return view('employee_details.index')->with([
            'dataTables' => $dataTables,
        ]);
    }

and in blade i just call datatable like this
 {!! $dataTables->table(['class' => 'table table-bordered','style' => 'width:100%', 'cellspacing' => '0']) !!}

and the script like this
{!! $dataTables->scripts() !!}

If i following the tutorial on https://datatables.yajrabox.com/eloquent/master, its possible to make row group but i dont know how to implement in server side. But is so different with my code in blade. Tutorial call datatable like this.
var template = Handlebars.compile($("#details-template").html());
    var table = $('#users-table').DataTable({
        processing: true,
        serverSide: true,
        ajax: 'https://datatables.yajrabox.com/eloquent/master-data',
        columns: [
            {
                "className":      'details-control',
                "orderable":      false,
                "searchable":      false,
                "data":           null,
                "defaultContent": ''
            },
            {data: 'id', name: 'id'},
            {data: 'name', name: 'name'},
            {data: 'email', name: 'email'},
            {data: 'created_at', name: 'created_at'},
            {data: 'updated_at', name: 'updated_at'}
        ],
        order: [[1, 'asc']]
    });

    // Add event listener for opening and closing details
    $('#users-table tbody').on('click', 'td.details-control', function () {
        var tr = $(this).closest('tr');
        var row = table.row(tr);
        var tableId = 'posts-' + row.data().id;

        if (row.child.isShown()) {
            // This row is already open - close it
            row.child.hide();
            tr.removeClass('shown');
        } else {
            // Open this row
            row.child(template(row.data())).show();
            initTable(tableId, row.data());
            tr.addClass('shown');
            tr.next().find('td').addClass('no-padding bg-gray');
        }
    });

    function initTable(tableId, data) {
        $('#' + tableId).DataTable({
            processing: true,
            serverSide: true,
            ajax: data.details_url,
            columns: [
                { data: 'id', name: 'id' },
                { data: 'title', name: 'title' }
            ]
        })
    }

and the result like this and i expected like this to but in datatables server side

Thank you if you can help to help me and explain how to solve the problem code

A: Injecting this in your DataTable options may help you (I've tried and it's working in my case)
$(selector).DataTable({
   startRender: function (rows, group) {
      var grpName = rows.data().pluck('company')
         .reduce(function (a, b) {
            return (b === null ? '' : b);
         }, '');

      return $('
')
        .append('' + grpName + '	');
   },
   endRender: null,
   dataSrc: 'company'
})


text:
Q: SQL Server application blank screen Does anyone come across this issue? All of as sudden over the weekend, my SQL Server application shows up all blank. This only happen to my SQL Server and none of my other application. I didn't do any special update or changes in windows configurations.

SQL Server


text:
Q: error 1064 mysql (42000) when omitting a semicolon in `if then ; else ; end if` ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'if ;
end' at line 18

CREATE PROCEDURE UnitIdCheckForDelete(
p_unitId varchar(50))
begin
if(
   (
    (
     SELECT ifnull(count(tbl_Product.unitId),0)
     FROM  tbl_Product
     WHERE   unitId=p_unitId
    ) > 0
   ) OR
   (
    (
     SELECT ifnull(count(tbl_UnitConversion.unitId),0)
     FROM tbl_UnitConversion
     WHERE  tbl_UnitConversion.unitId=p_unitId
    ) > 0
   )
  )
then
SELECT 'true' ;
else
SELECT 'false'
end if ;
end ; //

A: Try this:
DELIMITER //
CREATE PROCEDURE UnitIdCheckForDelete(
p_unitId varchar(50))
begin
if(
   ((SELECT ifnull(count(tbl_Product.unitId),0)
     FROM  tbl_Product
     WHERE   unitId=p_unitId)>0) OR
    ((SELECT ifnull(count(tbl_UnitConversion.unitId),0)
      FROM tbl_UnitConversion
      WHERE  tbl_UnitConversion.unitId=p_unitId)> 0 )
    )
then SELECT 'true' ;
else SELECT 'false' ;
end if ;
end ; //

A: You are missing semicolun at the end of your following statement,
SELECT 'false'

This statement should be like:(as @nrathaus has mentioned in his comments)
SELECT 'false';


text:
Q: Problem with scrlayer-scrpage header when changing chapter I am having trouble with the scrlayer-scrpage package. I am using the scrreprt class, for which scrlayer-scrpage is recommended.
I have a two-sided document, where I want the page number on the outer bottom of the page and sections/subsections in the inner/outer header. I am using a MAIN-document, where I incorporate my chapters via \include{}. Following chapters are from my original document:
\setcounter{page}{1}

\include{Diss_Zusammenfassung}
\include{Diss_Abstract}
\include{Diss_Introduction}
\include{Diss_Background}
\include{Diss_Aim}
\include{Diss_MundM}
\include{Diss_Results}
\include{Diss_Discussion}

Maybe the inclusion has to do with one of my problems, as I cannot reproduce it in the MWE. That's why I put it here.
Now to my Problems:

*

*I set \ifoot*{\pagemark}, which gives me the correct page number in the correct position - but the page number is also given on the inside of the page (see MWE). If I uncomment \clearpairofpagestyles I get the desired page number position only, but get no headers at all. If it is commented, I get the described double page numbering, plus headers, that are sometimes correct, sometimes incorrect (see next problems :D).

*Headings in Glossary and Acronyms: If Glossary and Acronyms exceed one page, glossary gets a header, but acronyms doesn't (see MWE). I don't get it. Is there a way to suppress the heading on the second glossary page? I tried \thispagestyle{plain/empty}, but it does not affect the heading on the second glossary page at all.

*Headings just incorrect. I wasn't able to reproduce this problem in the MWE example, which is why I am thinking it might have to do with the \include thingy. In the original document I included the chapters displayed above. I know that the pagestyle is set to plain, whenever a new chapter starts - so I am not confused by empty headers at the beginning of a chapter. What does confuse me though, is that on the second page of the chapter "Zusammenfassung" a heading "Acronyms" appears. Chapter "Abstract" is only one page long - so there is no heading. Then comes "General Introduction", where again "Acronyms" appears on the second page. The same happens again, when the chapter "Aim and Approach" is included (again, second page). On the second page of the chapter "Material and Methods" "Materials" appears in the header, as intended. It also works fine in the "Results" chapter. But then, in the chapter "Discussion", the most recent section of the "Results" chapter is displayed. I think the problem arises, when there are no sections/subsections in the current chapter. But how do I tell LaTeX to not display anything or display the current chapter instead of the latest section/subsection? And why does it work without a problem in the Bibliography?

Here is my MWE, that unfortunately does not work for problem 3 (sorry =/).
\documentclass[11pt,a4paper,twoside,bibliography=totocnumbered]{scrreprt} % twoside=zweiseitiges Drucklayout
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}  % für Deutsch ngerman
\usepackage{marvosym}
\usepackage{blindtext}

\usepackage[headsepline,markcase=used]{scrlayer-scrpage} % Für die Kopf- und Fußzeile inkl. Trennlinie und Titel groß geschrieben
%\clearpairofpagestyles %löscht Voreinstellungen von plain und des headings-Stils
\pagestyle{scrheadings}
\automark*[section]{section}
\automark*[subsection]{}
\ifoot*{\pagemark}
%\setkomafont{pageheadfoot}{}% Fußzeile normale Schrift

\usepackage[acronyms,toc,translate=babel,nopostdot,nonumberlist]{glossaries} % weitere Optionen: shortcuts

%%%%%%%%% Abkürzungen %%%%%%%%%%%
\pagenumbering{gobble}
\makenoidxglossaries
\setglossarystyle{long}

\newacronym{RP}{RP}{retinitis pigmentosa}
\newacronym{AMD}{AMD}{age-related macular degeneration}
\newacronym{LANUV}{LANUV}{Landesamt für Natur, Umwelt und Verbraucherschutz Nordrhein-Westfalen; State Agency for Nature, Environment and Consumer Protection Northrhine-Westfalia}
\newacronym{HE}{HE}{hematoxylin and eosin}
\newacronym{UV}{UV}{ultraviolet}
\newacronym{LED}{LED}{light-emitting diode}
\newacronym{NaCl}{NaCl}{sodium chloride}
\newacronym{OCT}{OCT}{optical coherence tomography}
\newacronym{sd-OCT}{sd-OCT}{spectral-domain optical coherence tomography}
\newacronym{ERG}{ERG}{electroretinography}
\newacronym{ffERG}{ffERG}{full-field electroretinography}
\newacronym{mfERG}{mfERG}{multifocal electroretinography}
\newacronym{MEA}{MEA}{multielectrode array}
\newacronym{IR}{IR}{inner retina}
\newacronym{OR}{OR}{outer retina}
\newacronym{ONL}{ONL}{outer nuclear layer}
\newacronym{OPL}{OPL}{outer plexiform layer}
\newacronym{IS}{IS}{inner segment}
\newacronym{OS}{OS}{outer segment}
\newacronym{IPL}{IPL}{inner plexiform layer}
\newacronym{INL}{INL}{inner nuclear layer}
\newacronym{GCL}{GCL}{ganglion cell layer}
\newacronym{NFL}{NFL}{nerve fiber layer}
\newacronym{ONF}{ONF}{optic nerve fiber layer}
\newacronym{ASR}{ASR}{Artificial Silicon Retina}
\newacronym{rd1}{rd1}{retinal degeneration 1}
\newacronym{rd10}{rd10}{retinal degeneration 10}

% RHO
\newglossaryentry{RHO}
{
 name=RHO,
 description={rhodopsin:
              \newline G-protein coupled photon receptor}
}

% PDE6B
\newglossaryentry{PDE6B}
{
 name=PDE6B,
 description={Rod cGMP-specific 3',5'-cyclic phosphodiesterase subunit beta:
              \newline G-protein effector enzyme}
}

% RLBP1
\newglossaryentry{RLBP1}
{
 name=RLBP1,
 description={retinaldehyde binding protein:
              \newline 11-cis-retinaldehyde carrier}
}

% RP1
\newglossaryentry{RP1}
{
 name=RP1,
 description={microtubule-associated protein:
             \newline microtubule formation and stabilization}
}

% cGMP
\newglossaryentry{cGMP}
{
 name=cGMP,
 description={cyclic guanosine monophosphate:
              \newline second messenger in phototransduction cascade}
}

% VEGF
\newglossaryentry{VEGF}
{
 name=VEGF,
 description={vascular endothelial growth factor:
              \newline signal protein involved in angiogenesis}
}

% mGluR6
\newglossaryentry{mGluR6}
{
 name=mGluR6,
 description={metabotropic glutamate receptor 6:
             \newline G protein-coupled receptor, linked to inhibition of cAMP}
}

% CNQX
\newglossaryentry{CNQX}
{
 name=CNQX,
 description={6-cyano-2,3-dihydroxy-7-nitro-quinoxaline-2,3-dione disodium:
              \newline AMPA/kainate receptor antagonist}
}

% DL-AP5
\newglossaryentry{DL-AP5}
{
 name=DL-AP5,
 description={DL-2-Amino-5- phosphonopentanoic acid:
             \newline NMDA receptor antagonist}
}

% MFA
\newglossaryentry{MFA}
{
 name=MFA,
 description={meclofenamic acid:
             \newline gap junction blocker}
}

% DHA
\newglossaryentry{DHA}
{
 name=DHA,
 description={dietary docosahexaenoic acid:
             \newline omega-3 fatty acid}
}

% FPG protein
\newglossaryentry{FPG protein}
{
 name=FPG protein,
 description={Formamidopyrimidine-DNA glycosylase:
              \newline repair endoduclease}
}

% NADPH
\newglossaryentry{NADPH}
{
 name=NADPH,
 description={Nicotinamide adenine dinucleotide phosphate:
              \newline coenzyme; reducing agent; anabolic metabolism
              }
}

% NADH
\newglossaryentry{NADH}
{
 name=NADH,
 description={Nicotinamide adenine dinucleotide:
              \newline coenzyme; oxidizing agent; catabolic metabolism
              }
}

% RNAi
\newglossaryentry{RNAi}
{
 name=RNAi,
 description={RNA interference:
              \newline \textit{small interfering RNA} prohibits translation by interfering with \textit{messenger RNA}
              }
}

% SMA
\newglossaryentry{SMA}
{
 name=SMA,
 description={"alpha smooth muscle actin" staining:
              \newline stains microfilaments of the cytoskeleton, myofibroblasts
              }
}

% FWHM
\newglossaryentry{FWHM}
{
 name=FWHM,
 description={full width at half maximum:
              \newline in a gaussian curve, the width of the function on the x-axis at 50\,\% of the maximum on the y-
                       axis
              }
}

% CTA
\newglossaryentry{CTA}
{
 name=CTA,
 description={chemiblocker + Triton X-100 + sodium azide
                           }
}

% CT
\newglossaryentry{CT}
{
 name=CT,
 description={chemiblocker + Triton X-100
                           }
}

\renewcommand*{\glsnamefont}[1]{\textmd{#1}}  %Akronyme in normaler Schriftgröße (ohne diesen Befehl alles fett)

\begin{document}

%------------------------    TOC   ------------------------
\newpage
\tableofcontents
\thispagestyle{empty} % nicht benötigt mit pagenumbering{gobble} am Anfang

\listoffigures
\listoftables
\printnoidxglossaries
%\printglossary
\thispagestyle{empty}
%------------------------    KAPITEL   ------------------------
\newpage
\pagenumbering{arabic}
\setcounter{page}{1}

\Blinddocument

These are glossary entries: \Gls{RHO}, \gls{PDE6B}, \gls{RLBP1}, \gls{RP1},
\gls{CT}, \gls{CTA}, \gls{FWHM}, \gls{SMA}, \gls{RNAi}, \gls{NADH},
\gls{NADPH}, \gls{FPG protein}, \gls{DHA}, \gls{MFA}, \gls{DL-AP5},
\gls{CNQX}, \gls{mGluR6}, , \gls{VEGF}, \gls{cGMP} and these are acronyms:
\Gls{RP}, \gls{AMD}, \gls{LANUV}, \gls{HE}, \gls{UV}, \gls{LED}, \gls{NaCl},
\gls{OCT}, \gls{sd-OCT}, \gls{ERG}, \gls{ffERG}, \gls{mfERG}, \gls{MEA},
\gls{IR}, \gls{OR}, \gls{ONL}, \gls{OPL}, \gls{IS}, \gls{OS}, \gls{IPL},
\gls{INL}, \gls{GCL}, \gls{NFL}, \gls{ONF}, \gls{ASR}, \gls{rd1}, \gls{rd10}
\end{document}

I would really appreciate any help with this.
Thank you all in advance.

A: To get the page number at the outer side (eg right on odd pages, left on even pages) of the footer you have to use \ofoot. But this is the default for a twosided document. So it would be enough to use
\usepackage[headsepline,markcase=used]{scrlayer-scrpage}% sets page style scrheadings
\automark*[section]{section}
\automark*[subsection]{}

If you want to use \clearpairofpagestyles then
\usepackage[headsepline,markcase=used]{scrlayer-scrpage}% sets page style scrheadings
\automark*[section]{section}
\automark*[subsection]{}
\clearpairofpagestyles
\ohead{\headmark}
\ofoot*{\pagemark}

If the page numbers should be in inner footer (as in your example code), you can use
\usepackage[headsepline,markcase=used]{scrlayer-scrpage}% sets page style scrheadings
\automark*[section]{section}
\automark*[subsection]{}
\ifoot*{\pagemark}
\ofoot*{}

or
\usepackage{scrlayer-scrpage}% sets page style scrheadings
\automark[section]{section}
\automark*[subsection]{}
\clearpairofpagestyles
\ohead{\headmark}
\ifoot*{\pagemark}

To use pagestyle empty on all pages of TOC etc. set
\pagestyle{empty}
\renewcommand\chapterpagestyle{empty}

To switch back to scrheadings
\cleardoublepage
\pagestyle{scrheadings}
\renewcommand\chapterpagestyle{plain}

Important: Use \cleardoubleoddpage before the change of the pagenumbering scheme.
\cleardoubleoddpage
\pagenumbering{arabic}% <- sets the page counter to 1

Regarding your 3. issue: Maybe you have to add option automark to the scrlayer-scrpage options:
\usepackage[headsepline,markcase=used,automark]{scrlayer-scrheadings}
\automark*[section]{section}
\automark*[subsection]{}

or you have to use
\usepackage[headsepline,markcase=used]{scrlayer-scrheadings}
\automark[section]{chapter}
\automark*[section]{section}
\automark*[subsection]{}


text:
Q: Unloading data from Amazon redshift to Amazon s3 I am trying to use the following code to unload data into S3 bucket. Which works but after unloading it throws some error.
 Properties props = new Properties();
 props.setProperty("user", MasterUsername);
 props.setProperty("password", MasterUserPassword);
 conn = DriverManager.getConnection(dbURL, props);
 stmt = conn.createStatement();
 String sql;
 sql = "unload('select * from part where p_partkey in (select p_partkey from
       part limit 10)') to"
       + " 's3://redshiftdump.****' "
       + " DELIMITER AS ','"
       + "ADDQUOTES "
       + "NULL AS ''"
       + "credentials 'aws_access_key_id=****;aws_secret_access_key=***' "
       + "parallel off" +
       ";";
 boolean i = stmt.execute(sql);
 stmt.close();
 conn.close();

The unloading works. It is creating a file in the bucket. But it is giving me some error
   java.sql.SQLException:
      dataengine.impl.DSISimpleRowCountResult cannot be cast to
      com.amazon.dsi.dataengine.interfaces.IResultSet
   at
   com.amazon.redshift.core.jdbc42.PGJDBC42Statement.createResultSet(Unknown
   Source)
   at com.amazon.jdbc.common.SStatement.executeQuery(Unknown Source)

what is this error and how to avoid it? Is there any way to dump the table in CSV format. Right now it is dumping the file in FILE format.

A: You say the UNLOAD works but you receive this error, that suggests to me that you are connecting successfully but there is an problem in the way your code interacts with the JDBC driver when the query completes.
We provide an example that may be helpful in our documentation on the page "Connect to Your Cluster Programmatically"
Regarding the output file format, you will get whatever is specified in your UNLOAD SQL but the filename will have a suffix (for example "000" or "6411_part_00") to indicate which part of the UNLOAD it is.

A: use executeUpdate .

  def runQuery(sql: String)  = {
    Class.forName("com.amazon.redshift.jdbc.Driver")
    val connection = DriverManager.getConnection(url, username, password)
    var statement: Statement = null
    try {
      statement = connection.createStatement()
      statement.setQueryTimeout(redshiftTimeoutInSeconds)
      val result = statement.executeUpdate(sql)
      logger.info(s"statement response code : ${result}")
    } catch {
      case e: Exception => {
        logger.error(s"statement.isCloseOnCompletion :${e.getMessage} ::: ${e.printStackTrace()}")
        throw new IngestionException(e.getMessage)
      }
    }
    finally {
      if(statement != null ) statement.close()
      connection.close()
    }
  }


text:
Q: JavaHL isn't working I try to update a project from SVN (I have a fresh install of eclipse but it's an existing workspace) so I installed subclipse but when I want to to do anything with SVN I get error messages like :
Failed to load JavaHL Library.
These are the errors that were encountered:
no libsvnjavahl-1 in java.library.path
no svnjavahl-1 in java.library.path
no svnjavahl in java.library.path
java.library.path = .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

or
Problems reported while synchronizing SVNStatusSubscriber. 0 of 1 resources were synchronized.
An error occurred synchronizing <Project name>: Error getting status for resource P<Project name> Unable to load default SVN Client
Error getting status for resource P<Project name> Unable to load default SVN Client
Unable to load default SVN Client

I work on Mac OS X 10.6.8 with eclipse indigo 3.7.2.
Can someone help me to make it work?

A: The answer is detailed in this Wiki page:
http://subclipse.tigris.org/wiki/JavaHL
You need to install Subversion native libraries including the JavaHL library.  I would recommend using MacPorts or HomeBrew to get the native libraries.

A: Does one really need to have JavaHL? I was just ignoring the error and I could still use svn without any problem.

A: Make sure that your version of Subclipse and your native JavaHL libraries match (please check http://subclipse.tigris.org/wiki/JavaHL for details).
When unsure about the version of JavaHL, do something like
$ strings /opt/local/lib/libsvnjavahl-1.a | fgrep svn:
svn:auth:username
svn:auth:password
svn:auth:config-dir
svn:
svn:1.8.8 (r1568071)

Here, I have the 1.8.8 version installed. Btw, this one appears to work well with Subclipse 1.10.x.
Then check whether your native library folder, for example /opt/local/lib when using MacPorts, is taken into account. MacPorts for example adds symbolic link /Library/Java/Extensions/libsvnjavahl.jnilib, thus there is no need to configure java.library.path on launching Eclipse or STS.
Again if unsure, you may try something like
STS --launcher.appendVmargs -vmargs -Djava.library.path=/opt/local/lib

Be aware however, that the launch configuration above overrides the default setting of java.library.path which may trigger other (non 100% pure) plugins to fail.


text:
Q: How to get voters lists from all linked issues I am trying to create a JIRA plugin that does the following:

*

*For each issue, takes all linked issues which are linked by "duplicates" or "is duplicated by" (or other predefined link types).

*For each such issue, get a list (not necessarily a List object) of the voters on that issue.

My problem is that the javadoc has little to no information. Following a tutorial, I currently have:
public class VotersCount extends AbstractJiraContextProvider {

    @Override
    public Map<String, Integer> getContextMap(User user, JiraHelper jiraHelper) {

        Map<String, Integer> contextMap = new HashMap<>();
        Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
//      Issue[] linkedIssues = currentIssue.getLinkedIssuesBy(...); //Step 1 mock code
//      Voter[] voters = linkedissues[3].getVoters(); //Step 2 mock code
        int count = voters.length; //Pretend there is some calculation here
        contextMap.put("votersCount", count);
        return contextMap;
    }
}

(and I use votersCount in the .vm file.)
However, I see no explanation in the javadocs for AbstractJiraContextProvider and getContextMap so I'm not even sure if it's the right approach.
In my own research I found the class ViewVoters which has the method Collection<UserBean> getVoters(), which is something I can work with, but I don't know how to obtain or construct such an object in a way which will interact with a given issue.
I am looking for a working code to replace my 2 lines of mock code.

A: 1) Use one of the methods from IssueLinkService. Maybe getIssueLinks
2) issueVoterAccessor.getVoterUserkeys
Instances of IssueLinkService and IssueVoterAccessor should be injected as parameters to constructor of your VotersCount.

A: I solved it by using the following:

*

*To get issues linked to Issue issue by specified link types:
LinkCollection linkCollection = ComponentAccessor.getIssueLinkManager().getLinkCollectionOverrideSecurity(issue);
Set<IssueLinkType> linkTypes = linkCollection.getLinkTypes();
// Perform operations on the set to get the issues you want.
for (IssueLinkType linkType : linkTypes) {
    List<Issue> l1 = linkCollection.getOutwardIssues(linkType.getName());
    List<Issue> l2 = linkCollection.getInwardIssues(linkType.getName());
}

*To get all the voters on Issue issue:
ComponentAccessor.getVoteManager().getVoterUserkeys(issue);

I was later shown that one can extend CalculatedCFType and override getValueFromIssue which hands you the current issue as a parameter instead of the using
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");


text:
Q: how to kill php/apache child process in windows when we run several ajax requests I have a loop that sends lots of ajax to server. Each ajax downloads from ftp a file. I want to kill all php/ftp or apache children. I am killing the javascript through windows.stop(). The php scripts that are already running don't die (thus, they still download the files), just the others that were supposed to be called but are not called yet, that "die".
I am running apache under windows.

A: In the end, i used:
$pid= getmypid();
exec("Taskkill /f /PID ".$pid);
It solves my problem!!! Thanks to all!


text:
Q: Alternative to using get_avatar function? I used a WP hack for displaying author's pics. For example, my single.php has an author slug which displays the author's pic.
I created a folder called authors in my theme/images folder. Based on the author's ID, I name the file 1.jpg, 2.jpg and so on.
So I call this image as
<img src="<?php bloginfo('template_directory') ?>/images/authors/<?php the_author_ID()?>.jpg" alt="<?php the_author(); ?>">

Now i'm modifying a plugin that displays the authors in the sidebar. However this plugin uses the get_avatar function, which is as follows:
/**
                 * If show avatar option is checked, add get_avatar function to cache.
                 */
                if($jmetc_options['show_avatar'] == 1) {
                    $jmevar['cache'] .= get_avatar($tc->comment_author_email, $jmetc_options['avatar_size']);
                }

Can someone advise me on how to use/modify the get_avatar in order to use the default code that I use?

A: The get_avatar() function applies a get_avatar filter hook, that you can use to change the avatar markup:
return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);

I think this would be the correct way to hook into this filter:
function mytheme_get_avatar( $avatar ) {
    $avatar = '<img src="<' . get_template_directory_uri() . '/images/authors/' . get_the_author_ID() . '.jpg" alt="' . get_the_author() . '">';
    return $avatar;
}
add_filter( 'get_avatar', 'mytheme_get_avatar' );

EDIT
p.s. a nice alternative to this approach might be the Simple Local Avatars Plugin.
EDIT 2
The filter is applied using add_filter(), not apply_filters(). That was a typo on my part; fixed now!
EDIT 3
I don't think this is correct:

P.S: Just to clarify.. I replaced
  get_avatar($tc->comment_author_email, $jmetc_options['avatar_size']);
  with add_filter('get_avatar', $avatar, $id_or_email, $size, $default,
  $alt);

First, you still call get_avatar() in your template file, passing all the same parameters as previous. The add_filter() call belongs in functions.php.
Second, you can pass additional parameters to your filter function; e.g.:
function mytheme_get_avatar( $avatar, $id_or_email, $size ) {
    $avatar = '<img src="<' . get_template_directory_uri() . '/images/authors/' . $id_or_email . '.jpg" alt="' . get_the_author() . '" width="' . $size . 'px" height="' . $size . 'px" />';
    return $avatar;
}
add_filter( 'get_avatar', 'mytheme_get_avatar', 10, 3 );

A: There is a small error in above's function
better use this:
function mytheme_get_avatar( $avatar, $id_or_email, $size ) {
    $avatar = '';
    return $avatar;
}
add_filter( 'get_avatar', 'mytheme_get_avatar', 10, 3 );


text:
Q: Copy the Setup file to a folder named with version number in TFS We are using TFS build and when I built the project in TFS build, it also creates a setup file.
For example, my application version is V1.2.3 (its from assembly.cs) the location of the setup file is C:\myproject\setup\setup.exe
Well I want to copy this setup exe into the following folder
C:\products\producta\ V1.2.3
So I just need to get version number to create a folder named "V1.2.3". For copying and creeating, i can make a batch file but i do not know how to get version number. TFS has some variables for example Build.SourceVersion
but these variables do not give me the product's version number.
How I can do this thing?

A: You have to write a script to do this.
1) Powershell script to read the build number from assemblyInfo.cs
$myAssemblyVersion = major.minor.patch -> Read from assembyInfo.cs
$versionWithBuildId = '{0}.{1}' -f $myAssemblyVersion, $Env:BUILD_BUILDID

2) Update the TFS internal build number from current build
Write-Verbose -verbose "##vso[build.updatebuildnumber]$versionWithBuildId"

After that you can use the "Copy Files" or "Publish Artifact" step.
With "Copy Files"
Target Folder = "C:\products\producta\$(Build.BuildNumber)"

With "Publish Artifact"
Artifact Name = "$(Build.BuildNumber)"

Path = "C:\products\producta"


text:
Q: filter ACF choice field based on another choice field just want to maniupulate my ACF fields in this way:
a first choice dropdown field (Island Choice) with these values
Island Choice

*

*Corfù

*Lefkada

*Zante

and then a second choice dropdown field (Island's locality) dynamically filtered based on one of the previuos Choice, in example
if Corfù is selected then
Island's locality

*

*Acharavi

*Gouvia

*Dassia

if Lefkada is selected then
Island's locality

*

*Nikia

*Nidri

*Poros

if Zante is selected then
Island's locality

*

*Laganas

*Blue Caves

*Navagio

I have found this documentation,
https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-select-example

but is not very clear to me how to implement this into my wordpress environment (I'm a senior IT but not so good with php) just want someone to give me a starting point..
many thanks
FURTHER INFORMATIONS
basically:

*

*I have a wordpress site with a child theme and a deep customized
functions.php file.

*this functions.php I have added actions for
create a custom post type called "accomodation".

*next I have created a field group called "accomodation-fields".

*Inside this group I have created two choice fields "Island Choice" and "Island's Locality" ,and as I wrote before I want the second field filtered by the first one.

A: Ok I didn't contact the developer cause I cannot find a contact button on github.. but it was simple.

*

*the php file in the repository must be past into my functions.php

*place the js somewere and edit the php file to retrieve the correct
js path

*import all json into acf and cptui to have the examples of
the developer

*fill some cities and states

done
it works perfectly with the newest ACF versions but of course this is only a starting point, I have to deep customize this code for my use.


text:
Q: No Community ♦ bumping in Meta please? There's quite some discussion about Community ♦ bumping. It's purpose is to get a question more attention/responses/answers.
I think that on Meta it's extremely rare for a posted question not to get any attention/repies/answers. I see Community ♦ only bumping up old, already talked to death, no longer relevant, or no one cares anymore kind of topics. Perhaps I don't spend enough time on Meta, but I've yet to see a good bump.
Should Community ♦ bumping be halted for Meta.StackOverflow?
Related : Disabling this feature was also mentioned in this post.

A: Yes. New users to meta should be searching in the tags they are interested in to read up on older discussions. I was reading the archives for at least a month before I posted my first question and started following new posts.
It's clear that the "rules" don't work the same way on meta, so this would be one more way of acknowledging it. E.g. it often doesn't make any sense to accept an answer, upvoting and downvoting mean different things, and discussions and subjective questions are totally normal and encouraged.
Plus, this would never be tolerated on Stack Overflow:

A: I think it bumps those questions that are eligible for the "unanswered" list -- i.e., no upvoted answers. That's why I sometime just add an answer to such a question or vote up an answer if there's one, so it won't get bumped again.

A: No, there are many new users coming in to Meta all the time, so it gives them a chance to give input on old issues, without creating new questions.


text:
Q: How can I get my Chart.JS to center within a div? I'm creating a pie chart using Chart.JS like so:
<canvas id="top10ItemsChart" width="320" height="320"></canvas>

..and then, of course, providing it data and such. But it displays in the div wherein it is ensconced aligned to the left. I prefer it centered (more-or-less, anyway) within the div. I tried all of the following, but none of them make it budge; it stays magnetized to the left side.
<canvas id="top10ItemsChart" margin-left="80px" width="320" height="320"></canvas>

<canvas id="top10ItemsChart" padding-left="80px" width="320" height="320"></canvas>

<canvas id="top10ItemsChart" left="80px" width="320" height="320"></canvas>

A centering would be perfect, but I would be satisfied with providing it a hard value, as I try to do above.
The entire html is:

Top 10 Items

        <canvas id="top10ItemsChart" width="320" height="320"></canvas>

A: There are two things here that are important to not mix up: HTML Attributes, and CSS tags/properties. An attribute is the class="topleft" part of
 (you can see the full list here). A CSS tag is what holds things like display: block;. You can edit CSS tags with an HTML attribute, so if you want to set the margin for something, you would create an attribute called 'style' and put the css tag inside, like
. You were trying to use attributes to edit CSS tags, which is why you couldn't change padding or margins. There is some overlap between css tags and html attributes, such as height and width, which is why you could still edit the height and width with attributes.
For your needs, I would definitely use CSS. From what I understand, you want .topleft (css selector for anything with class="topleft", in case you are new to this) to be stuck to the left side of .col-md-6, and you want everything inside of .topleft to be centered. If that is the case, then give .topleft the tags text-align:center; to set its contents to be centered, and float:left; to keep .topleft floating to the left of .col-md-6. Also give .col-md-6 the tag display:inline-block; to keep things looking nice.

Top 10 Items

    <canvas id="top10ItemsChart" width="320" height="320"></canvas>


text:
Q: How to update a branched out develop branch with updates from the original develop branch? Illustrated with the git flow diagram below:

*

*I have an original develop branch (develop) that branched out to another develop branch (develop-2) that will be pulled into develop in the very far future.

*I am allowed to perform pull requests on these develop branches (develop and develop-2), but not allowed to edit them directly.

*I need an update that has occurred in develop after the branching out of develop-2 to add a new feature to develop-2.

How can I do this?

A:
if I do that, my final PR develop-2 > develop

It should not, provided the PR is done after develop2 is rebased on top of the target branch (develop)
That rebase will get rid of any duplicate commit (like one introduced by a cherry-pick or a previous PR).
Then a PR from develop2 to develop can take place.


text:
Q: Jquery ajax response seems to ignore classes When the page is first opened all of the formatting and functions that depend on CSS classes work exactly as they do, as soon as I call the ajax response it seems as if the classes are being ignored.
The html

    <?php
        $sql = "SELECT * FROM standards
                LEFT JOIN image
                ON image.imageID = standards.imageID_standard
                WHERE auditID_standard = '$audit_id'";
        $result = mysqli_query($mysqli,$sql) or die(mysqli_error($mysqli));
        while($row = mysqli_fetch_assoc($result)){?>

<img src="<? echo $row['imageLocation']; ?>" width="200" >
<?
        }?>

The php used for the ajax response
$output .='
';
while($row = mysqli_fetch_assoc($result)){
   $output .='
';
   $output .='';
   $output .='
'.$row['imageID'].'
';
   $output .='
';
}
$output .='
';
echo $output;

The ajax call
$.ajax({
    url: 'ajax/create_audit_standard_carosel.php',
    type:'POST',
    data: 'audit_id='+audit_id,
    success: function(response){
        $('#selected_standards').html(response);
        var myStylesLocation = "touchcarousel/touchcarousel.css";
        $('<link rel="stylesheet" type="text/css" href="'+myStylesLocation+'" >').appendTo("head");
    }, // End of success function of ajax form
    error:function (xhr, ajaxOptions, thrownError){
        alert(thrownError);
    }
});

I have tried using json, or using .append to add it to a list rather than replacing it, reloading the css, inline styling, everything, but as as the ajax call replaces the contents of the div the li and ul elements lose all of their classes despite the fact that the console html output shows the classes in place.
Just to add if I add a page reload to the ajax the formatting is back, but that kind of defeats the object of ajax

A: I think the best way to achieve it, it's to change the style of your elements via the use of the class attributes.
For example :
CSS
.nonajaxed-display ul li {
    color: red;
    /* etc...*/
}

.ajaxed-display ul li {
    color: blue;
    /* etc... */
}

HTML

           test

           // etc...

JS
$.ajax({
    url: 'ajax/create_audit_standard_carosel.php',
    type: 'POST',
    data: 'audit_id=' + audit_id,
    success: function (response) {
        $('#selected_standards').addClass('ajaxed-display');
        $('#selected_standards').removeClass('nonajaxed-display');
        $('#selected_standards').html(response);
    }, // End of success function of ajax form
    error: function (xhr, ajaxOptions, thrownError) {
        alert(thrownError);
    }
});

Sorry for my bad english.


text:
Q: How can I fix 'premature end of change in file'? I'm trying to migrate an old cvs repository to git. Therefore I use cvs2git (cvs2svn 2.4.0).
There I have some files, which are corrupted: 'is not a valid ,v file.
In order to correct these I check the rcs file format. I have detected, that everytime when the error occurs an '@', text area or an whole revision delta is missing. So I've added the missing text signs. This works very well.
But in two cases the following error occurs in pass4 of cvs2git conversion:
[checkout aborted:] premature end of change in 'file'

Has anybody an idea, for which reasons this error occurs?

A: Use rcs log yourfile,v and it might give you a better understand of what is wrong with the file than cvs2git will give you
if these files are no longer important simply remove them from CVS
you can also consider removing them from the Attic if your trying to convert the attic too.
rcs works on the most recent version first, so it may be possible to drop that diff and make the previous diff the last one (by removing the next revision)
read this RCS Format about how to edit the ,v files


text:
Q: Using Python to generate JSON Data I'm working on a little project, the aim being to generate a report from a database for a server. The database is SQLite and contains tables like 'connections', 'downloads', etc.
The report I produce will ultimately contain a number of graphs displaying things like 'connections per day', 'top downloads this month', etc.
I plan to use flot for the graphs because the graphs it makes look very nice:
This is my current plan for how my reports will work:

*

*Static .HTML file which is the report. This will contain headings, embedded flot graphs, etc.

*JSON Data file. These will be generated by my report generation python script, they will basically contain a JSON variable for each graph representing the dataset that the graph should map. ([100,2009-2-2],[192,2009-2-3]...)

*Report generation python script, this will load the SQLite database, run a list of set SQL queries and spit out the JSON Data files.
Does this sound like a sensible set up? I can't help but feel it could be improved but I don't see how. I want the reports to be static. The server they run on cannot take heavy loads so a dynamically generated report is out of the question and also unnecessary for this application.
My concerns are:

*

*I feel that the Python script is largely pointless, all of the processing performed is done by SQLite, my script is basically going to be used to store SQL queries and package up the output. With a bit more work SQLite could probably do this for me.

*It seems I'm solving a problem that must have been solved many times before 'take sql queries, spit out pretty graphs in a daily report' must have been done hundreds of times. I'm just having trouble tracking down any broad implementations.

A: It sounds sensible to me.

*

*You need some programming language to talk to SQLite. You could do it in C, but if you can write the necessary glue code easily in Python, why not? You'll almost certainly save more time writing it than you'll lose from not having the most efficient possible program.

*There are definitely programs to analyse logs for you - I've heard of Piwik, for instance. That's for dynamic reports, but no doubt there are projects to do static reports too. But they may not fit the data and output you're after. Writing it yourself means you know precisely what you're getting, so if it's not too much work, carry on.

A:
I feel that the Python script is largely pointless, all of the processing performed is done by SQLite, my script is basically going to be used to store SQL queries and package up the output. With a bit more work SQLite could probably do this for me.

Maybe so, but even then, Python is a great glue language.  Also, if you need to do some processing SQLite isn't good at, Python is already there.

It seems I'm solving a problem that must have been solved many times before 'take sql queries, spit out pretty graphs in a daily report' must have been done hundreds of times. I'm just having trouble tracking down any broad implementations.

I think you're leaning towards the general class of HTTP-served reporting.  One thing out there that overlaps your problem set is Django, which provides a Python interface between database (SQLite is supported) and web server, along with a templating system for your outputs.
If you just want one or two pieces of a solution, then I recommend looking at SQLAlchemy for interfacing with the database, Jinja2 for templating, and/or Werkzeug for HTTP server interface.


text:
Q: Codeigniter 2.1, PHP - count array for requested value in two dimensional array I have this code:
<?php foreach ($galerije as $gal): ?>

<?php echo str_replace('_', ' ', $gal['naziv']) ?>

<?php echo word_limiter($gal['opis'], 30) ?>

<?php echo count($slike) ?>

<?php endforeach ?>

$galerija represent all the galleries in the DB and have id_galerija as the primary key.
$slike represent all the images in the DB and they have one to many relationship with galerija (one gallery can have many images). It is connected with galerija_id (slike.galerija_id = galerija.id_galerija). How can I count number of images for every gallery?

A: You could do it like this:
$galleries = array(array(
    'Galleryname' => 'Picasso',
    'Galleryimages' => array(
        '1.jpg',
        '2.jpg',
        '3.jpg',
        '4.jpg'
        ),
    array(
        '1.jpg',
        '2.jpg'
        ),
    array(
        '1.jpg',
        '2.jpg',
        '3.jpg',
        '4.jpg',
        '5.jpg',
        '6.jpg'
        ),
    ),
array(
    'Galleryname' => 'Matisse',
    'Galleryimages' => array(
        '1.jpg',
        '2.jpg'
        ),
    array(
        '1.jpg',
        '2.jpg',
        '3.jpg'
        ),
    array(
        '1.jpg',
        '2.jpg',
        '3.jpg',
        '4.jpg',
        '5.jpg',
        '6.jpg',
        '7.jpg',
        '8.jpg'
        ),
    )
);

$counts = array();
foreach ($galleries as $key => $value) {
    $counts[$value['Galleryname']] = (count($value, COUNT_RECURSIVE)-count($value));
}

echo '
';
print_r($counts);
echo '
';

Which would end up with:
Array
(
    [Picasso] => 12
    [Matisse] => 13
)

Is that what you wanted?

A: wrap it
i is the count
$i = 0;
foreach ($Contents as $item) {
    $i++;
    $item[number];
}


text:
Q: Get the bounding box of the visible dash-leaflet map? This SO question contains an explanation for how to dynamically get the extents of a Leaflet map.
I wonder if there is a way of doing this with dash-leaflet, so I can get this in a callback every time a map updates.

A: You can get this information via the bounds property of the map object. Here is a small example,
import json
import dash_leaflet as dl
from dash import html, Input, Output, Dash

app = Dash()
app.layout = html.Div([
    dl.Map(dl.TileLayer(), style={'width': '1000px', 'height': '500px'}, id="map"),
    html.Div(id="log")
])

@app.callback(Output("log", "children"), Input("map", "bounds"))
def log_bounds(bounds):
    return json.dumps(bounds)

if __name__ == '__main__':
    app.run_server()


text:
Q: Create a keyword field concatenated of other fields I've got an index with a mapping of 3 fields. Let's say f1, f2 and f3.
I want a new keyword field with the concatenation of the values of f1, f2 and f3 to be able to aggregate by it to avoid having lots of nested loops when checking the search results.
I've seen that this could be achieved by source transformation, but since elastic v5, this feature was deleted.
ElasticSearch version used: 6.5
Q: How can I archieve the concatenation in ElasticSearch v 6.5?

A: There was indeed source transformation prior to ES 5, but as of ES 5 there is now a more powerful feature called ingest nodes which will allow you to easily achieve what you need:
First, define an ingest pipeline using a set processor that will help you concatenate three fields into one:
PUT _ingest/pipeline/concat
{
  "processors": [
    {
      "set": {
        "field": "field4",
        "value": "{{field1}} {{field2}} {{field3}}"
      }
    }
  ]
}

You can then index a document using that pipeline:
PUT index/doc/1?pipeline=concat
{
  "field1": "1",
  "field2": "2",
  "field3": "3"
}

And the indexed document will look like:
{
  "field1": "1",
  "field2": "2",
  "field3": "3",
  "field4": "1 2 3"
}

Just make sure to create the index with the appropriate mapping for field4 prior to indexing the first document.


text:
Q: Como bloquear HotLinks de imagens com aviso? A pouco tempo vi um site que estava exibindo uma imagem hospedada em outro site, pelo menos tentando.. O que acontece é que no site que estava linkando a imagem alheia passou a aparecer uma nova imagem ao invés da imagem desejada.
A nova imagem consistia em um simples retângulo com a frase indicando que a imagem estava sendo "copiada", observando os fontes do site claramente dava para notar o HotLink:

Meu site já  possui no .htaccess o bloqueio para os HotLinks:
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?nome_do_meu_site.com.br [NC]

Mas como adicionar essa funcionalidade mencionada?

A: Ponha isso em seu htaccess:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?meusite\.com\.br/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /imagem/anticopia.jpg [L]

Após isso, crie uma imagem com o texto desejado ou o que quiser, e altere essa parte do código com o diretório e nome da imagem

/imagem/anticopia.jpg

Altere também, é claro, o "meusite.com.br"
Eu utilizo essa ferramenta em meu site e acho muito útil.


text:
Q: loop through rows of one csv file to find corresponding data in another I got an interesting problem:
file1.csv has a few hundred rows like:
Code,DTime
1,2010-12-26 17:01
2,2010-12-26 17:07
2,2010-12-26 17:15

file2.csv has about 11 million rows like:
id,D,Sym,DateTime,Bid,Ask
1375022797,D,USD,2010-12-26 17:00:15,1.311400,1.311700
1375022965,D,USD,2010-12-26 17:00:56,1.311200,1.311500
1375022984,D,USD,2010-12-26 17:00:56,1.311300,1.311600
1375023013,D,USD,2010-12-26 17:01:01,1.311200,1.311500
1375023039,D,USD,2010-12-26 17:01:02,1.311100,1.311400
1375023055,D,USD,2010-12-26 17:01:03,1.311200,1.311500
1375023063,D,USD,2010-12-26 17:01:03,1.311300,1.311600

What i'm trying to do is to write a script that takes each DTime value in file1.csv and finds the first instance of a partial match in the DateTime column of file2.csv, and outputs DateTime, Bid, Ask for that row. The partial match is on the first 16 characters.
Both files are sorted from oldest to newest, so if "2010-12-26 17:01" from file1.csv matched 4 entries in file2.csv, I only need to extract the first one: "2010-12-26 17:01:01"
Not sure how to proceed..  I tried a dictionary but the order of values is important so i'm not sure if that would work. Maybe bring file1's DTime column into a list and for each entry in that list search DateTime in file2?
Thanks guys

A: If you don't have duplicate DTime values, this should work:
import csv

file1reader = csv.reader(open("file1.csv"), delimiter=",")
file2reader = csv.reader(open("file2.csv"), delimiter=",")

header1 = file1reader.next() #header
header2 = file2reader.next() #header

for Code, DTime in file1reader:
    for id_, D, Sym, DateTime, Bid, Ask in file2reader:
        if DateTime.startswith(DTime): # found it
            print DateTime, Bid, Ask   # output data
            break                      # break and continue where we left next time

Edit
import csv
from datetime import datetime

file1reader = csv.reader(open("file1.csv"), delimiter=",")
file2reader = csv.reader(open("file2.csv"), delimiter=",")

header1 = file1reader.next() #header
header2 = file2reader.next() #header

for Code, DTime in file1reader:
    DTime = datetime.strptime(DTime, "%Y-%m-%d %H:%M")
    for id_, D, Sym, DateTime, Bid, Ask in file2reader:
        DateTime = datetime.strptime(DateTime, "%Y-%m-%d %H:%M:%S")
        if DateTime>=DTime: # found it
            print DateTime, Bid, Ask   # output data
            break                      # break and continue where we left next time

A: Unless you only need to do this once, you should really use a database. Add a column to table2 that contains DATETIME without the seconds, so that you can join on exact matches, not with LIKE.
It WILL be fast, and even faster if you index those columns. And if you can store file1.csv in the database too, you don't need iterations: You can get the entire set of results in a single select query. This is the kind of stuff SQL is made for.
PS. If you decide to pursue this approach, you can ask for help with the query.

A: you can create a dictionary from file2, where the key is the prefix of the time you want, and the value is either first row, or all the rows matching this prefix.
then it's simply a matter of doing something like:
entries = file2Dict.get(file1Entry)
if entries:
   print  "First entry is %s" entries[0]


text:
Q: Exception in thread "Thread-2" java.lang.NoSuchMethodError: kotlin.io.ByteStreamsKt.readBytes(Ljava/io/InputStream;) for PACT tests I'm getting this kotlin exception when trying to run some PACT tests using Java and not sure how to fix it please.
Here the error :

Exception in thread "Thread-2" java.lang.NoSuchMethodError:
  kotlin.io.ByteStreamsKt.readBytes(Ljava/io/InputStream;)[B

EDIT
I've updated my PACT dependencies to use more up to date versions, and I'm still getting the same issue, however only when I have the below dependency as part of it and not sure why.
 <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.3.RELEASE</version>
</parent>

This is my current pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.hmhco</groupId>
<artifactId>update-catalog</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.3.RELEASE</version>
</parent>

<properties>
    <rest-assured.version>3.0.0</rest-assured.version>
    <json-schema-validator.version>3.3.0</json-schema-validator.version>
</properties>

<dependencies>
    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>${rest-assured.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>json-schema-validator</artifactId>
        <version>${json-schema-validator.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>au.com.dius</groupId>
        <artifactId>pact-jvm-consumer-junit5</artifactId>
        <version>4.0.10</version>
    </dependency>
    <dependency>
        <groupId>au.com.dius</groupId>
        <artifactId>pact-jvm-provider-junit</artifactId>
        <version>4.0.10</version>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>au.com.dius</groupId>
            <artifactId>pact-jvm-provider-maven</artifactId>
            <version>4.0.10</version>
            <configuration>
                <pactDirectory>target/pacts</pactDirectory>
                <pactBrokerUrl>http://pact-broker-hmh.devel.hmheng-qe.brnp.internal/</pactBrokerUrl>
                <projectVersion>${project.version}</projectVersion>
                <trimSnapshot>true</trimSnapshot>
            </configuration>
        </plugin>
    </plugins>
</build>

And that's what I see when look for Kotlin after running maven dependency tree. The complete project can be found here.

Thanks very much.

A: A possible reason you are getting that error (I'm assuming) is because you are mixing major versions of the Pact libraries.
<pact.version>3.5.24</pact.version>
<pact-jvm-provider-maven.version>3.5.9</pact-jvm-provider-maven.version>
<pact-jvm-maven.version>3.5.24</pact-jvm-maven.version>
<pact.jvm.consumer.junit.version>4.0.10</pact.jvm.consumer.junit.version>

You have versions 3.5.9, 3.5.24 and 4.0.10. You should use the same major version.
Versions 3.5.x are mostly written in Kotlin (probably version 1.2.x), while version 4.0.x is written using Kotlin 1.3.x.
I'm not sure why Sprinboot is impacting things, but maybe a Spring dependency is also bringing in a version of the Kotlin standard library.
The best thing to do is use version 4.0.10 for all the Pact libraries, then run the Maven dependency tree plugin and check that versions of the Kotlin standard libraries that are being used.


text:
Q: Trying to install spyder3, but getting spyder2 I'm currently using Ubuntu 16.04.
When I try to install spyder3 from the repositories using
apt-get install spyder3

It installs spyder2 for python3.5. so I get the splash screen, the interface and the configuration folder as same as the spyder2.
How do I install spyder3?

A: In order to install spyder3 package you must first enable the universe repository. Once that step is completed you will be able to install the spyder3 package which currently actually provides 2.3.0 with the following command:
sudo apt-get install spyder3
Note: If you wish to eliminate the spyder2 configuration files as well as the package you may wish to backup to avoid any unintended consequences and then purge the spyder2 package with sudo apt-get purge --auto-remove spyder
To obtain the latest version of spyder (currently 3.1.4)
If you use anaconda:
conda update qt pyqt
conda update spyder

Only If you don't use anaconda
pip install -U spyder

If you use anaconda the pip command could break your installation. This is of small concern if you follow my advice about creating a backup and a potentially large problem if you don't.
Sources:
http://packages.ubuntu.com/search?suite=all&section=all&arch=any&keywords=spyder3&searchon=names
How do I enable the "Universe" repository?
How can you completely remove a package?
https://github.com/spyder-ide/spyder/releases


text:
Q: Multiple application directories in FuelPHP For the last couple of years, I've been developing a web application based on CodeIgniter. CI has served me well to date, but for the next generation of the software, I'm looking to move to PHP 5.3 and a more robust framework. I've watched FuelPHP since it showed up about a year ago and now that I'm getting to the point of starting the development of the next version of the application in earnest, I'm interested in giving FuelPHP a go.
My application relies on the use of multiple application directories. Essentially, there's a system application which has the system's core functionality, code that shouldn't be touched by admins because it'll be changed during updates. In addition, there's a user application directory where admins can extend and override system classes. This way, admins can customize the system without ever touching the system core (thus insulating them from losing their modifications when the system is updated). When a request comes in from the URL, I want the system to first check the user application directory. If it doesn't find the controller there, move on to the system application directory (where, in theory, it should find the file) and use that controller.
I don't want to make the mistake of approaching this problem from a CI or Kohana mindset, so what I'm wondering is what's the best way to go about doing this in FuelPHP? Since I don't have much experience with FuelPHP, I was hoping someone might be able to give me some pointers or shove me in the right direction.
Thanks!

A: FuelPHP has an 'app' folder that you can consider the core of your application. For smaller applications, it can also contain your application code.
For larger and/or more complex applications, use modules. A module has exactly the same folder structure as 'app', but lives in it's own namespace (= the module folder name). FuelPHP supports multiple module locations, so you could have a location that contains modules you share over different websites, and modules that are specific to your website.
Without any special routing, if the first segment in the URI is a module name, controllers from that module will be loaded.


text:
Q: NSMutableDictionary with non-copyable UIView keys (using CFDictionary) crashes on iOS SDK 6, yet OK on 5.1 So I was using TLMutableDictionaryNoncopiedKeys Category for NSMutableDictionary found here that allows using non-copyable objects as keys for dictionary (I need object-to-object mapping). All was good till I was told app crashes in iOS 6. So I downloaded XCode 4.5 with iOS 6 to test and it appears that there's some problem with CFDictionary functions. If I pass UIView as a key (in my category method) it crashes with:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView copyWithZone:]: unrecognized selector sent to instance 0x719ff70'

More details from AppCode debugger:
objc_exception_throw
-[NSObject(NSObject) doesNotRecognizeSelector:]
__forwarding__
_CF_forwarding_prep_0
-[__NSDictionaryM setObject:forKey:]
-[NSMutableDictionary __addObject:forKey:]
CFDictionaryAddValue
-[NSMutableDictionary(TLMutableDictionaryNoncopiedKeys) setObject:forUncopiedKey:]

I made a test project. It works well with iOS 5.1 Simulator, but crashes with 6.
Could anyone shed some light on this?
Full project is here. And here are some listings:
Category:
#import <Foundation/Foundation.h>

@interface NSMutableDictionary (TLMutableDictionaryNoncopiedKeys)

- (void)setObject:(id)anObject forUncopiedKey:(id)aKey;

@end

----------------------------------------------------------------------

#import "NSMutableDictionary+TLMutableDictionaryNoncopiedKeys.h"

@implementation NSMutableDictionary (TLMutableDictionaryNoncopiedKeys)

- (void)setObject:(id)anObject forUncopiedKey:(id)aKey
{
    CFMutableDictionaryRef selfCF = (CFMutableDictionaryRef)self;
    Boolean keyAlreadySet = CFDictionaryContainsKey(selfCF, aKey);
    if (keyAlreadySet) {
        CFDictionaryReplaceValue(selfCF, aKey, anObject);
    }
    else {
        CFDictionaryAddValue(selfCF, aKey, anObject);
    }
}

@end

Usage:
#import "NSMutableDictionary+TLMutableDictionaryNoncopiedKeys.h"
...
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
UIView *key = [[UIView alloc] init];
[dict setObject:key forUncopiedKey:key];


text:
Q: How do I resolve a whitespace issue in ZyBooks? I am taking an introductory coding class and am using ZyBooks. I am currently working on a challenge which involves printing a two-dimensional list by row and column. I have mostly worked out the code, except for a persistent whitespace issue. I can't figure out where this extra whitespace is and how to get rid of it
user_input= input()
lines = user_input.split(',')

mult_table = [[int(num) for num in line.split()] for line in lines]

for row in mult_table:
    for i in range(len(row)):
        print(row[i],end=" ")
        if i != len(row)-1:
            print('|',end=" ")
    print()

ZyBooks is giving me this error:

Ending with end="" instead of end=" " results in this error:
2nd Error

Thanks!

A: Rather than printing each item and optionally printing the separator after it, print the entire row at once with a single call to print():
for row in mult_table:
    print(*row, sep=" | ")

*row spreads the elements of row into separate arguments to print(), and sep=" | " specifies the separator to use between them instead of just a space.


text:
Q: How to replace mysql_result for a simple login system I'm having some trouble when I'm trying to replace mysql_* with mysqli_* in my code. Everything works except mysql_result. I've searched for answers but I'm a beginner so I had a lot of trouble understanding. It seems like mysqli_result doesn't exist or at least not working.
My current bit of code for the login, with the mysql_result looks like this:
if (isset($_POST['submit'])){

  $sql = "SELECT membersid FROM members
   WHERE user='{$_POST['user']}'
   AND pass='{$_POST['passwd']}'";
   $result = query($con, $sql);

   // If not username or password found, return to index.
   if (mysqli_num_rows($con, $result) == 0){
     header("Location: index.php?badlogin=");
     exit;
   }

   // Unique index for session.
   $_SESSION['sess_id'] = mysql_result($result, 0); //Here is my problem
   $_SESSION['sess_user'] = $_POST['user'];
   header("Location: hem.php");
   exit;
}

// Logout.
if (isset($_GET['logout'])){
   $_SESSION = array();
   session_destroy();
   header("Location: index.php");
   exit;
}

It doesn't work as it is. I get "username or password incorrect". But it worked before I started replacing mysql with mysqli. My question is, how do I replace mysql_result code in order to get this part of the script to work?

A: Assuming your query method uses mysqli then $result is probably a mysqli_result object. You can grab the row and the field using:
$row = $result->fetch_array();
$_SESSION['sess_id'] = $row[0];

Explanation:
$result is a mysqli_result object representing the results of your query.
Calling fetch_array() on this will return the next row of your results (or false if there are no more rows). So this puts a single row, as an array, into the $row variable.
Finally we grab the first column in that row using $row[0].

A: I think you're close. But you're still open to SQL injection. You should NEVER include $_POST in a query directly. Read more on SQL injection prevention over at Bobby Tables.
Problems fixed in this

*

*It looks like $sql should be $result

*mysqli_num_rows only needs your result object, not the connection

*mysql_result is serious old school and there is no equivalent in mysqli. I would HIGHLY suggest you use something more modern like mysqli_fetch_assoc
Code block
if(isset($_POST['submit'])){
   $result = mysqli_query($con, "SELECT membersid FROM members
   WHERE user='{$_POST['user']}'
   AND pass='{$_POST['passwd']}'");

   // If not username or password found, return to index.
   if(mysqli_num_rows($result) == 0){
     header("Location: index.php?badlogin=");
     exit;
   }

   // Unique index for session.
   $row = mysqli_fetch_assoc($result);
   $_SESSION['sess_id'] = $row['membersid'];
   $_SESSION['sess_user'] = $_POST['user'];
   header("Location: hem.php");
   exit;
}