text:
Q: Timer doesn't seem to tick ( until I minimize window ) This is the image of the design window:

Here is the MainForm.Designer.cs file:
namespace SamsCSharp24
{
    partial class ImeObrasca
    {
        // irrelavent code is omitted, only event subscriptions are left
        private void InitializeComponent()
        {
            // irrelavent code is omitted for brewity
            //
            // SelectPicture
            //
            this.SelectPicture.Paint += new System.Windows.Forms.PaintEventHandler(this.SelectPicture_Paint);
            this.SelectPicture.Click += new System.EventHandler(this.SelectPicture_Click);
            //
            // Quit
            //
            this.Quit.Click += new System.EventHandler(this.Quit_Click);
            //
            // PictureBox
            //
            this.PictureBox.MouseLeave += new System.EventHandler(this.PictureBox_MouseLeave);
            this.PictureBox.MouseEnter += new System.EventHandler(this.PictureBox_MouseEnter);
            //
            // btnOptions
            //
            this.btnOptions.Click += new System.EventHandler(this.btnOptions_Click);
            //
            // timerClock
            //
            this.timerClock.Tick += new System.EventHandler(this.timerClock_Tick);
        }

        #endregion
    }
}

Here is the MainForm.cs file:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SamsCSharp24
{
    public partial class ImeObrasca : Form
    {
        public ImeObrasca()
        {
            InitializeComponent();
            // when uncommenting below line, window is not seen in taskbar
            // this.ShowInTaskbar = false;
        }

        // other code is omitted for brewity
        private void SelectPicture_Paint(object sender, PaintEventArgs e)
        {
            // just for fun, change color of a button to light blue
            SelectPicture.BackColor = Color.Azure;
        }

        private void timerClock_Tick(object sender, EventArgs e)
        {
            // when timer ticks, change label's text into current time of day
            staticClock.Text = "Current time of day: " +
                DateTime.Now.Hour.ToString() + " : "  +
                DateTime.Now.Minute.ToString() + " : " +
                DateTime.Now.Second.ToString();
        }
    }
}

Timer control has following properties set via designer:
Enabled = true;
Interval = 1000
Name = timerClick
Tick (event) = timerClock_Tick

As for label, here are the properties also set with designer:
BorderStyle = FixedSingle
Name = staticClock
Autosize = false
Text =
Other properties are default or irrelevant ( like Location or Size )

PROBLEM:
When I run the application ( in Debug mode ), window appears with properly placed controls and with proper look. Every other part of the code works successfully ( picture opening / drawing etc ) but the label remains empty, as initially set in the designer.
After I minimize / maximize the window, the label text is set correct. I have tried to move the part of the window with label "out" of the screen and get it back to see what happens. The text in the label was changed sometimes -> it didn't update correct.
MY EFFORTS TO SOLVE THE PROBLEM:
This is my first time trying out C# and WinForms so I have tried to find some online documentation on timers.
After examining .Designer.cs file I have found out that the timer from toolbox belongs to System.Windows.Forms.Timer class. I found nothing there to help me, since in Remarks section is stated that setting property Enabled to true starts the timer, and setting it to false stops it.
I have tried to put simple message box, and it started popping properly when the window was minimized. When window is in normal state nothing showed, but other parts of the program worked well ( picture opening / drawing / etc ).
After trying to Google for solution / searching here on SO, I have found no concrete solution ( although some suggestions were made, but as I said, they weren't helpful to me ).
QUESTION:
How to modify timer's tick handler, so label's text can be modified every second?
What am I doing wrong?

A: As Hans Passant stated in one of the comments, "Paint event handlers should only paint, they should never change properties that cause the Paint event to be fired again. Such shenanigans cause the UI thread to burn 100% core, never getting to dispatch the low-priority synthesized messages. Like WM_TIMER. Minimizing the window stops that, temporarily."


text:
Q: What is the singular for an octadic? As I understand the octadic is 8 of something.
In relation to sections, what would be a single section called in the octadic?
The comparison I draw from is the quartile, each 'section' being a quarter.
Is there a similar case for the octadic?
To further explain, what would a shaded section in this picture be referred to as? For a quarter, I would refer to this area as a quartile.

Edit: I am aware it may be possible (maybe not) to use 'the eighth'. However, it just doesn't feel correct.

A: With your picture, I wonder if octile is not simply what you are looking for?
Quarter => quartile
Eighth => octile
Tenth => decile
Hundredth => percentile

A: For the specific diagram you give, an eighth-part is an octant, using the following senses of the word.

*

*The eighth part of a circle; an arc of 45 degrees.

*(geometry): The eighth part of a disc; a sector of 45 degrees; half a quadrant.

A fourth of the diagram is a quadrant, in the sense "One fourth of a circle or disc; a sector with an angle of 90°".  (More commonly, quadrant has the sense  "One of the four sections made by dividing an area with two perpendicular lines" or of being one of the regions of the Cartesian plane that are bounded by the x-axis and y-axis; the  "first quadrant" being the region where x>0, y>0;  "second quadrant" where x>0, y<0; etc.)

A: A single section of 8 would be an eighth (notice the extra "H" at the end):
eighth  [eytth, eyth]

adjective

*

*next after the seventh.

*being one of eight equal parts. noun

*an eighth part, especially of one (⅛).

But as oerkelens says, a single of an Octennial is a year.

A: Suboctuple:  Sub*oc"tave\, Suboctuple \Sub*oc"tu*ple\, a. Containing one part of eight; having the ratio of one to eight. --Bp. Wilkins.

A: Singleton:  A single object, especially one of a group.
This definition has the added benefit of not being tied to the number eight.  For instance, it works equally well as a single item belonging to a group of 27 items.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Как вставлять картинки Как выбрать и вставить картинку из особых листов, где картинок много.
И что это вообще за листы?
A: позиционируют как бэкграунд:
background-image: url("http://s.ytimg.com/yt/imgbin/www-refresh-vflMLqC23.png");
background-position: -25px -48px;

а делается это для того, чтобы не грузить >9000 картинок при загрузке страницы, а только одну


text:
Q: NSSwitchButton alternatives I am writing a Mac application that provides a "test" like function.  This application (through a connection with a server).  Basically the application will give the students a story to read, followed by a series of questions (also from the server) where the user can (attempt) to select the correct answers, and send the result back to the server to be verified.
Implementing the "story" part was easy.  Just send all of the text to a NSTextView.  I had been planning to implement the "select your answer" as programmatically created NSSwitchButtons.  However, some of the possible answers might take up more than one line.  I have not been able get (any) NSButton class to wrap text based on the frame size, and there doesn't seem to be an easy way to override NSButtonCell to allow the text to wrap.
What other Cocoa class(es) should I use to accomplish this task?  I need to have a check-box interface (so that people can select one or more possible answers, and the answers can be an arbitrary length - within reason!)  Ideally it would also be easy to use so that it will be easy to programatically layout the answers as well.  (Some problems may only have 2 choices, while others may have 5+)  I can't imagine I'm the only one who needs this type of functionality
(Oh...since a picture is worth 1,000 words, I've attached a screen-shot of my app below with some answer text running off of the screen)

A: An NSButton will respect explicit linefeed characters embedded in the text, but I suppose that would not meet your needs.  An alternative would be to have a static text item next to a checkbox with no title.  Of course, if you want to be able to toggle the checkbox by clicking the text, you would have a little more programming to do.


text:
Q: Borg backup remotely gives error Trying to use borg to backup Machine 1 to a remote Machine 2(which is synology), gives the error
Remote: sh: borg: command not found
Connection closed by remote host. Is borg working on the server?

All permissions and firewall have been tested. Machine1 can ssh to Machine2 but when trying to do borg init --encryption=repokey borgdemo@Machine2:./demo from Machine1, it is giving the above error. Trying to use borg on Machine2 works fine. Any ideas?

A: Sometimes, you cannot create such a symlink on the remote server (not enough rights on machine 2)
so, the quickest way to deal with different paths is to use the --remote-path argument on the client side:
/usr/bin/borg init --remote-path /usr/local/bin/borg borgdemo@Machine2:./demo

...but the best solution is to force an absolute path on the server side on the ssh config
$ cat .ssh/authorized_keys
command="/usr/local/bin/borg serve" ssh-ed25519 AAAAC...xyz

with this setting, every borg connection from the client through the ssh tunnel will be handled on the server side calling the right binary

A: Oh, I found the answer here.
https://pod.disroot.org/posts/e18176ef-415c-e091-c340-9b5239891533
So, doing which borg on Machine1 was giving me /usr/bin/borg and on Machine2 the output was /usr/local/bin/borg.
All it takes is to create a symlink on Machine2 so it will look like this
borg -> /usr/local/bin/borg


text:
Q: Compiler encoding system-specific file separator I have the following java code:
public interface Defaults {
  public static final String DIR_PATH = "a/b/c/";
  File DIR_FILE = new File(DIR_PATH);
}

public class Main {
  public File directory = Defaults.DIR_FILE;
}

This was compiled on a windows machine and deployed to our local nexus repository. It was then executed during a maven build on a linux machine. I end up with main.directory.list() returning null. Using mvnDebug, I see that the path of the File is actually a\b\c! If I use the debugger to change the directory to new File("a/b/c"), then my code works.
Why did the compiler encode system-specific separators? Is there a solution?

A: Unlike what everyone else tells you, this is unrelated to Windows and File.separator.
String DIR_PATH = "a/b/c/" is just a String, neither Java nor the compiler make any attempt to understand what it could mean, so you get the same value both on Windows and Linux.
Also note that / works as a file separator both on Unix and Windows, so this isn't an issue either. When necessary, Java will convert / to \.
File DIR_FILE = new File(DIR_PATH); is a constant but new File() is still executed by the VM at runtime when the class is loaded. So the path is not converted to Windows format while the compiler generates byte code.
So the problem you describe must be elsewhere or an important part of the code example you posted was changed when you simplified it for the question. My guess is that someone put a Windows-style path into the code elsewhere or maybe the config and you overlooked this.
That said, a safe way to build paths is to use File(File, String):
File DIR_PATH = new File( "a", new File( "b", "c" ) );

This will always build a path that works, no matter what the file separator is. If you must, you can use
File DIR_PATH = "a" + File.separator + "b" + File.separator + "c";

but that can fail for more complex examples and it's more text to read.

A: Yes use File.separatorChar

The system-dependent default name-separator character. This field is initialized to contain the first character of the value of the system property file.separator. On UNIX systems the value of this field is '/'; on Microsoft Windows systems it is '\'.

A: Use platform independent file/directory separators like File.separator

A: public static final String DIR_PATH = "a"+File.separator"+"b"+File.separator+"c"


text:
Q: Uncaught TypeError: Cannot set properties of null (setting 'innerHTML')?
Uncaught TypeError: Cannot set properties of null (setting 'innerHTML')

const tasksContainer = document.querySelector("#tasks");
tasksContainer.innerHTML = html.join("");


text:
Q: Silent arecord recordings I'm using a 32-channel in/out USB class-compliant audio device.  (Behringer X32 with an X-UF card installed.)  I'm trying to record from those channels on a Raspberry Pi with Raspbian Jessie.
arecord --buffer-size=88200 --device=hw:CARD=XUF,DEV=0 --format S32_LE --rate 44100 -c 32 testrec3.wav

This creates a WAV file with 32 channels, at 44.1 kHz, 32-bit, as expected.  I can open the file with Audacity.  However, all the channels are perfectly silent.  Trying to play back the file with aplay, it seems to play back for the appropriate amount of time but is totally silent.
I tested the device under Windows to verify the channels were set up on the X32... they were, and it worked fine.
I believe arecord is hitting the right device, because it won't work unless I specify 32 channels, the right sample rate, and the right sample format.  If I get those parameters wrong, I receive an error, as expected.  If I change the sample rate on the X32 to 48 kHz, I had to change the sample rate on the arecord parameters, as expected.
If I run alsamixer, I don't get any VU meters... just a message:

This sound device does not have any controls.

This is expected.  My device shouldn't have any software-controllable anything.  Just channels in, channels out.  I was hoping for some VU meters though to show what's happening, but AlsaMixer doesn't seem to do that unless there's a controllable mixer.
How can I further debug this issue?  What can I check to figure out why the recording is silent?
Here's the device list:
pi@raspberrypi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: XUF [X_UF], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

pi@raspberrypi:~ $ arecord -L
null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=XUF
    X_UF, USB Audio
    Default Audio Device
front:CARD=XUF,DEV=0
    X_UF, USB Audio
    Front speakers
surround21:CARD=XUF,DEV=0
    X_UF, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=XUF,DEV=0
    X_UF, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=XUF,DEV=0
    X_UF, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=XUF,DEV=0
    X_UF, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=XUF,DEV=0
    X_UF, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=XUF,DEV=0
    X_UF, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=XUF,DEV=0
    X_UF, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=XUF,DEV=0
    X_UF, USB Audio
    Direct sample mixing device
dsnoop:CARD=XUF,DEV=0
    X_UF, USB Audio
    Direct sample snooping device
hw:CARD=XUF,DEV=0
    X_UF, USB Audio
    Direct hardware device without any conversions
plughw:CARD=XUF,DEV=0
    X_UF, USB Audio
    Hardware device with all software conversions

Running amixer contents or amixer -c1 contents returns nothing.  (amixer -c0 contents dues return some things, but that's for the built-in audio, not my USB device.)
There doesn't seem to be anything relevant in /var/log/syslog or dmesg.
Here's the output of arecord --dump-hw-params:
HW Params of device "default":
--------------------
ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT:  S32_LE
SUBFORMAT:  STD
SAMPLE_BITS: 32
FRAME_BITS: 1024
CHANNELS: 32
RATE: 44100
PERIOD_TIME: (136 92880)
PERIOD_SIZE: [6 4096]
PERIOD_BYTES: [768 524288]
PERIODS: [2 1024]
BUFFER_TIME: (272 185760)
BUFFER_SIZE: [12 8192]
BUFFER_BYTES: [1536 1048576]
TICK_TIME: ALL
--------------------

lsusb:

Bus 001 Device 004: ID 1397:0006 BEHRINGER International GmbH

cat /proc/version:

Linux version 4.4.50-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #970 SMP Mon Feb 20 19:18:29 GMT 2017

usb-devices:
T:  Bus=01 Lev=02 Prnt=02 Port=04 Cnt=02 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  2
P:  Vendor=1397 ProdID=0006 Rev=20.41
S:  Manufacturer=BEHRINGER
S:  Product=X_UF
S:  SerialNumber=0x156400fe24
C:  #Ifs= 5 Cfg#= 1 Atr=c0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=20 Driver=snd-usb-audio
I:  If#= 1 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio
I:  If#= 2 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio
I:  If#= 3 Alt= 0 #EPs= 2 Cls=01(audio) Sub=03 Prot=00 Driver=snd-usb-audio
I:  If#= 4 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)


text:
Q: 'int' object is not callable error in python I'm getting this error:
Traceback (most recent call last):
  File "C:\Users\George\Desktop\ex3.py", line 15, in <module>
    s=s+d*2(-1/6.)*(u-1)*(u-2)*(u+2)*(u-4)
TypeError: 'int' object is not callable

Here is my code:
x=input()
z=input()
n=input()
while x>=z:
    x=input()
    z=input()
while n<0:
    n=input()
while n>0:
    d=(z-x)/1.*n
    k=1
    s=(d/2.)*((-1/6.)*(x-1)*(x-2)*(x+2)*(x-4)+(-1/6.)*(z-1)*(z-2)*(z+2)*(z-4))
    while k<=n-1:
        u=x+k*d
        s=s+d*2(-1/6.)*(u-1)*(u-2)*(u+2)*(u-4)
        k=k+1
        print "%.3f" %s
        x=input()
        z=input()
        n=input()
        if n>0:
            while x>=z:
                x=input()
                z=input()

A: You are trying to use 2 as a function:
2(-1/6.)

Insert a * to multiply:
2*(-1/6.)

or as a full expression:
s=s+d*2*(-1/6.)*(u-1)*(u-2)*(u+2)*(u-4)


text:
Q: Getting Attribute Value using XPath in Java, not working I have read several threads on the subject, this one being the closest to what I need, it seems simple, but it just doesn't work.
When I have the next xml:
<Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

  <context xmlns="urn:zimbra"><change token="11127"/>
  </context>

  <Fault>

    <Value>Sender</Value>

   <Reason>
    <Text>no such account: prueba5@empresarias.mx</Text>
   </Reason>
   <Detail>
    <Error xmlns="urn:zimbra">
     account.NO_SUCH_ACCOUNT
     <Trace>qtp1027591600-66260:1597793723503:4b07a03bafc0cc32</Trace>
    </Error>
   </Detail>
  </Fault>

</Envelope>

I can easily get what I need, in my case I need the text in Reason, Text, which I get with:
Object fault =
          xPath
              .compile("/Envelope/Body/Fault/Reason/Text/text()")
              .evaluate(xml, XPathConstants.STRING);

fault value is "no such account: prueba5@empresarias.mx", easy, right?
But when I have the next xml:
<Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

  <context xmlns="urn:zimbra">
   <change token="11127"/>
  </context>

  <GetAccountResponse xmlns="urn:zimbraAdmin">
   <account name="prueba2@empresarias.mx" id="6819863b-fcf1-466f-b711-4310457274b3">
    TRUE
    6819863b-fcf1-466f-b711-4310457274b3
   </account>
  </GetAccountResponse>

</Envelope>

I'm trying to get the value of the attribute "id" inside "account", which I would think (based on other answers), that I would get with the next path:
Object zimbraId =
              xPath2
                  .compile("/Envelope/Body/GetAccountResponse/account/@id")
                  .evaluate(xml2, XPathConstants.STRING);

I have tried several things, like getting the using the attribute "name" to search for it, like this:
Object zimbraId =
              xPath2
                  .compile("/Envelope/Body/GetAccountResponse/account[@name='prueba2@empresarias.mx']/@id")
                  .evaluate(xml2, XPathConstants.STRING);

And many other things, but zimbraId is always "", I didn't want to post this question, but I'm really frustated.
Also, this is how zimbra service responds, so I can't change the xml. I'm suspicious about the "GetAccountResponse" element, but I don't really know what I'm doing wrong.
Any help would be very much appreciated.


text:
Q: How can I wrap a custom text? I have a listbox that uses datatemplates and one of the elements in the template is a textblock. Problem is that the words won't wrap, and I don't want to set a fixed size. Anybody that knows how to resolve this problem? It's driving me crazy!
                   <ListBox Grid.Row=" 1" HorizontalContentAlignment="Stretch" Background="#24221f" ItemsSource="{Binding Messages}" ScrollViewer.VerticalScrollBarVisibility="Visible" ClipToBounds="False" BorderBrush="{x:Null}">
                <ListBox.ItemTemplate>
                    <DataTemplate >
                        <Border BorderBrush="#24221f" BorderThickness="3" Width=" auto">
                            <DockPanel Background="{StaticResource blackBackground}" HorizontalAlignment="Stretch" Width="auto">
                                <Border BorderThickness="3" BorderBrush="Transparent">
                            <Image Source="{Binding IconImageUrl}" VerticalAlignment="top" Height="22" Width ="22" DockPanel.Dock="Left" />
                                </Border>
                                <Border BorderThickness="3" BorderBrush="LightGray" Height="auto" Width="auto" HorizontalAlignment="Left" VerticalAlignment="Center" DockPanel.Dock="Left">
                            <Image Source="{Binding ProfileImageUrl}" VerticalAlignment="Top" HorizontalAlignment="Left" Height="48" Width ="48"  />
                                </Border>
                                <StackPanel Orientation="Vertical" DockPanel.Dock="Left" Margin="5,0,0,0">
                                    <Label Content="{Binding Path=Sender}" Foreground="#feb41c" FontFamily="Verdana" FontWeight="Bold" FontSize="14" />
                                    <TextBlock Width="100" Text="{Binding Path=ShortMessage}" Margin="10,0,0,0" Foreground="BlanchedAlmond" TextWrapping="Wrap" FontFamily="Verdana" />
                                    <Label Content="{Binding Path=Time}" Margin="10,0,0,0" Foreground="DarkGray" FontFamily="Verdana" FontStyle="Italic"/>
                            </StackPanel>
                        </DockPanel>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

A: StackPanel is Evil :=) when i have strange behaviours in a xaml which include StackPanel, switching to a Grid with right parameters ( fixed sized, or stars or "Auto" ) often fix the issue.
Note also that there is an error in your xaml since you set the DockPanel.Dock of your first image (IconImageUrl) whereas it is in the border that surrrounds it that you should be setting it. That may get the Layout to do strange things.

A: just try with HorizontalContentAlignment property to "Stretch" of ListBoxItems using the Style
 <Style TargetType="{x:Type ListBoxItem}" >
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
 </Style>

and also disable the HorizontalScrollBar visibility
ScrollViewer.HorizontalScrollBarVisibility="Disabled"

Update
  <Window.Resources>
    <SolidColorBrush x:Key="blackBackground" Color="Black"/>
    <Style TargetType="{x:Type ListBoxItem}" >
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    </Style>

</Window.Resources>
<Grid>
    <ListBox Grid.Row=" 1" HorizontalContentAlignment="Stretch" Background="#24221f"  ScrollViewer.HorizontalScrollBarVisibility="Disabled"
             ItemsSource="{Binding Messages}" ScrollViewer.VerticalScrollBarVisibility="Visible" ClipToBounds="False" BorderBrush="{x:Null}">
        <ListBox.ItemTemplate>
            <DataTemplate >
                <Border BorderBrush="#24221f" BorderThickness="3" Width=" auto">
                    <DockPanel Background="{StaticResource blackBackground}" HorizontalAlignment="Stretch" Width="auto">
                        <Border BorderThickness="3" BorderBrush="Transparent">
                            <Image Source="{Binding IconImageUrl}" VerticalAlignment="top" Height="22" Width ="22" DockPanel.Dock="Left" />
                        </Border>
                        <Border BorderThickness="3" BorderBrush="LightGray" Height="auto" Width="auto" HorizontalAlignment="Left" VerticalAlignment="Center" DockPanel.Dock="Left">
                            <Image Source="{Binding ProfileImageUrl}" VerticalAlignment="Top" HorizontalAlignment="Left" Height="48" Width ="48"  />
                        </Border>
                        <StackPanel Orientation="Vertical" DockPanel.Dock="Left" Margin="5,0,0,0">
                            <Label Content="{Binding Path=Sender}" Foreground="#feb41c" FontFamily="Verdana" FontWeight="Bold" FontSize="14" />
                            <TextBlock  Text="{Binding Path=ShortMessage}" Margin="10,0,0,0" Foreground="BlanchedAlmond" TextWrapping="Wrap" FontFamily="Verdana" />
                            <Label Content="{Binding Path=Time}" Margin="10,0,0,0" Foreground="DarkGray" FontFamily="Verdana" FontStyle="Italic"/>
                        </StackPanel>
                    </DockPanel>
                </Border>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

</Grid>

A: I think this thread answer's your question, see the accespted answer by "Nash" - Force TextBlock to wrap in WPF ListBox
( and remember to upvote the answer the the linked thread if it helps you :) )


text:
Q: Is it possible to have more cliques than the number of nodes? I have 27,000 nodes and 38,000 cliques, using maximal.cliques() in R.
Is it possible to have more cliques than the number of nodes? Why do so many nodes belong to more than 1 clique?
How can I restrict each node to only belong to 1 clique in R?


text:
Q: Preserving multi-line string as is when round-triping in ruamel Suppose I have a file like so
test:
    long: "This is a sample text
      across two lines."

When I load the file and dump it back with no changes to the file, it changes this document into
test:
    long: "This is a sample text\
      \ across two lines."

While this is correct and doesn't change the actual value, for huge YAML files this creates a lot of diffs and becomes difficult to look at the valid ones.
This is the code I have used so far
import sys
import ruamel.yaml
from pathlib import Path

yaml = ruamel.yaml.YAML()  # defaults to round-trip
yaml.allow_duplicate_keys = True
yaml.preserve_quotes = True
yaml.explicit_start = True
file_name = "ca.yml"

with open(file_name) as fp:
    data = yaml.load(fp)

with open(file_name, 'w') as fp:
    yaml.dump(data, fp)

Could someone help me understand if there are some settings I'll be able to use to achieve this? or in case it's not possible any workarounds to do the same.

A: I cannot recreate the output so something seems to be missing. In my tests the backslashes went missing, which I expected
as I don't recall there is special code for handling newlines in a double quoted scalar, and AFAICT that
was only added for folded block style scalars, but that was not the problem.
There are a few things that are strange to me:

*

*your output is indented as if .indent(mapping=4) was set on your YAML instance
but your code doesn't reflect that.

*your code sets .explicit_start = True, but your output doesn't reflect that.

*your output wraps (around column 30), but there is no code for that.

Playing around a bit I could get your output when I set the .width to a value of 27-32,
and that if you don't set preserve_quotes the output doesn't get the backslashes (but also not
the quotes):
import sys
import ruamel.yaml

yaml_str = """\
test:
    long: "This is a sample text
      across two lines."
"""

for pq in [True, False]:
    yaml = ruamel.yaml.YAML()  # defaults to round-trip
    yaml.preserve_quotes = pq
    yaml.indent(mapping=4)
    yaml.width = 27
    yaml.allow_duplicate_keys = True
    yaml.explicit_start = True

    data = yaml.load(yaml_str)
    # check there are no hidden spaces or newlines in the loaded data
    assert data["test"]["long"] == 'This is a sample text across two lines.'
    yaml.dump(data, sys.stdout)

which gives:
---
test:
    long: "This is a sample text\
        \ across two lines."
---
test:
    long: This is a sample text
        across two lines.

So this seems to have to do specifically with the code that dumps strings with style '"'
BTW, I can recommend not overwriting the input during this kind of testing, instead write
the input from the code if you need to do file-to-file loading/dumping, or use
string input and sys.stdout output (when doing visual inspection).
This garbage is caused by code forked from PyYAML years ago:
import sys
import yaml  # PyYAML

data = yaml.safe_load(yaml_str)
assert data["test"]["long"] == 'This is a sample text across two lines.'
yaml.safe_dump(data, sys.stdout, indent=4, width=27, default_style='"')

which gives:
"test":
    "long": "This is a sample\
        \ text across two lines."

and that leads to the code for write_double_quoted in emitter.py:
class MyEmitter(ruamel.yaml.emitter.Emitter):
    def write_double_quoted(self, text, split=True):
        if self.root_context:
            if self.requested_indent is not None:
                self.write_line_break()
                if self.requested_indent != 0:
                    self.write_indent()
        self.write_indicator(u'"', True)
        start = end = 0
        while end <= len(text):
            ch = None
            if end < len(text):
                ch = text[end]
            if (
                ch is None
                or ch in u'"\\\x85\u2028\u2029\uFEFF'
                or not (
                    u'\x20' <= ch <= u'\x7E'
                    or (
                        self.allow_unicode
                        and (u'\xA0' <= ch <= u'\uD7FF' or u'\uE000' <= ch <= u'\uFFFD')
                    )
                )
            ):
                if start < end:
                    data = text[start:end]
                    self.column += len(data)
                    if bool(self.encoding):
                        data = data.encode(self.encoding)
                    self.stream.write(data)
                    start = end
                if ch is not None:
                    if ch in self.ESCAPE_REPLACEMENTS:
                        data = u'\\' + self.ESCAPE_REPLACEMENTS[ch]
                    elif ch <= u'\xFF':
                        data = u'\\x%02X' % ord(ch)
                    elif ch <= u'\uFFFF':
                        data = u'\\u%04X' % ord(ch)
                    else:
                        data = u'\\U%08X' % ord(ch)
                    self.column += len(data)
                    if bool(self.encoding):
                        data = data.encode(self.encoding)
                    self.stream.write(data)
                    start = end + 1
            if (
                0 < end < len(text) - 1
                and (ch == u' ' or start >= end)
                and self.column + (end - start) > self.best_width
                and split
            ):
                # data = text[start:end] + u'\\'  # <<< replaced with following two lines
                need_backquote = text[end] == u' ' and (len(text) > end) and text[end+1] == u' '
                data = text[start:end] + (u'\\' if need_backquote else u'')
                if start < end:
                    start = end
                self.column += len(data)
                if bool(self.encoding):
                    data = data.encode(self.encoding)
                self.stream.write(data)
                self.write_indent()
                self.whitespace = False
                self.indention = False
                if text[start] == u' ':
                    # data = u'\\'    # <<< replaced with following line
                    data = u'\\' if need_backquote else u''
                    self.column += len(data)
                    if bool(self.encoding):
                        data = data.encode(self.encoding)
                    self.stream.write(data)
            end += 1
        self.write_indicator(u'"', False)

yaml = ruamel.yaml.YAML()
yaml.Emitter = MyEmitter
yaml.preserve_quotes = True
yaml.indent(mapping=4)
yaml.width = 27

data = yaml.load(yaml_str)
assert data["test"]["long"] == 'This is a sample text across two lines.'
yaml.dump(data, sys.stdout)

which gives:
test:
    long: "This is a sample text
         across two lines."

Which looks like what you want.
The the code block around the two changed lines generates correctly loadable string, as you noted. !t just deals
very conservatively with potential multiple spaces around the point where a newline is inserted, which
is correct for PyYAML, which has no pretentions to preserve the original YAML document, but incorrect
for ruamel.yaml. Without those backslahses extra
spaces would otherwise disappear during loading.
yaml_str = 'test:\n    long:\n      "This is a sample text  across two lines."'

yaml = ruamel.yaml.YAML()
yaml.Emitter = MyEmitter
yaml.preserve_quotes = True
yaml.indent(mapping=4)
yaml.width = 27

data = yaml.load(yaml_str)
assert data["test"]["long"] == 'This is a sample text  across two lines.'
yaml.dump(data, sys.stdout)

gives:
test:
    long: "This is a sample text\
        \  across two lines."

because of the double spaces.
It doesn't look like the above has other side-effects, but this has not been further tested.
You should take care with using allow_duplicate_keys, it will change your output if you have them,
and possible not with the same semantics as another program loading the original document.
You should also consider using the .yaml extension on files containing YAML documents, assuming
the other programs using this document can handle that. That
has been the recommended extension since at least Septebmer 2006, so I hope some others updated their code
since then.


text:
Q: How won't time decrease by 1? I have a value that I want to decrease by 1 every second then format into the datetime format so it looks like the timer is counting down. My problem is that every second it returns the same value and not decrease by 1.

var measuredTime = new Date(null);

var number = 180;

var timeFormat = measuredTime.setSeconds(number);

console.log("test");

setInterval(function () {
 timeFormat = timeFormat - 1;
 var timeString = measuredTime.toISOString().substr(11, 8);
 console.log(timeString);
}, 1000);

A: You've overcomplicated that quite a bit. You're never updating measuredTime so it shows the same thing every time.
This should do it:

var number = 180;

setInterval(function () {
 var time = new Date(number * 1000).toISOString().substr(11, 8)
 console.log(time);
 number--
}, 1000);


text:
Q: Custom framework development with COCOA POD I'm creating a custom framework which uses Cocoa Pod internally. After installing POD I cannot make use of framework using agreegate target.
I added framework project with my application project just by trag and drop it inside Application project and linked it using Aggregate Target. After installing POD with custom framework, I can not make use the above mentioned way to link framework with my aggregate project.
Thanks

A: If you are developping a standalone librairy, something that users will have to add manually in their project, you CANNOT use cocoapod in your librairy project. No way! You'll have to provide your users with an install procedure indicating all extra step (framework install, project settings modification, pods to install) they'll have to follow to get your framework up and running.
This is why nowaday people use dependency manager like cocoapods. It makes it easier for users to install their product and install automaticly the dependencies.
If you are planning to distribute your framework thru pod, then follow the recommanded step to create your project architecture and reference in the example project (that uses pods) your dependencies.


text:
Q: Convergence rate in Central Limit Theorem via limit of infinite convolutions Recently I was trying to show CLT by analyzing convolution of pdfs of infinitely large number of i.i.d random variables. I'm saying "show" instead of "prove" because I don't have enough mathematical experience to produce rigorous proofs. A case with CLT was ok, but when I tried to use the same method to get something like Berry-Esseen theorem I stumbled upon a problem that I couldn't solve.
So, suppose $X_1, X_2, ..., X_n$ are i.i.d random variables with $\mathbb{E}X=0$ and $ \mathbb{Var}X=1$.
We want to find limit of distribution $p_{S_n}(t)$ of $S_n=\frac{X_1+X_2+...+X_n}{\sqrt{n}}$ as $n\to\infty$.
After adding one more $X_i$ we will have a new random variable $S_{n+1}$ such that
$$S_{n+1} = \frac{\sqrt{n}}{\sqrt{n+1}}S_n+\frac{X_{n+1}}{\sqrt{n}}$$
Denoting $\frac{X_{n+1}}{\sqrt{n}}=\xi$ with pdf $p_{\xi}(x)$, we have
$$p_{S_{n+1}}(t) = \int p_{\xi}(x) \frac{\sqrt{n+1}}{\sqrt{n}}p_{S_n}\Big(\frac{\sqrt{n+1}}{\sqrt{n}}(t-x)\Big)dx$$
Some simplifications can be made. First, $n \gg 1$, so $\frac{\sqrt{n+1}}{\sqrt{n}} \approx 1+\frac{1}{2n}$. Second, $\xi$ has very small variance of $\frac{1}{n+1}$, so all its mass is in the vicinity of 0 . So, integral is nonzero only for sufficiently small values of x. And that's why we can expand $p_{S_n}$.
$$p_{S_n}\Big(\frac{\sqrt{n+1}}{\sqrt{n}}(t-x)\Big) \approx p_{S_n}\Big((1+\frac{1}{2n})t\Big)-xp'_{S_n}\Big((1+\frac{1}{2n})t\Big)+\frac{x^2}{2}p''_{S_n}\Big((1+\frac{1}{2n})t\Big)-\frac{x^3}{6}p'''_{S_n}\Big((1+\frac{1}{2n})t\Big)+...$$
$\mathbb{E}\xi=0$ and $ \mathbb{Var}\xi\approx\frac{1}{n}$ so first derivative term will be zero after integration and second derivative term will of order $\frac{1}{n}$. And there is no need to expand inside $p''_{S_n}$ and $p'''_{S_n}$ if we want to consider only terms of order bigger than $\frac{1}{n^2}$. So after integration we have
$$p_{S_{n+1}}(t)=\Big(1+\frac{1}{2n}\Big)\Big(p_{S_n}\Big((1+\frac{1}{2n})t\Big)+0+\frac{1}{2(n+1)}p''_{S_n}(t)-\frac{\mu_3}{6(n+1)^{\frac{3}{2}}}p'''_{S_n}(t)\Big)\approx\\
\approx p_{S_n}(t)+\frac{p_{S_n}(t)}{2n}+\frac{tp'_{S_n}(t)}{2n}+\frac{p''_{S_n}(t)}{2n}-\frac{\mu_3p'''_{S_n}(t)}{6n^{\frac{3}{2}}} \tag{1}
$$
As $n\to\infty$, $p_{S_{n+1}}-p_{S_n}\to0$, so after multiplying by $2n$ we have a differential equation:
$$p(t)+tp'(t)+p''(t)-\frac{\mu_3p'''(t)}{3\sqrt{n}}=0$$
If we ignore the last term and take into account that $p(-\infty)=0$, we'll have:
$$(tp(t)+p'(t))'=0$$
$$tp(t)+p'(t)=0$$
$$p(t)=ce^{-\frac{t^2}{2}}$$
And this is essentially CLT. So far so good.
But if we denote $\varepsilon=\frac{\mu_3}{3\sqrt{n}}$ and consider DE with the fourth term included we'll have:
$$p(t)+tp'(t)+p''(t)-\varepsilon p'''(t)=0$$
$$tp(t)+p'(t)-\varepsilon p''(t)=0$$
Let's look for a solution of the form
$$p=p_0+\varepsilon p_1+...$$
We have then for different orders of $\varepsilon$:
$$\varepsilon^0:tp_0+p'_0=0\Rightarrow p_0=c_0e^{-\frac{t^2}{2}}$$
$$\varepsilon^1:tp_1+p'_1=p''_0\Rightarrow p_1=c_1e^{-\frac{t^2}{2}}+c_0e^{-\frac{t^2}{2}}\big(\frac{t^3}{3}-t\big)$$
So final solution is:
$$p(t)=(c_0+\varepsilon c_1)e^{-\frac{t^2}{2}}+\varepsilon c_0 e^{-\frac{t^2}{2}}\big(\frac{t^3}{3}-t\big)$$
And here is the problem. If I determine $c_0$ from the equation of order $\varepsilon^0$ (from $\int p dt=1$), then $c_0=\frac{1}{\sqrt{2\pi}}$ and $c_1=0$.
But then on the other hand $\int t^3pdt=\frac{\mu_3}{\sqrt{n}}=3\varepsilon$ and so
$$3\varepsilon=\int t^3pdt=\int\frac{t^3}{\sqrt{2\pi}}e^{-\frac{t^2}{2}}+\frac{\varepsilon t^3}{\sqrt{2\pi}} e^{-\frac{t^2}{2}}\big(\frac{t^3}{3}-t\big)dt=0+\frac{\varepsilon}{\sqrt{2\pi}}2\sqrt{2\pi}=2\varepsilon\neq3\varepsilon$$
And if I try to determine $c_0$ and $c_1$ from the full solution, I get
$$c_0=\frac{3}{2}, c_1=\frac{1}{\varepsilon}\big(\frac{1}{\sqrt{2\pi}}-\frac{3}{2}\big)$$
The fact that $c_1\to\infty$ as $\varepsilon\to0$ doesn't seem right for many reasons.
So as far as I understand, the cause of these contradictions is that multiplier of $\frac{1}{\sqrt{n}}$ that I got is $\frac{\mu_3}{3}$ instead of $\frac{\mu_3}{2}$. I have my suspicions about where things might have gone wrong, but I could not find a convincing way to fix my mistake.
For example, one way to get the "right" answer is to modify equation (1) and consider
$$p_{S_{n+2}}-p_{S_{n+1}}\approx p_{S_{n+2}} - p_{S_n}-\frac{p_{S_n}}{2n}-\frac{tp'_{S_n}}{2n}-\frac{p''_{S_n}}{2n}+\frac{\mu_3p'''_{S_n}}{6n^{\frac{3}{2}}}\approx\\
\approx p_{S_{n+1}} + \frac{p_{S_{n+1}}}{2(n+1)}+\frac{tp'_{S_{n+1}}}{2(n+1)}+\frac{p''_{S_{n+1}}}{2(n+1)}-\frac{\mu_3p'''_{S_{n+1}}}{6(n+1)^{\frac{3}{2}}} - p_{S_n}-\frac{p_{S_n}}{2n}-\frac{tp'_{S_n}}{2n}-\frac{p''_{S_n}}{2n}+\frac{\mu_3p'''_{S_n}}{6n^{\frac{3}{2}}}\approx\\
\approx p_{S_{n+1}} - p_{S_{n}} -\frac{p_{S_n}}{2n^2}-\frac{tp'_{S_n}}{2n^2}-\frac{p''_{S_n}}{2n^2}+\frac{\mu_3p'''_{S_n}}{4n^{\frac{5}{2}}}$$
And so as $(p_{S_{n+2}}-p_{S_{n+1}}) - (p_{S_{n+1}}-p_{S_{n}})\to0$ we get an equation
$$\frac{\mu_3}{2\sqrt{n}} p''' - p''-p'-tp=0$$
Its solution (assuming p is continuous) with $c_0=\frac{1}{\sqrt{2\pi}}$ after integrating from $-\infty$ to x corresponds to result of Berry and Esseen namely
$$F_n(x) \approx \Phi(x) + \frac{1}{\sqrt{n}}\frac{\mu_3}{6\sqrt{2\pi}}e^{-\frac{x^2}{2}}\big(1-x^2\big)$$
where $F_n$ is a CDF of $p_{S_n}$ and $\Phi$ is a CDF of standard Normal.
But I don't know why would I want to consider second differences in the first place. And moreover, it seems that for instance, third differences give wrong result again.
So what is a proper way to get a right result with this approach? I would appreciate if you could help me with that.


text:
Q: Testing the randomness of allocation of multivariate dataset Everyday we allocate mortgages between two investor platforms. Within each risk segment and term (length of mortgage in years), mortgages are allocated based on investor demand randomly. ie 70/30 split.
Mortgages/borrowers can have a number of attributes, fico, dti, loan amount, borrower income, number of revolving accounts, etc.
I want to validate that the random allocation is truly random across time and across various attributes.
I am thinking of using Welch's t-test and testing each attribute separately (unequal sample sizes and unequal variances). Is this approach valid or should I look at some type of multivariate test? ie Hotellings T-squared.
On some days, there are only a handful of loans per platform, so I think using a window size of couple days, a week or even month. What do think for the time dimension and monitoring the overall process on an ongoing basis?

A: You could do a Chi-Square test.  Search for Chi-Square test for fair dice.  It is pretty much the same problem.


text:
Q: Optimize performance of real-time object detection from camera with TensorFlow GPU and OpenCV Trying to recognize objects real time using TensorFlow Object Detection API OpenCV using ssd_mobilenet_v1_coco_11_06_2017 model in GPU.
# What model to archieve.
MODEL_NAME = 'ssd_mobilenet_v1_coco_11_06_2017'

# Path to frozen detection graph. This is the actual model that is used for the object detection.
PATH_TO_CKPT = MODEL_NAME + '/frozen_inference_graph.pb'

# List of the strings that is used to add correct label for each box.
PATH_TO_LABELS = os.path.join('data', 'mscoco_label_map.pbtxt')

NUM_CLASSES = 90

# ## Loading label map

label_map = label_map_util.load_labelmap(PATH_TO_LABELS)
categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=NUM_CLASSES, use_display_name=True)
category_index = label_map_util.create_category_index(categories)

def detect_objects(image_np, sess, detection_graph):
    # Expand dimensions since the model expects images to have shape: [1, None, None, 3]
    image_np_expanded = np.expand_dims(image_np, axis=0)
    image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')

    # Each box represents a part of the image where a particular object was detected.
    boxes = detection_graph.get_tensor_by_name('detection_boxes:0')

    # Each score represent how level of confidence for each of the objects.
    # Score is shown on the result image, together with the class label.
    scores = detection_graph.get_tensor_by_name('detection_scores:0')
    classes = detection_graph.get_tensor_by_name('detection_classes:0')
    num_detections = detection_graph.get_tensor_by_name('num_detections:0')

    # Actual detection.
    (boxes, scores, classes, num_detections) = sess.run(
        [boxes, scores, classes, num_detections],
        feed_dict={image_tensor: image_np_expanded})

    # Visualization of the results of a detection.
    rect_points, class_names, class_colors = draw_boxes_and_labels(
        boxes=np.squeeze(boxes),
        classes=np.squeeze(classes).astype(np.int32),
        scores=np.squeeze(scores),
        category_index=category_index,
        min_score_thresh=.5
    )
    return dict(rect_points=rect_points, class_names=class_names, class_colors=class_colors)

# Archieving Model
# Load a (frozen) Tensorflow model into memory.

def initiateModel(input_queue, output_queue ):
    # Load a (frozen) Tensorflow model into memory.
    gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=.8)
    detection_graph = tf.Graph()
    with detection_graph.as_default():
        od_graph_def = tf.GraphDef()
        with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
            serialized_graph = fid.read()
            od_graph_def.ParseFromString(serialized_graph)
            tf.import_graph_def(od_graph_def, name='')

        sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options, log_device_placement=True), graph=detection_graph)

    while True:
        frame = input_queue.get()
        frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
        output_queue.put(detect_objects(frame_rgb, sess, detection_graph))

    sess.close()

if __name__ == '__main__':

    input_queue = Queue(5)
    output_queue = Queue()
    for i in range(1):
        t = Thread(target=initiateModel, args=(input_queue, output_queue ))
        t.daemon = True
        t.start()

    video_capture = WebcamVideoStream(src=args.video_source,
                                      width=args.width,
                                      height=args.height).start()
    frameRate=0
    start_time = time.time()

    while True:
        frame = video_capture.read()

        frame = cv2.resize(frame, (640,480))
        height, width, channels = frame.shape
        #print("height,width : ", height, width)

        input_queue.put(frame)

        if output_queue.empty():
            pass  # fill up queue
        else:
            font = cv2.FONT_HERSHEY_SIMPLEX
            data = output_q.get()
            rec_points = data['rect_points']
            class_names = data['class_names']
            class_colors = data['class_colors']

            for point, name, color in zip(rec_points, class_names, class_colors):
                cv2.rectangle(frame, (int(point['xmin'] * args.width), int(point['ymin'] * args.height)),
                              (int(point['xmax'] * args.width), int(point['ymax'] * args.height)), color, 3)
                cv2.rectangle(frame, (int(point['xmin'] * args.width), int(point['ymin'] * args.height)),
                              (int(point['xmin'] * args.width) + len(name[0]) * 6,
                               int(point['ymin'] * args.height) - 10), color, -1, cv2.LINE_AA)
                cv2.putText(frame, name[0], (int(point['xmin'] * args.width), int(point['ymin'] * args.height)), font,
                            0.3, (0, 0, 0), 1)
            cv2.namedWindow("Video",  cv2.WINDOW_NORMAL)
            cv2.imshow('Video', frame)

            if (time.time() >= start_time+1):
                print ("Frame Rate : ", frameRate)
                start_time = time.time()
                frameRate=0
            else:
                frameRate=frameRate+1

        fps.update()

        #print('[INFO] elapsed time: {:.2f}'.format(time.time() - t))

        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

    fps.stop()

    video_capture.stop()
    cv2.destroyAllWindows()

Getting around 17~18 on single GPU( NVIDIA 1070 6 gb).
GPU uses most of its dedicated memory but still overall GPU usage is around 30-32%.
How can I enhance usage of GPU to increase performance?
I need to achieve around 60 fps with custom object detector to detect only particularly patterned objects.


text:
Q: Proof By Contradiction where p always proves q true Prove that for any even integer n, n^2 mod 2 = 0 using proof by contradiction. (Question)

*

*Let p: any even integer n

*Let q: n^2 mod 2 = 0

In this example, if proved by contradiction, I'll be assuming ~(p → q) = p ∧ ~q = true.
With this, ~q can never be proven at all so long as p remains.
How do I solve this question via proof by contradiction then?
Would doing ~p and ~q be the same? This would seem like inverse (~p → ~q) or contrapositive (~q → ~p) instead.


text:
Q: Sum involving binomial coefficients Exist a closed form for $$\left(-1\right)^{N}\underset{i=1}{\overset{N}{\sum}}\left(-1\right)^{i}\dbinom{N}{i}\dbinom{N+i}{i-1}\,\frac{1}{2i+1}?$$ I think I've to use in some way the formula of the shifted legendre polynomials $$P_{N}\left(x\right)=\left(-1\right)^{N}\underset{i=0}{\overset{N}{\sum}}\dbinom{N}{i}\dbinom{N+i}{i}\left(-x\right)^{i}$$ but I'm not sure about it. I'm wrong? Thank you

A: For $N\ge 1$ we get the fractions 1/3, 2/15, 1/7, 4/45, 1/11, 6/91, 1/15, 8/153 and so on. So the numerators are 1,2,1,4,1,6,1,8, one's interleaved with the even numbers, and for the denominators 3,15,7,45,11,91,15,153, which are the sequence 3,7,11,15, of numbers == 3 (mod 4) interlaced with the values of 15,45,91,153,.. reproduced in https://oeis.org/A014634. So for odd $N$ the values are $1/(2N+1)$, and for even $N$ they are $N/((N+1)(2N+1))$


text:
Q: When I create a user in the Magento admin, it automatically unsubscribes them from Mailchimp Obviously this only happens if that user has previously subscribed to our mailing list, and yes we have the MageMonkey extension.
Has anyone encountered something like this before? I'm guessing it automatically sets the user NOT part of the newsletter (in magento), and that information gets sent to Mailchimp because the unsubscribe happens immediately on creation of the user. And there's no way to set the Newsletter before creating the user.
Please feel free to simply respond with Mailchimp alternatives, as well.

A: After some research I figured out this was caused by the fact that I also use Mandrill (Mailchimp's email delivery system) to send our welcome emails (and all magento transactional emails). Because I did not have an unsubscribe link in my welcome email (which is against mailchimp's agreement), they went ahead and auto-unsubscribed the users from my mailchimp mailing list.
Here is a link for reference:
http://ebizmarts.com/forums/topics/view/6452


text:
Q: Multicast different values Test this segment it's print weird output.But I was think it segment throw exception possible lossy conversion from byte to char. but it not throws any exception,can you justify this statements.

jshell> println((int)(char)(byte)-1);

output :
65535


text:
Q: Php get stuck in AWS SDK IoT getThingShadow request I wrote some code in PHP that gets the ThingShadow state of an IoT Device connected to the AWS IoT Service.
public function getState($name){
    require_once HOME . DS . 'includes' . DS . 'aws' . DS . 'aws-autoloader.php';
    $IoT = new Aws\IotDataPlane\IotDataPlaneClient([
        'version' => 'latest',
        'region'  => 'us-west-2'
    ]);

    $result = $IoT->getThingShadow([
        'thingName' => $name, // REQUIRED
    ]);

    echo $result["payload"]->getContents();
}

When I run it on my localhost server it works perfectly, but when I run it on my EC2 instance it doesn't work. I call this method and it gets stuck on what seems to be a loop.
I have checked the credentials and everything is fine.
For tests, I put a wrong thingName and i get the following error:
Fatal error: Uncaught exception 'Aws\IotDataPlane\Exception\IotDataPlaneException' with message 'Error executing "GetThingShadow" on "https://data.iot.us-west-2.amazonaws.com/things/WRONG_NAME/shadow"; AWS HTTP error: Client error: 404 ResourceNotFoundException (client): No shadow exists with name: 'WRONG_NAME' - {"message":"No shadow exists with name: 'WRONG_NAME'","traceId":"f3c5f1ba-e24a-448d-b4e2-d6265751df87"}' exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: 404' in /var/www/html/includes/aws/GuzzleHttp/Middleware.php:69 Stack trace: #0 /var/www/html/includes/aws/GuzzleHttp/Promise/Promise.php(199): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response)) #1 /var/www/html/includes/aws/GuzzleHttp/Promise/Promise.php(152): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array) #2 /var/www/html/includes/aws/GuzzleHttp/Promise/TaskQueue.php(60): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}() #3 /var/www/html/includes/aws/GuzzleHtt in /var/www/html/includes/aws/Aws/WrappedHttpHandler.php on line 152

When I run the code with the actual name of an existing thing it doesn't respond. Looks like the code gets in a loop somewhere.
I'm usin the the AWS PHP SDK v3.


text:
Q: JBoss 6 + Spring 3 Transaction Manager Load Error I have a Spring WS project that I am trying to host on a JBoss 6 server. It worked briefly and then began to fail. The only changes that I made between was the addition of some HTML files to the C:\jboss-6.1.0.Final\server\default\deploy\ROOT.war folder. All of a sudden my server is no longer able to start giving me this stack trace:
11:30:52,902 WARN  [ClassLoaderManager] Unexpected error during load of:
javax.transaction.TransactionManager: java.lang.LinkageError:
loader constraint violation: loader (instance of org/jboss/classloader/spi/base/BaseClassLoader)
previously initiated loading for a different type with name
"javax/transaction/TransactionManager"

I removed the files: still failing, same error.
I fiddled aroung with my spring-servlet file and web.xml files and re-exported my project to jboss: still failing, same error.
I deleted and re-installed JBoss, and re-exported my project: still failing, same error.
I searched google for using the stack trace, and found one other person with the same one: some brazilian guy trying to set up a mail server also . he got no responses and made no further posts.
here is my current web.xml file
<servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring-servlet.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<session-config>
    <session-timeout>30</session-timeout>
</session-config>

this is my spring servlet.xml file
<!-- Use @Component annotations for bean definitions -->
<context:component-scan base-package="chessgame" />

<!-- Use @Controller annotations for MVC controller definitions -->
<mvc:annotation-driven />

<!-- Ref: http://static.springsource.org/spring/docs/2.5.x/reference/metadata.html#metadata-annotations-required -->
<bean
    class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor" />

<!-- For making a web service -->
<bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
    <property name="baseAddress" value="http://localhost:9876/" />
    <property name="bindingType" value="http://schemas.xmlsoap.org/wsdl/soap/http" />
</bean>

<!-- For database -->
<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    <property name="url" value="jdbc:oracle:thin:@192.168.0.26:1521:orcl" />
    <property name="username" value="deepblue" />
    <property name="password" value="deepblue" />
</bean>

<bean id="jdbcTemplate" class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
    <constructor-arg ref="dataSource" />
</bean>

this is how I am annotating my webservice classes
@Component
@WebService(serviceName = "PostAMove")
@SOAPBinding(parameterStyle = ParameterStyle.WRAPPED)
public class PostAMoveService {

i'm going crazy with this frakkakata thing! please help!
EDIT: this is also a Maven project >facepalm<
Here are my Maven repository declarations.
<repositories>
    <!-- Repository for javax.* libraries -->
    <repository>
        <id>maven2-repository.java.net</id>
        <name>Java.net Repository for Maven</name>
        <url>http://download.java.net/maven/2/</url>
    </repository>
    <repository>
        <id>mesir-repo</id>
        <name>Repository hosting the oracle ojdbc14.jar</name>
        <url>http://mesir.googlecode.com/svn/trunk/mavenrepo</url>
    </repository>
    <!-- Repository for hibernate libraries -->
    <repository>
        <id>jboss-public-repository-group</id>
        <name>JBoss Public Maven Repository Group</name>
        <url>https://repository.jboss.org/nexus/content/groups/public/</url>
    </repository>
    <!-- What is this ?! : -->
    <!-- <repository> <id>java.net.glassfish</id> <name>Repository hosting
        the jee6 artifacts</name> <url>http://download.java.net/maven/glassfish</url>
        </repository> -->
</repositories>

And here are my Maven dependency declarations.
<dependencies>
    <!-- Javax libraries -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.sql</groupId>
        <artifactId>jdbc-stdext</artifactId>
        <version>2.0</version>
    </dependency>
    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
        <!-- <scope>provided</scope> -->
    </dependency>
    <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>jsr250-api</artifactId>
        <version>1.0</version>
        <!-- <scope>provided</scope> -->
    </dependency>
    <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>persistence-api</artifactId>
        <version>1.0</version>
        <!-- <scope>provided</scope> -->
    </dependency>
    <!-- Mysql back-end support -->
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>10.2.0.4.0</version>
    </dependency>
    <!-- JUnit testing support -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <!-- <version>3.8.1</version> -->
        <version>4.7</version>
        <scope>test</scope>
    </dependency>
    <!-- Logging support -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>
    <!-- Spring Framework -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${org.springframework.version}</version>
        <exclusions>
            <exclusion>
                <artifactId>commons-logging</artifactId>
                <groupId>commons-logging</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${org.springframework.version}</version>
        <!-- <type>jar</type> <scope>compile</scope> -->
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <scope>runtime</scope>
        <version>${org.springframework.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <!-- <scope>runtime</scope> -->
        <!-- <type>jar</type> <scope>compile</scope> -->
        <version>${org.springframework.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${org.springframework.version}</version>
        <!-- <scope>test</scope> -->
        <!-- <type>jar</type> <scope>compile</scope> -->
    </dependency>
    <!-- Miscellaneous -->
    <dependency>
        <groupId>aopalliance</groupId>
        <artifactId>aopalliance</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.6.10</version>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>1.8.5</version>
    </dependency>

    <!-- For Web Services -->
    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
        <version>1.5.8</version>
    </dependency>

fairly sure that some of them are extraneous, but that shouldnt break it right?

A: Make sure you don't have jta.jar (or similarly named one) in your WEB-INF/lib - it should be provided by JBoss.


text:
Q: sprites falling in cocos2d i have 2 sprites that moving horizontly and i need them to fall down naturally ,when they hit a wall .
i know how to do that in a simple way of changing position every frame, but this is not seems natural, and probably not the right way.
There is a way to discover the collision and then make them fall down, when thier speed and y axis is taking into consideration ?
i just couldnt find a simple way to do that with box2d or chipmunk .
any direction would be great.
thanx.

A: Firstly add a custom contact listener to your b2World.
public class Main
{
      public function Main()
      {
            //init stuff
            var cc:CustomContactListener = new CustomContactListener();
            world.setContactListener(cc);
      }
}

//then on hit call the hit function on sprite
public class CustomContactListener extends b2ContactListener
{
      //Called when a contact point is added.
      public override function Add(point:b2ContactPoint):void
      {
            //checks if the first shape is a sprite and second is a wall if true call Hit
            if (point.shape1.GetBody().GetUserData().isSprite && point.shape2.GetBody().GetUserData().isWall)
            {
                 point.shape1.GetBody().GetUserData().Hit();
            }
            else if (point.shape2.GetBody().GetUserData().isSprite && point.shape1.GetBody().GetUserData().isWall)
            {
                 point.shape2.GetBody().GetUserData().Hit();
            }
      }
}

public class Sprite
{
      public var hit:Boolean = false;

      //Set hit to true and start applying realistic downward force
      public function Hit()
      {
           hit = true;
      }

      //Enter frame event that applies force
      public function step(e:Event)
      {
           if (hit)
           {
                 b2Vec2 force = new b2Vec2(0, -9.8);
                 bodyOfSprite.ApplyLinearForce(force);
           }
      }
}

This relies on you setting the userdata of all the bodies you have as the class that holds it. i.e. Sprite, Wall. You could also do it the opposite way where you apply gravity all the time and also apply an opposing force. Then when you make contact with the wall you stop applying the other force and gravity takes effect.
Or like how @iforce2d puts it just check when the linearvelocity of the body of the sprite is close or equal to zero because that would indicate it has hit something that has stopped it, not just a wall though, then you can just set hit to true. And the step function will do the rest. This is limited though because it just needs it to slow down to trigger it not hit a wall which may not be desired.

A: using any phys engine just set's the correct gravity in the world (b2World in case of box2D) and set the initial velocity of your body. So it will fall naturally

A: If you are setting the velocity yourself, it's up to you to make it look natural :)
Changing the vertical part of the velocity is not a good idea - just leave it how it was:
b2Vec2 vel = body->GetLinearVelocity();
vel.x = ...;
body->SetLinearVelocity( vel );


text:
Q: como lleno un combobox con una tabla en sqlite quisiera saber como llenar un combo Box con una tabla que tengo en SQLITE, ya que he buscando TUTORIALES pero están con MYSQL y no comprendo así, ya he traido datos hacia un jtable, pero no se como hacer para traer a un combobox, algaun borrador que me proporcionen me serviría para entender como lo hago.
public class conexion {
String strConexionDB="jdbc:sqlite:C:/Users/Mercadeo Eforsalud/Documents/Desktop/biblioteca.s3db";
Connection conn = null;
public conexion(){
    try {
        Class.forName("org.sqlite.JDBC");
        conn=DriverManager.getConnection(strConexionDB);
        System.out.println("conexion establecida");
    } catch (Exception e) {
        System.out.println("error de conexion"+ e);
    }

}

public int ejecutarSentenciaSQL(String strSentenciaSQL){
    ResultSet res = null;
    try {
        PreparedStatement pstm = conn.prepareStatement(strSentenciaSQL);
        res = pstm.executeQuery();
        return 1;
    } catch (SQLException e) {
        System.out.println(e);
        return 0;
    }

}

}
ESTO ES LO QUE HE HECHO PERA PARA CONECTARME A LA BD


text:
Q: PHP Switch statements Error I made a site and I added a pm thing and when I go to pm.php it gives me a error:

Fatal error: Switch statements may only contain one default clause in /home/vol10_3/HIDDEN.com/HIDDEN/htdocs/includes/classes/pm.class.php on line 673

Code:
    function get_new_messages($uid=NULL,$type='pm')
    {
        if(!$uid)
            $uid = userid();
        global $db;
        switch($type)
        {
            case 'pm':
            default:
            {
                $count = $db->count(tbl($this->tbl),"message_id"," message_to LIKE '%#$uid#%' AND message_box='in' AND message_type='pm' AND    message_status='unread'");

            }
            break;

            case 'notification':
            default:
            {
                $count = $db->count(tbl($this->tbl),"message_id"," message_to LIKE '%#$uid#%' AND message_box='in' AND message_type='notification' AND message_status='unread'");
            }
            break;
        }

        if($count>0)
            return $count;
        else
            return "0";
    }
}

A: You don't actually use the brackets or default like that.
<?php

switch ($type) {
    case 'pm':
        // Do something when $type is 'pm'
        // This can be multiple statements
        break;

    case 'notification':
        // Do something when $type is 'notification'
        // This can be multiple statements
        break;

    default:
       // Do something else
       break;
}

You only add default once, for the code that will execute if none of the other cases are executed. The "case: 'pm':" section is starting a block that will go until the break statement exits it. If there is no break statement it will enter the next block (in this case notification).
Here's a link to PHP's website that has some more examples and details about how those statements work.


text:
Q: Why int a[10] is not allowed in java? I am beginning to learn java, I find that in the declaration of an array we cannot specify the size of it like this (which is used in C):
int a[10];

But we have to do like this:
int[] a=new int[10];
int a[]=new int[10];

Why java seems to be complex in here instead of allowing array declaration like the C style?

A: Because Java is not C. It shares some common idioms with C (quite a few actually) but the Java language developers were not totally beholden to the C language in their efforts.
The arrays themselves are objects stored on the heap, hence the need to do a new to create them. The reference a[] to the array may well be stored on the stack but that's not the array itself.

A: In java arrays are objects.
Java wrap these bare-bone arrays within an object hence
All methods of an Object can be invoked on an array.
**int a[]** = new int[5];

5 inside the square bracket says that you are going to store five values and is the size of the array 'n'.

*

*Declaration: The code set in bold are all variable declarations that associate a variable name with an object type.

*Instantiation: The new keyword is a Java operator that creates the object.
                 and since in java arrays are objects, it is necessary.

*Initialization: The new operator is followed by a call to a constructor, which initializes the new object.
NB.
In java,Memory is constantly being allocated dynamically(objects are allocated memory dynamically by new operator)  and then "forgotten" (the language actually forces you to forget about them). That is, the coder leaves it to the garbage collection engine to clean up his memory allocation mess.
In C, concept of static memory allocation allow declaration of
int a[10];

References : Java Arrays

A: This is a part of a much larger picture: there are no stack-allocated structures in Java. That is why the type system can be partitioned into primitive types and reference types. Instances of the latter are dynamically allocated and accessed via references. This is a deep invariant of Java design.
The reason for this can be tracked down to the key driving goal of Java's design: to be a simple language with as few gotchas as possible, while still offering adequate expressiveness.
You may ask what is so complicated about a stack-allocated array: the trouble starts when you try to pass it into another function. Passing by value is out of the question and passing by reference means the reference to a stack-allocated object escapes the method's scope, so it may be dereferenced after deallocation.


text:
Q: Uikit slider javascript initialization I'm a newbie in JS and need to initialize UIKit's Slider component with var slider = UIkit.slider(element, { /* options */ }); as mentioned in the docs. So in my.js file I entered
$(document).ready(function(){
slider = UIkit.slider(element, {auto: true });

});
and in my.html

But no slider appears?

A: I think probably the problem here is that you may not have included the uikit slider.js, slider.css and slidenav.css files. Also you need to replace 'element' in UIkit.slider with '#the id of the data-uk-slider div'.
I came across this question when trying to dynamically initialise the content of a slider from Javascript and couldn't find any documentation.
So for the record, the answer to that question is to create the slider within Javascript and then to add the line:
var slider = UIKit.slider('#id of the data-uk-slider-div', {options});
Where 'options' are e.g. auto: true
This is in the UIKit documentation but it took me a while.


text:
Q: JavaScript in DNN I've been trying to add JavaScripts to a website while using DNN (which I've been using for two weeks). I'm currently on version 07.04.00 (353). I've tried to paste my scripts inside the header in Page Settings -> Advanced Settings and the header in the Module Settings -> Advanced Settings, but it doesn't seem to work. I've posted one of the scripts I want to use below.

<script>
    var radiobtnType = "ensidig";
    var radiobtnOrient = "S";
    var radiobtnHeatCap = "100";
    //var tsvfilepath = data/ensidig_S_100.tsv

    $(".btnType").click(function () {
        radiobtnType = $(this).data('id');
        update_box();
        //var idPaaDenButtonDerBlevTrykketPaa = $(this).text() + $(this).data('id')
        //alert(idPaaDenButtonDerBlevTrykketPaa);
    });
    $(".btnOrientation").click(function () {
        radiobtnOrient = $(this).data('id');
        update_box();
    });
    $(".btnHC").click(function () {
        radiobtnHeatCap = $(this).data('id');
        update_box();
    });

    function update_box() {
        document.getElementById("foo2").value = "data/" + radiobtnType + "_" + radiobtnOrient + "_" + radiobtnHeatCap + ".tsv";
        document.getElementById("pwd").value = "data/" + radiobtnType + "_" + radiobtnOrient + "_" + radiobtnHeatCap + ".tsv";
    }
</script>

A: EDIT:
If you use DNN 4.9.1 or above, jquery is included (http://www.dnnsoftware.com/community-blog/cid/135141/dotnetnuke-tips-and-tricks-11-using-jquery-in-dotnetnuke). Meaning you just need to add document ready wrapping (or $(function() { /* code goes here */ });  as adviced in the dnn link).
--
First make sure your page includes jQuery. If not, include it e.g. by using a cdn:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
Second, wrap your code inside jQuery's ready()-function (see https://learn.jquery.com/using-jquery-core/document-ready/).
<script>
$(document).ready(function() {

    var radiobtnType = "ensidig";
    var radiobtnOrient = "S";
    var radiobtnHeatCap = "100";
    //var tsvfilepath = data/ensidig_S_100.tsv

    $(".btnType").click(function () {
        radiobtnType = $(this).data('id');
        update_box();
        //var idPaaDenButtonDerBlevTrykketPaa = $(this).text() + $(this).data('id')
        //alert(idPaaDenButtonDerBlevTrykketPaa);
    });
    $(".btnOrientation").click(function () {
        radiobtnOrient = $(this).data('id');
        update_box();
    });
    $(".btnHC").click(function () {
        radiobtnHeatCap = $(this).data('id');
        update_box();
    });

    function update_box() {
        document.getElementById("foo2").value = "data/" + radiobtnType + "_" + radiobtnOrient + "_" + radiobtnHeatCap + ".tsv";
        document.getElementById("pwd").value = "data/" + radiobtnType + "_" + radiobtnOrient + "_" + radiobtnHeatCap + ".tsv";
    }

});
</script>

A: DNN 07.04.xx version defaultly included JQuery so don't worry about that.
Your JQuery not works without
$(document).ready(function() {
     //JQ code here...
});

You can also use like below.
<script language="javascript" type="text/javascript">

var radiobtnType = "ensidig";
var radiobtnOrient = "S";
var radiobtnHeatCap = "100";
//var tsvfilepath = data/ensidig_S_100.tsv

$(document).ready(function() {
    $(".btnType").click(function () {
        radiobtnType = $(this).data('id');
        update_box();
        //var idPaaDenButtonDerBlevTrykketPaa = $(this).text() + $(this).data('id')
        //alert(idPaaDenButtonDerBlevTrykketPaa);
    });
    $(".btnOrientation").click(function () {
        radiobtnOrient = $(this).data('id');
        update_box();
    });
    $(".btnHC").click(function () {
        radiobtnHeatCap = $(this).data('id');
        update_box();
    });
});
function update_box() {
    document.getElementById("foo2").value = "data/" + radiobtnType + "_" + radiobtnOrient + "_" + radiobtnHeatCap + ".tsv";
    document.getElementById("pwd").value = "data/" + radiobtnType + "_" + radiobtnOrient + "_" + radiobtnHeatCap + ".tsv";
}
</script>


text:
Q: mongoose Namespace has no exported member 'OptionalId' I am getting this error while i run npm i.
../@types/mongoose/index.d.ts:191:17 - error TS2694: Namespace '"/Users/test-service/node_modules/@types/mongodb/index"' has no exported member 'OptionalId'  ? mongodb.OptionalId & { _id: TId }>
I am using "@types/mongoose": "^5.5.32", "@types/mongodb": "~3.3.1".  Can someone help me solving this problem. my tsc version is Version 3.8.3 .

A: Why  ?
my project node_modules like this,

*

*node_modules

*

*@types/mongoose/@types/mongodb

*@types/mongodb

@types/mongoose has @types/mongodb dependencie, and it has conflict with @types/mongodb.
How to Fix
Run this command at your node_modules directory:
$ rm -rf node_modules/@types/mongoose/node_modules/@types/mongodb
Done.
Hope to help someone.

A: I just solved the problem by running this command.
npm install --save @types/mongodb

Hope this can help you.


text:
Q: react-native ios how to use android button The official display two kind of buttons for ios and android, but sometimes the kind of android button is better for ios too.
How can I migrate android button to ios?

A: You can find button styles here. All you can do is to style your button to give better looks. Even then they might have different display feel in android and IOS.


text:
Q: Print/Output variable values to immediate window I'm trying to write some vba that will print the values which satisfy the below constraints:
b * k = t * k

lambda = r * (k - 1) / (t - 1), where (t - 1) >= (k - 1) & lambda must be an integer.
Here is the algorithm:
Sub BIBDs()

Dim t, b, k, r As Integer
Dim lambda As String

For t = 2 To 50
    For b = 2 To 20
        For r = 1 To 20
            For k = 3 To 5
                If b * k = t * k & (t - 1) >= (k - 1) Then
                lambda = r * (k - 1) / (t - 1)
                    If lambda = Int(lambda) Then
                        Debug.Print t, b, r, k, lambda
                    End If
                End If
            Next k
        Next r
    Next b
Next t

End Sub

Nothing is printed in the "Immediate" window. I'm not sure it there is something wrong with the algorithm or my print method. Specifically, I'm not sure if I'm correctly checking that lambda is an integer.

A: Try
If b * k = t * k And (t - 1) >= (k - 1) Then

instead of
If b * k = t * k & (t - 1) >= (k - 1) Then

The & operator in VBA is not the same like logical And operator: https://msdn.microsoft.com/en-us/library/wfx50zyk.aspx


text:
Q: Scanner input not working when used in a While loop I'm trying to create a method to validate a user input to be "1". Therefore I used a while loop for validation. Yet, it enters the while loop when the input is "1".
public static int switchInput() {

    System.out.print("\n" + "Enter your selection: ");

    Scanner userInput = new Scanner(System.in);
    String selection = userInput.next();

    while (selection != "1" /*&& selection != "2" && selection != "3"*/){

        System.out.println("Enter 1: ");
        //System.out.println("Please enter either '1','2' or '3': ");
        selection = userInput.next();

    }

    int result = Integer.parseInt(selection);
    return result;
}

Output:
What would you like?
1: Regular Hamburger
2: Healthy Burger
3: Deluxe Burger

Enter your selection:
1
Enter 1:
1
Enter 1:
1
Enter 1:

Process finished with exit code -1

A: selection != "1" is wrong. != checks for reference inequality i.e. if the objects on both sides are not same, then the condition will return true.
In your case, selection and String object with value 1 are different objects, that's why the condition is returning true.
Instead, use !selection.equals("1")
Edit:
As suggested by Igor Nikolaev, if there is no compulsion of using String object as a choice, you could use int selection = userInput.nextInt() for getting selection as int. In that case, you can use selection == 1.

A: You see, the variable 'selection' is a string, and to compare two string using != is incorrect.
Instead, use the method equals()
So I see you want to compare the String selection and a string "1" replace the if condition with:
while(!selection.equals("1")){

TIP: You expect the user to input a number, so why make selection a string? It would be better if it was an int.


text:
Q: stationary point of the solution of recursive linear programming The problem I am working on is:
Given an $n$ dimensional vector $r \in \mathcal{R}^n$, and a convex set $G=\{\mu \in \mathcal{R}^n | \mu_i \ge 0, ~ \mu^T \mathbf{1}=1, ~ A\mu =0 \}$ where $\mathbf{1}= [1, 1, ..., 1]^T$. ($A \in \mathcal{R}^{m \times n}$ and $m < n$) We assume that the set $G$ is not an empty set.
Suppose $\bar{\mu} = \arg \max_{\mu \in G} r^T\mu$ given $r$.
Then can we say $\tilde{\mu} = \arg \max_{\mu \in G} \bar{\mu}^T\mu$ is identical to $\bar{\mu}$?
In other words, when we fix the feasible set of linear programming, we can treat LP as a mapping from a vector (in the cost function) to another vector (solution). Then, what is the stationary points to this mapping when the feasible set is a subset of a simplex and plane intersecting the origin.

A: Not true in general. Consider $n=3$ and $A=[2, -1, 6]$. Then, $G$ is the line segment with end points $(1/3, 2/3, 0)$ and $(0, 6/7, 1/7)$. Consider $r$ such that $\bar {\mu} = (1/3, 2/3, 0)$. (For example, $r=(1, -1, 0)$.). Then, $\tilde {\mu} $ is unique and it is $(0, 6/7, 1/7)$.


text:
Q: Android - SherlockActionBar long press icon menu I'm trying to listen on a long click in actionbarsherlock. The default action is to show an empty toast. I don't know how to change those actions like display a dialog or something like this.
I have for example on the bar (Sherlock) an icon that says sync. I would like this button to show a toast when the user makes a long press
Thanks ! :)

A: See an answer from library developer (Jake Wharton) here. In a nutshell,

It is not possible. The long press is reserved for toasting an action
  item's title.

A: You can start an action upon user's click and in that you can run a clock and identify time and if time if more (let's say 10 say) you can show a tost.. if less do nothing.
you can trap long press using timeinterval in that case.
I hope this helps. Thanks
Better you can check this article that explain what it takes to deliver the above.


text:
Q: Non-Renewing Subscription: turn back time I'm creating an app that will unlock features to users for a limited time. Premium features let's call them. They can buy a subscription for a month, 6 months or a year. These subscriptions would be non-renewing. After a lot of searching the web and finding very different "solutions", I turn to StackOverflow for what the best should be.
When a subscription is bought, the end date is stored locally on the device until synced via iCloud, because Apple wants you to have this subscription on all your devices. The app checks iCloud to see if the current subscription is still available, shows a nice countdown for the users with days left. But I'm currently encountering a problem. When the user has paid for a month, and changes the date of the device to a year earlier (or something else), it can use the subscription for a year. The countdown now doesn't show 23 days left, but 389.
How can I avoid this?
Should I check a certain server to check for the real time and date?
What if a user only uses the app in airplane mode?
Thx in advance!

A: You could check standard web-based time-servers to do this. Since I have my own server (as part my in-app purchase mechanisms), I just ask my server for the current time, at the server. I do this every time the app launches, and every time I make a server-call (usually when in-app purchases are done). I then store the time locally (either in the KeyChain or NSUserDefaults, can't remember which!), and use it (and the device time, which ever is later in time) to compute purchase expiries.
Of course, this assumes that the user has a network connection when they launch the app. You can only do so much though!

A: Actually what happening is after successful completion of your InAppPurchase apple will provide you a Transaction Reciept...this transaction reciept is stored in locally . When you want to check the subscription is in  active or expired you need to request the storekit with this transaction reciept then the store kit will give you the status .. if the status is 0 then it is in active state . if the status is 21006 then your transaction is Expired. If you want to continue the subscription in antoher device then you need to Restore the transactions there .. after completion of the restoration you will get all the product ids and the transaction reciepts.. you need to store the transaction reciepts there and you need to pass this for the storekit whether it is in active or expired state .. sorry for my poor english..


text:
Q: Invalid grant when accessing Google API I'm trying to invoke any of the Google API using "Service account" authorization access. I have downloaded ".pk2" file and activated "URL Shortener API" in Services tab of Google API console. Whenever I try to invoke any API (URL shortener or Adsense). I've got following exception -
com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
{
  "error" : "invalid_grant"
}
    at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105)
    at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:303)
    at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:323)
    at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:345)
    at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:526)
    at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:287)
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:836)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:412)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:345)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:463)

Below is code snippet -
    HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
    JsonFactory JSON_FACTORY = new JacksonFactory();
    File privateKey = new File(ReportAdsense.class.getResource("mykey.p12").toURI());
    GoogleCredential credential = new GoogleCredential.Builder().setTransport(HTTP_TRANSPORT)
            .setJsonFactory(JSON_FACTORY)
            .setServiceAccountId("my_valid_account_id@developer.gserviceaccount.com")
            .setServiceAccountScopes(UrlshortenerScopes.URLSHORTENER)
            .setServiceAccountPrivateKeyFromP12File(privateKey)
            .build();
     Urlshortener service = new Urlshortener.Builder(new NetHttpTransport(), JSON_FACTORY, null).setHttpRequestInitializer(credential).build();
     UrlHistory history = service.url().list().execute();

A: First of all "Service account" will not work for Adsense, since it requires user authorization. Hence for Adsense you should use Oauth 2.0. When you are authorized first time using URL https://accounts.google.com/o/oauth2/token, copy-paste and hardcode your refresh token.  Than you can use  it to get access token, specify client_id, client_secret and your refresh_token to get new access token. Now access token can be used in your application.
Regarding your error, I have faced with similar issue and spent plenty of time to resolve it. First of all, make sure that you are using valid ServiceAccountId - it should point to email which finishes with "developer.gserviceaccount.com". Make sure, that you specified account scopes and activated services in Google Console API.
I fixed this issue by synchronizing system clock in my machine.
There are a lot of topics with similar error without answers. Even more, some people says, that sometimes it works, sometimes it returns invalid grant. It could work on one machine and fail on another. I don't know if it is system clock issue, but I would avoid using Service Account API, since looks like there are bugs and support would not help you


text:
Q: How to convert a Split String Query [Splitting in to multiple rows] in to an Update Table Query in SQL Server? Very new at SQL. I have a Query that splits my column value in to Multiple Rows. Now I need to commit it to the actual Table and not just a view through a Select Query.
I've read so many solutions and none of them seem to work. The whole "create Split Function" write all these complicated variables, then create a "Temp Table" then "merge it back to the original table with the value column" and so forth is super confusing to me. Can someone please just put it in plan and simple format for me. There has to be a simpler way for Developer Noobs like myself. Please don't just tell me what I'm doing wrong and assume I know what you're talking about (because I know it's not working, I've identified I'm not a PRO at this), can someone please just show me what I need to do to make this work.
I have the output view which is EXACTLY what I want, but it's just a View, it doesn't update the table...I just want the VALUE output from my Split_String query to insert itself in to my Actual Table or even if I can just Update the Table to look like my view query table or even how I create a New table from my query so that an ACTUAL table looks like my query and is not just a view, that would be grand!
EXAMPLE TABLE of 1 row
please note this is only an example and there are over 120 columns in the actual table and splitting the [DOS File] string is not my issue (I have done that with my query which splits per delimiter and inserts into multiple rows and duplicates all the other columns around it), my issue is trying to commit the value column created by the split_string query to the actual table so that I can do other data transformations on it which requires the string to be split per delimiter

Column1 Name = DOS File
Column1 Value = example1.doc | example2.doc | example3.doc | example4.doc | example5.doc | example6.doc | example7.doc
Column2 Name = NAME
Column2 Value = Sally Andrews
Column3 Name = ADDRESS
Column3 Value = 42 Wallaby Way, Syndey
Column4 Name = PHONE NUMBER
Column4 Value = 123-123

My Split_String Query which has the [Output Column] of my Split_String Query, attached to all the other Columns in the referenced Table:

select value as [New DOS file], [Document Export Edit].*
from [Document Export Edit]
cross apply string_split([DOS file], '|')

The [DOS file] column is a MASSIVE .csv style string and thus the delimiter will be by '|'.
Methods I have tried to use:

Update [Document Export Edit]
 set [New DOS File] = (select value
from [Document Export Edit]
cross apply string_split([DOS file], '|'))
GO

With the following Error Message:

Invalid column name 'New DOS File'.

and this:

Update [Document Export Edit]
      set [New DOS File] = replace([New DOS File],[New DOS File],
             select value from [Document Export Edit]
      cross apply string_split([DOS file], '|'))

With this following Error Message:

Invalid column name 'New DOS File'.

and this:

Alter Table [Document Export Edit]
Add [New DOS File] NVARCHAR(max) null
Add [Test] NVARCHAR(max) null
GO

Update [Document Export Edit]
set [New DOS File] = id1,
    [Test] = id2
from (
  select [DOS File],
          (select top 1 value as val
              from string_split([DOS File], '|')
              order by (row_number() over(order by 1 asc)) asc
              ) as id1,
          (select top 1 value as val
              from string_split([DOS File], '|')
              order by (row_number() over(order by 1 asc)) desc
              ) as id2
              from [Document Export Edit]
      ) A inner join [Document Export Edit] B
      on A.[DOS File] = B.[DOS File]

with the Following Error Message:

Windowed functions, aggregates and NEXT VALUE FOR functions do not
  support integer indices as ORDER BY clause expressions.

So I tried this:

Update [Document Export Edit]
set [New DOS File] = id1
from (
  select [DOS File],
          (select top 1 value as val
              from string_split([DOS File], '|')
              ) as id1
              from [Document Export Edit]
      ) A inner join [Document Export Edit] B
      on A.[DOS File] = B.[DOS File]

Outcome:
It worked but it just split the first instance of the delimiter, duplicated the exact same thing in the other column and just ignored the rest of the string. SO CLOSE!!! I just want it to do what it did in the first bit and do it for the rest of the string but put it in different rows PER DELIMITER INSTANCE!!
so went forth to try this:

Update [Document Export Edit]
set [New DOS File] = id1
from (
  select [DOS File],
          (select top 1 value as val
              from [Document Export Edit]
              cross apply string_split([DOS File], '|')
              ) as id1
              from [Document Export Edit]
      ) A inner join [Document Export Edit] B
      on A.[DOS File] = B.[DOS File]

Outcome:
Then released that the entire [New DOS file] Column just replicated the first result. Went back and looked at my Syntax and then figured out that I had put a variable restriction only on the first instance ... my bad. So I went and changed it.
Then I tried this:

Update [Document Export Edit]
set [New DOS File] = id1
from (
  select [DOS File],
          (select value as val
              from [Document Export Edit]
              cross apply string_split([DOS File], '|')
              ) as id1
              from [Document Export Edit]
      ) A inner join [Document Export Edit] B
      on A.[DOS File] = B.[DOS File]

with the following Error Message:

Subquery returned more than 1 value. This is not permitted when the
  subquery follows =, !=, <, <= , >, >= or when the subquery is used as
  an expression.

So it seems that this particular query can only do 1 variable at a time and not multiple rows at once.
Here are some of the links I've tried to follow which have either failed in my task or was WAY too complicated for me to follow:
Turning a Comma Separated string into individual rows
Splitting delimited values in a SQL column into multiple rows
Split column data into multiple rows
Split values over multiple rows
Update multiple rows in SQL Server with IN clause
Split string into multiple rows with multiple columns in paired
https://www.emoreau.com/Entries/Articles/2019/04/Splitting-a-value-into-multiple-rows-in-Microsoft-SQL-Server.aspx
I hope this is enough information for someone to please help me. Thank you.

A: After so many hours of trying and losing hope. My Beautiful Tech-Savy Friend finally pointed out that I just had the syntax in the wrong order.
The answer to my question was:

select value as [New DOS file], dbo.[Document Export Edit].*
into [Document Export String_Split]
from [Document Export Edit]
cross apply string_split([DOS file], '|')


text:
Q: asp.net web forms unit test parsing xml test returned collection I have a web forms application that parses some xml and returns a collection. I use a utitily class that parses the xml. Im trying to write a unit test to check the returned collection of objects. heres my code
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Web_Application.Models;
using System.Collections.Generic;

namespace _Web_Application.Tests
{
    [TestClass]
    public class UnitTest1
    {
        string source = @"C:\Users\F\Desktop\Web Application\Web    Application.Tests\LunchTest.xml";

        [TestMethod]
        public void ParseXml()
        {
            XmlUlitilyClass x = new XmlUlitilyClass();
            x.ParseXml(source);

            Assert.AreEqual(x.ParseXml(source).Last(), 4);
            Assert.AreEqual(x.ParseXml(source).Last().Name, "Roast of the day");
            Assert.AreEqual(x.ParseXml(source).Last().DesertIncluded, true);
        }
    }
}

is the correct way to do this or am i way off thanks

A: It's a good approach.  My only concern is the source file @"C:\Users\F\Desktop\Web Application\Web    Application.Tests\LunchTest.xml"; must be on every machine that runs the test.
Does XmlUlitilyClass accept a XML string instead of filename?  If so pass it the contents of LunchTest.xml.