text:
Q: Calling a Apex method within a trigger In my Class I have this method
global class Queue{

    @InvocableMethod

    public static void send(List<ListRequests> requests){...}

    }

In my trigger I initialize the class, call the method, but it is throwing the error of "Method does not exist or incorrect signature".
trigger CallBack on Task (before insert) {

    Queue sendToQueue = new Queue();

    List<String> lead = new List<String>();

    sendToQueue.send(lead);
}

A: Invocable method expects this argument
send(List<ListRequests> requests)

Whereas you are sending list<String> into this sendToQueue.send(lead);
Also, Queue is a reserve object. So better to use different name of class.
Other thing is, since method is static, use ClassName.methodName() for calling. Don't use instance of the Class to call the method.


text:
Q: How does git track changes to files For the longest time I thought git commits keep diffs of changed files and not copies. Any information I could find states the contrary. I conducted a little experiment:
$ git init
$ subl wtf

Here I create a file with 99 999 lines, each of which is foo bar baz #line

$ ls -la
total 1760
drwxrwxr-x 3 __user__ __user__    4096 Aug 13 21:02 .
drwxr-xr-x 3 __user__ __user__    4096 Aug 13 19:57 ..
drwxrwxr-x 7 __user__ __user__    4096 Aug 13 21:02 .git
-rw-rw-rw- 1 __user__ __user__ 1788875 Aug 13 21:02 wtf
$ git add --all
$ git commit -m 'Initial commit'
[master (root-commit) 6ef5084] Initial commit
 1 file changed, 99999 insertions(+)
 create mode 100644 wtf
$ subl wtf
$ git diff
diff --git a/wtf b/wtf
index 7ba3acb..bf7a9ed 100644
--- a/wtf
+++ b/wtf
@@ -14156,7 +14156,7 @@ foo bar baz 14155
 foo bar baz 14156
 foo bar baz 14157
 foo bar baz 14158
-foo bar baz 14159
+foo qux baz 14159
 foo bar baz 14160
 foo bar baz 14161
 foo bar baz 14162
$ git add --all
$ git commit -m 'bar -> qux on #14159'
[master 1b5ab4b] bar -> qux on #14159
 1 file changed, 1 insertion(+), 1 deletion(-)
$ subl wtf
$ git diff
diff --git a/wtf b/wtf
index bf7a9ed..1aeeaa3 100644
--- a/wtf
+++ b/wtf
@@ -14156,7 +14156,7 @@ foo bar baz 14155
 foo bar baz 14156
 foo bar baz 14157
 foo bar baz 14158
-foo qux baz 14159
+xyz abc baz 14159
 foo bar baz 14160
 foo bar baz 14161
 foo bar baz 14162
$ git add --all
$ git commit -m 'foo qux -> xyz abc on #14159'
[master 85ccf97] foo qux -> xyz abc on #14159
 1 file changed, 1 insertion(+), 1 deletion(-)
$ ls -la
total 1760
drwxrwxr-x 3 __user__ __user__    4096 Aug 13 21:02 .
drwxr-xr-x 3 __user__ __user__    4096 Aug 13 19:57 ..
drwxrwxr-x 9 __user__ __user__    4096 Aug 13 21:05 .git
-rw-rw-rw- 1 __user__ __user__ 1788875 Aug 13 21:04 wtf

Even commits on different branches with conflicts didn't change the situation.
If git truly keeps copies of all changed files with every commit, how come there was no significant change in space used?

A: Every time a file changes, Git stores a new copy of that file in its database. A commit stores a reference to the most recent version of a file tracked by that commit. This means that when a commit is created, it uses the reference stored by its parent for unchanged files, and the reference to the newly added version for changed files.
Periodically (or on demand with, say, git gc), the database is compacted by creating pack files which contain the most recent version for each file in a given set, along with "reverse diffs" that can be used to reconstruct older versions as needed.

A: The git has object database. There is a type of object "blob" which is identified by sha1 of its content. So, it means, if you have a file of the same content anywhere in repository (branch/point of history/directory/etc) it will be stored in the database only once.
There are two parts in the database, the objects/??/* files which are individual objects. I.e. if you have two versions of a large file which has only single line difference - it will be stored twice, in two different files (using simple lzma? compression).
Then, if git thinks the objects directory grew too much, it runs garbage collection. One of the steps of this process - repacking. It creates large pack files in the objects/pack/ folder which use clever delta-compression algorithm, and it works across not on a history of a particular file, but in the scope of the whole object database, so it means even if some completely unrelated files look similar occasionally, they could be packed as deltas of one another.
So, the deltas could be re-compressed differently after each git gc command taking in account latest changes in the history.
Also, object packs vs loose objects are only physical storage details, which are completely transparent when you use git everyday. E.g. doing log cherry-pick, merge etc are operating with full snapshot of a commit. So, if you are doing diff, it just compares two versions of a directory/files on fly, generating you a patch/diff.
This approach is quite unique in comparison to other VCS. E.g. Mercurial stores immutable delta-logs for each file separately, and Subversion is storing deltas for the whole repository. And it affects how system works - physical storage is not abstracted away and it causes some significant limitations, while git allows very flexible work-flows and algorithms while keeping the size of the repository very small

A: At least two mechanisms reduce the total storage needed in Git's object database.  First, each object is compressed individually.  Second, objects are lumped together into object "packs" that relate the objects with deltas, saving even more space for similar objects.  There's a chapter on packfiles in ProGit which is quite illuminating.

A: Git logically stores a distinct set of all file contents in the history. This means that if one character is changed in a 10 MB file the entire contents of the file have two different object ids. However, there is much optimization under the hood to make sure that similar objects are stored with deltas.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Returning int_ptr from dialogboxes A dialogbox proc has a return type of BOOL but what i'm trying to do
case WM_CTLCOLORSTATIC:
        {
            HBRUSH g_hbrBackground = CreateSolidBrush(RGB(237, 209, 238));
            HDC hdcStatic = (HDC)wParam;
            SetBkMode(hdcStatic, TRANSPARENT);
            return (INT_PTR)g_hbrBackground;
        }

The above (INT_PTR) cases a performance warning conversion from int_ptr to bool, how it is done?

A: Here's the declaration of a dialog proc:
INT_PTR CALLBACK DialogProc(
  __in  HWND hwndDlg,
  __in  UINT uMsg,
  __in  WPARAM wParam,
  __in  LPARAM lParam
);

There's no BOOL there.
Use correct types and your problem disappears.
Cheers & hth.,

A: Typecast a brush handle to BOOL. This is way ugly, but this is how it is.

A: return (BOOL)(g_hbrBackground != 0);

should solve the warning.


text:
Q: FFMPEG + Python - skipping unneeded frames on ffmpeg side I'm trying to process a live hlsv stream, extract every 100th frame from it, and process it using openCV.
Currently my code looks something like this:
pipe = subprocess.Popen([FFMPEG_BIN, "-i", src,
                    "-loglevel", "quiet",
                    "-an",
                    "-f", "image2pipe",
                    "-pix_fmt", "bgr24",
                    "-vcodec", "rawvideo", "-"],
                    stdin=subprocess.PIPE,
                    stdout=subprocess.PIPE,
                    stderr=subprocess.DEVNULL)

while True:
    raw_image = pipe.stdout.read(WIDTH * HEIGHT * 3)
    if frame_counter > 100:
        frame_counter = 0
        process_frame(raw_image)
    frame_counter += 1

Reading all the frames and dumping 99% of them seems inefficient, and has led me to pipe buffer issues (at least I suspect that).
Is it possible to skip the frames in FFMPEG, so that every 100th frame will go to the stdout?

A: Use the select filter to keep every 100th frame.
pipe = subprocess.Popen([FFMPEG_BIN, "-i", src,
                    "-loglevel", "quiet",
                    "-vf", "select=not(mod(n\,100))",
                    "-vsync", "0",
                    "-an",
                    "-f", "image2pipe",
                    "-pix_fmt", "bgr24",
                    "-vcodec", "rawvideo", "-"],
                    stdin=subprocess.PIPE,
                    stdout=subprocess.PIPE,
                    stderr=subprocess.DEVNULL)


text:
Q: Material-UI withStyles and props not rendering when testing with Enzyme + Jest I am writing a test for a component that is wrapped in a withStyles() from Material UI using Jest. I have searched many examples but didn't get solution.
Below are the my files:
Login.js
import React, { Component } from 'react';
import { connect } from 'react-redux';
import * as Actions from 'auth/store/actions/index';
import { bindActionCreators } from 'redux';
import { withRouter } from 'react-router-dom';
import { withStyles } from '@material-ui/core/styles/index';
import { TextFieldFormsy } from '@fuse';
import Formsy from 'formsy-react';
import {
  Button, Card, CardContent, Typography,
} from '@material-ui/core';
const styles = () => ({
 card: {
  width: '100%',
  maxWidth: 400,
 },
});
class Login extends Component {
  state = {
   email: '',
   password: '',
 };

form = React.createRef();

componentDidMount() {
  this.props.resetErrorMessage();
}
componentDidUpdate() {
}
onSubmit = (model) => {
  this.props.submitMerritosLogin(model);
};
render() {
  const { classes } = this.props;
  const { email, password } = this.state;
  return (
      <Card className={`${classes.card} mx-auto md:m-0 merritos-login-card merritos-mobile-register
        justify-center items-center flex flex-col`}>
        <CardContent className="flex flex-col p-44">
          <img className="w-256 mb-32 ml-6 merritos-desktop-display merritos-mobile-image merritos-mobile-images self-center" src="assets/images/logos/merritos-blue-small.png" alt="logo" />
          <Typography className="mt-16 font-bold text-24 merritos-login-subtitile merritos-theme-colour">Sign in</Typography>
          <Typography className="mb-56 text-grey-darker text-16 font-bold ">to your professional world</Typography>
          <Formsy
            onValidSubmit={this.onSubmit}
            ref={form => this.form = form}
            className="flex flex-col justify-center w-full merritos-form"
          >
            <TextFieldFormsy
              className="mb-16 merritos-border-color merritos-accountinfo-textinput"
              type="email"
              name="email"
              label="Email"
              value={email}
              required
            />

            <TextFieldFormsy
              className="mb-16 merritos-border-color merritos-accountinfo-textinput"
              type="password"
              name="password"
              label="Password"
              value={password}
              required
            />
            <Button
              color="primary"
              size="small"
              type="submit"
              className="text-16 normal-case merritos-login-btn accountinfo-margin"
              aria-label="LOG IN"
            >
              Sign in
            </Button>
          </Formsy>
        </CardContent>
      </Card>
);
}
}

function mapDispatchToProps(dispatch) {
  return bindActionCreators({
    submitMerritosLogin: Actions.submitMerritosLogin,
    resetErrorMessage: Actions.resetErrorMessage,
  }, dispatch);
 }

 function mapStateToProps({ auth }) {
   return {
     user: auth.user,
   };
  }

  export default withStyles(styles, { withTheme: true })(withRouter(
    connect(mapStateToProps, mapDispatchToProps)(Login),
   ));

login.test.js
import React from 'react';
import {render, fireEvent, screen} from '@testing-library/react';
import { shallow } from 'enzyme';
import Login from './Login';

describe('login', () => {
  test('renders without crashing', () => {
    const wrapper = shallow(<Login.WrappedComponent />);
    expect(wrapper.find('Button').text()).toEqual('Sign in');
   });
 });

While running test I am getting error like bellow:
login › renders without crashing
TypeError: Cannot read property 'card' of undefined

I removed the classes.card and tried then also I got error below:
login › renders without crashing
TypeError: Cannot read property 'resetErrorMessage' of undefined

I am wanting the wrapper component to behave the same way as a wrapper without the withStyles() component.

A: Looks like you are testing the wrapped component without passing any props while the component requires some props having to be passed.
I think it would work as you pass some needed props to it, it would work as following:

*

*Export Login class in your Login.js
export class Login {
  // ...
}

*

*Then import to the test:

// you should import `Login` class to test separately
import { Login } from "./Login";

test('renders without crashing', () => {
  const props = {
    classes: {
      card: 'yourCardClass',
    },
    resetErrorMessage: jest.fn(),
    submitMerritosLogin: jest.fn(),
  };

  const wrapper = shallow(<Login {...props} />);

  // should get called as component did mount
  expect(props.resetErrorMessage).toHaveBeenCalled();
  expect(wrapper.find('Button').text()).toEqual('Sign in');
});


text:
Q: Android Layout with overlapping view I want to create a Layout with two groups of views: group 1 is a linear layout with vertical direction that contains several image views, group 2 is a simple frame layout with just one image view. Now I would like to put group 1 on top of group 2 (overlapped), and align the center (red dot) of first image view of group 1 and group 2, how can I achieve this in one xml layout file? I made a mock for the view, see picture below
Mock view of the description above

A: Use powerful RelativeLayout:

<RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/group_1"
        android:layout_width="200dp" android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="40dp"
        android:orientation="vertical">
        <TextView android:layout_width="match_parent" android:layout_height="50dp"
                  android:background="@android:color/holo_red_dark"
                  android:text="View 1"/>
        <TextView android:layout_width="match_parent" android:layout_height="50dp"
                  android:background="@android:color/holo_green_dark"
                  android:text="View 2"/>
        <TextView android:layout_width="match_parent" android:layout_height="50dp"
                  android:background="@android:color/holo_blue_dark"
                  android:text="View 3"/>
        <TextView android:layout_width="match_parent" android:layout_height="50dp"
                  android:background="@android:color/darker_gray"
                  android:text="View 4"/>

    </LinearLayout>

    <ImageView
        android:id="@+id/group_2"
    android:layout_width="300dp" android:layout_height="150dp"
               android:scaleType="fitXY"
               android:layout_centerHorizontal="true"
        android:src="@android:drawable/dialog_frame"/>
</RelativeLayout>


text:
Q: DxgiOuputDuplication texture frames to DirectX VideoProcessor I was playing with this project DirectXVideoScreen because I am trying to find a way to convert RGBA to NV12 so I can make a video using the h264 transformation of my GPU. (You can only use the transformation when you have NV12 or YUV2 color format)
I have tried doing the color conversion using the Windows Media Foundation MFT (Video processor) but I am trying to go directly and use DirectX in order to have more control.
While you duplicate the screen the texture you get back is of type DXGI_FORMAT_B8G8R8A8_UNORM and I have to transform it to  DXGI_FORMAT_NV12.
So I took the code from the project "D3D11VideoProcessor" and added the code from the "SimpleDesktopDuplication" project.
It is like this.
CD3D11VideoProcessor cD3D11VideoProcessor;
CSimpleDesktopDuplication cSimpleDesktopDuplication;
ID3D11Texture2D* output = NULL;

if (cSimpleDesktopDuplication.InitDesktopDuplication() == S_OK)
{
    output = cSimpleDesktopDuplication.ProcessDesktopDuplication();
}

if(cD3D11VideoProcessor.InitDXVA2(2560,1440, DXGI_FORMAT_NV12) == S_OK)
{
    cD3D11VideoProcessor.ProcessImageConversion(output, CONVERTED_IMAGE);
}

The problem (I think?) is that
m_pDXGIOutputDuplication->AcquireNextFrame(500, &FrameInfo, &pDXGIResource));
pDXGIResource->QueryInterface(__uuidof(ID3D11Texture2D), reinterpret_cast<void **>(&pScreenShotTexture2D)));

Returns a texture with the following flags.
Width: a00
Height: 5a0
MipLevels: 1
ArraySize: 1
Format: 57
Usage: 0
BindFlags: 28 // D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE
CPUAccessFlags: 0
MiscFlags: 2900

And here the code fails while executing
m_pD3D11VideoContext->VideoProcessorBlt(m_pD3D11VideoProcessor, pD3D11VideoProcessorOutputView, 0, 1, &StreamData)
HRESULT CD3D11VideoProcessor::ProcessImageConversion(ID3D11Texture2D* outputDuplicationTexture, LPCWSTR wszOutputImageFile)
{
    HRESULT hr = S_OK;
    ID3D11VideoProcessorInputView* pD3D11VideoProcessorInputViewIn = NULL;
    ID3D11VideoProcessorOutputView* pD3D11VideoProcessorOutputView = NULL;
    ID3D11VideoDevice* pD3D11VideoDevice = NULL;
    ID3D11Texture2D* pOutTexture2D = NULL;

    IF_FAILED_RETURN(m_pD3D11VideoContext == NULL ? E_UNEXPECTED : S_OK);

    try
    {
        IF_FAILED_THROW(m_pD3D11Device->QueryInterface(__uuidof(ID3D11VideoDevice), reinterpret_cast<void**>(&pD3D11VideoDevice)));

        D3D11_TEXTURE2D_DESC desc2D;
        desc2D.Width = 2560;
        desc2D.Height = 1440;
        desc2D.MipLevels = 1;
        desc2D.ArraySize = 1;
        desc2D.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
        desc2D.SampleDesc.Count = 1;
        desc2D.SampleDesc.Quality = 0;
        desc2D.Usage = D3D11_USAGE_DEFAULT;
        desc2D.BindFlags = D3D11_BIND_RENDER_TARGET;
        desc2D.CPUAccessFlags = 0;
        desc2D.MiscFlags = 0;

        D3D11_TEXTURE2D_DESC desc2Dtmp;
        outputDuplicationTexture->GetDesc(&desc2Dtmp);

        printf("Width: %x\n", desc2Dtmp.Width);
        printf("Height: %x\n", desc2Dtmp.Height);
        printf("MipLevels: %x\n", desc2Dtmp.MipLevels);
        printf("ArraySize: %x\n", desc2Dtmp.ArraySize);
        printf("Format: %x\n", desc2Dtmp.Format);
        printf("Usage: %x\n", desc2Dtmp.Usage);
        printf("BindFlags: %x\n", desc2Dtmp.BindFlags);
        printf("CPUAccessFlags: %x\n", desc2Dtmp.CPUAccessFlags);
        printf("MiscFlags: %x\n", desc2Dtmp.MiscFlags);

        D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC pInDesc;
        ZeroMemory(&pInDesc, sizeof(pInDesc));
        pInDesc.FourCC = 0;
        pInDesc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D;
        pInDesc.Texture2D.MipSlice = 0;
        pInDesc.Texture2D.ArraySlice = 0;

        IF_FAILED_THROW(pD3D11VideoDevice->CreateVideoProcessorInputView(outputDuplicationTexture, m_pD3D11VideoProcessorEnumerator, &pInDesc, &pD3D11VideoProcessorInputViewIn));

        desc2D.Format = DXGI_FORMAT_NV12;

        IF_FAILED_THROW(m_pD3D11Device->CreateTexture2D(&desc2D, NULL, &pOutTexture2D));

        D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC pOutDesc;
        ZeroMemory(&pOutDesc, sizeof(pOutDesc));
        pOutDesc.ViewDimension = D3D11_VPOV_DIMENSION_TEXTURE2D;
        pOutDesc.Texture2D.MipSlice = 0;

        IF_FAILED_THROW(pD3D11VideoDevice->CreateVideoProcessorOutputView(pOutTexture2D, m_pD3D11VideoProcessorEnumerator, &pOutDesc, &pD3D11VideoProcessorOutputView));

        D3D11_VIDEO_PROCESSOR_STREAM StreamData;
        ZeroMemory(&StreamData, sizeof(StreamData));
        StreamData.Enable = TRUE;
        StreamData.OutputIndex = 0;
        StreamData.InputFrameOrField = 0;
        StreamData.PastFrames = 0;
        StreamData.FutureFrames = 0;
        StreamData.ppPastSurfaces = NULL;
        StreamData.ppFutureSurfaces = NULL;
        StreamData.pInputSurface = pD3D11VideoProcessorInputViewIn;
        StreamData.ppPastSurfacesRight = NULL;
        StreamData.ppFutureSurfacesRight = NULL;

                /*Error is here !!!*/
        IF_FAILED_THROW(m_pD3D11VideoContext->VideoProcessorBlt(m_pD3D11VideoProcessor, pD3D11VideoProcessorOutputView, 0, 1, &StreamData));

        IF_FAILED_THROW(CreateBmpFileFromYUVSurface(pOutTexture2D, wszOutputImageFile));
    }
    catch(HRESULT){}

    SAFE_RELEASE(pOutTexture2D);
    SAFE_RELEASE(outputDuplicationTexture);
    SAFE_RELEASE(pD3D11VideoProcessorOutputView);
    SAFE_RELEASE(pD3D11VideoProcessorInputViewIn);
    SAFE_RELEASE(pD3D11VideoDevice);

    return hr;
}

The error code is 0x80070057 meaning E_INVALIDARG One or more arguments are invalid.. I can not find the invalid arg :/
Can you help me ? or guide me ? Maybe I have to somehow change the ID3D11Texture2D* outputDuplicationTexture to match a simpler version of the texture (change misc params) ?
Thank you!


text:
Q: How to print special characters in c++ for mac using ncurses libarary Now, I want to print special characters in c++ for mac(mojava, 10.14.4), but these characters are broken in my mac book.
I installed ncurses such as brew install ncurses and brew link ncurses. It can printw English such as Hello World, but special characters such as ████████╗███████╗████████╗██████╗ ██╗███████╗ is broken.
source code
setup
initscr();
clear();
noecho();
cbreak();
curs_set(0);

work
int startX = 0;
int startY = 0;

mvprintw(startY++, startX, "Hello World");
mvprintw(startY, startX, "████████╗███████╗████████╗██████╗ ██╗███████╗\n");

Result
Hello World
?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H?~U~W?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H
?~U~W?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H?~U~W?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H
?~U~W ?~V~H?~V~H?~U~W?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H?~V~H?~U~W

A: This seems to work for c++ with clang++ for mac(Mojave, 10.14.4).  I think it is using the mac curses rather than the brew installed ncurses. It looks like it needs the locale set: setlocale(LC_ALL, ""); For me, this cleared the screen and displayed:
Hello World
████████╗███████╗████████╗██████╗ ██╗███████╗
Compile cmd:
    clang++ -Wall -Wextra -Weverything -lncurses *.cpp -o prg
main.cpp code:
#include <curses.h>
#include <locale.h>

int main()
{
    setlocale(LC_ALL, "");
    initscr();                /* Start curses mode */
    clear();
    noecho();
    cbreak();
    curs_set(0);

    int startX = 0;
    int startY = 0;
    mvprintw(startY++, startX, "Hello World");
    mvprintw(startY, startX, "████████╗███████╗████████╗██████╗ ██╗███████╗\n");

    refresh();                /* Print it on the real screen */
    getch();                  /* Wait for user input */
    endwin();                 /* End curses mode */
    return 0;
}


text:
Q: visible is not working on javascript I want to make my buttons visible and false based on conditions. I have tried the following. Its working only if the buttons are visible on page load
   if(count > 0)
   {
    document.getElementById('<%=msg.ClientID%>').innerHTML="Do you want to delete " + count + " record(s)?";
    document.getElementById('<%=btnNo1.ClientID%>').style.visibility="visible";
    document.getElementById('<%=btnYes1.ClientID%>').style.visibility="visible";
    document.getElementById('<%=btnNo1.ClientID%>').value="Cancel";
   }
   else
   {
   document.getElementById('<%=msg.ClientID%>').innerHTML="No records to delete";
   document.getElementById('<%=btnNo1.ClientID%>').style.visibility="visible";
   document.getElementById('<%=btnYes1.ClientID%>').style.visibility="hidden";
   document.getElementById('<%=btnNo1.ClientID%>').value="OK"
   }

is there any other solution

A: Try this..
For hiding..
document.getElementById('<%=btnNo1.ClientID%>').style.display="none";

For showing.,.
document.getElementById('<%=btnNo1.ClientID%>').style.display="block";

A: Instead of visibility use display property
    if(count > 0)
   {
    document.getElementById('<%=msg.ClientID%>').innerHTML="Do you want to delete " + count + " record(s)?";
    document.getElementById('<%=btnNo1.ClientID%>').style.display="block";
    document.getElementById('<%=btnYes1.ClientID%>').style.display="block";
    document.getElementById('<%=btnNo1.ClientID%>').value="Cancel";
   }
   else
   {
   document.getElementById('<%=msg.ClientID%>').innerHTML="No records to delete";
   document.getElementById('<%=btnNo1.ClientID%>').style.display="block";
   document.getElementById('<%=btnYes1.ClientID%>').style.display="none";
   document.getElementById('<%=btnNo1.ClientID%>').value="OK"
   }

A: In detail you can see from JQuery site : http://api.jquery.com/show/
When you need to hide these buttons then use it:
$("#btnNo1").hide();
$("#btnYes1").hide();

When you need to Show these buttons then use following:
$("#btnYes1").show();
$("#btnNo1").show();

Thanks.


text:
Q: how to build a comment tree using neo4j and PHP I want to build a comment tree using neo4j and PHP for example:
A
|_B
...|_C
...|_D

I am using https://github.com/jadell/neo4jphp component. It doesnt heve this method. Anyway I dont know how to get all tree using Cypher.

A: You just add comments onto other comments, you can execute this cypher with neo4jphp or neoclient.
MATCH (c:Comment {id:{comment_id}})
MATCH (a:Author {id:{author_id}})
CREATE (n:Comment {id:{new_comment_id}, text:{new_comment_text})
CREATE (a)-[:WROTE]->(n)


text:
Q: Removing the rows from a table after closing the jquery dialog I had a jquery dialog in which there was "+" button which will add the rows and "bin" symbol which will delete the rows . All looks good till here but when i close and reopen the dialog its still having the added rows instead it should reset to only one row with "+" and "bin" symbol .

        <input type="text" id="rollnum" name="rollnum" class="rollClass" maxlength="20"/>
        <select id="school" name="school" multiple="multiple" style="width: 95px; size: 50px" size="3" class="schoolClass">
        <img src="<c:url value="/images/add_small.png"/>" id="btnAdd1" class="addImg"/>

        <input type="text" id="rollnum" name="rollnum" class="rollClass" maxlength="20"/>
        <select id="college" name="college" multiple="multiple" style="width: 95px; size: 50px" size="3" class="schoolClass">
        <img src="<c:url value="/images/add_small.png"/>" id="btnAdd1" class="addImg"/>

$('#school-dialog').dialog({
    //autoOpen : true,
    height : 800,
    width : 950,
    modal : true,
    dialogClass : "schools",
    title : 'School and College',
    closeOnEscape : true,
    open : function(event){
        $('#school-dialog').show();
    },
    close : function(event) {
        $("#school-dialog").dialog("destroy");
    }
});

Any help on this is appreciated .

A: Give all the schools class="school", and all the colleges class="college". Then you can delete all but the first row of each with:
close: function(event) {
    $("#table1 tr.school:gt(0), #table1 tr.college:gt(0)").remove();
    $("#school-dialog").dialog("destroy");
}


text:
Q: Pressure of Bose-Einstein-Condensate in decreasing volume Consider a Bose-Gas where $T_0$ is the critical temperature at which the temperature dependant chemical potential is $\mu(T_0) = 0$. Looking at the interval $ 0 \leq T < T_0 $ one can show that the pressure of the system is:
$$ P = \dfrac{2}{3}\dfrac{E}{V} = \zeta \bigg(\dfrac{5}{2}\bigg) \dfrac{k_BT_0}{\lambda_{T_0}^3}\bigg(\dfrac{T}{T_0}\bigg)^{\dfrac{5}{2}}$$
where $\zeta$ is the Riemann zeta function and $\lambda_T$ the termal de-Broglie-wavelength of the wavepackages. As one can see
$$P \propto T^{\dfrac{5}{2}} $$
But the interesting fact is that the pressure of an ideal bose gas in the interval $ 0 \leq T < T_0 $ is independant of the particle density N/V, where N is the number of particles and V the volume. One can deduce that there is no resistence of the system when decreasing the volume in which the gas is placed.
Now, in my lecture notes it says this is due to more particles being pushed into ground state when the volume is reduced, but I do not get how this is related to the effect.
I would be very happy if someone could explain me this effect in more detail as I have not found much about it yet.

A: I restate the question for my own clarity:

*

*The Expression for pressure in a Bose-Einstein condensate is independent of the Volume and Number of particles.  $$P(N,V,T)=P(\frac{N}{V},T)=P_{BEC}(T)$$ While the first equality is thermodynamic in origin(intensive nature of $P,T$), the second is  an expression that is exclusively true for Bose-Einstein condensates.

*This expression suggests that reducing the volume, holding $N,T$ fixed, causes no change in pressure. This is in stark contrast to ideal gasses where a increase in pressure would occur.

*Another observation from the expression for total number $$N=\frac{V}{\lambda^3} g_{\frac{3}{2}}(z)+n_0$$ is if we reduced the volume holding $N,T$ fixed, then $n_0$ would increase. Here $n_0$ is number of particles in the ground state, $V$ is the volume, $\lambda$ is the thermal wavelength and $g$ is a special function whose nature is unimportant.

*Your question is: Are these two phenomenon related and if so, how?

The Intuition: The hint to the relationship between the two phenomenon is in the equation of state
$$P=\frac{3E}{2V}$$
In an ideal gas, holding $N,T$ fixed fixes $E$. Corrections to $E$ due to volume change in real gasses at high temperature are small and can be ignored.
However, suppose there was a mechanism to reduce $E$ by the same proportion(or drastically)when $V$ is reduced. Then the pressure independence(or weak dependance) on volume would be explained.
In a BEC, this mechanism is provided for by the "pushing" of particles to the zero energy ground state. This reduces the average energy drastically enough for the Pressure to remain independent of the volume.
The calculation: Divide up the pressure into two parts
$$P=\frac{3}{2V}\left(E_>+E_0\right)$$
Where $E_>$ is the energy contribution from higher states and $E_0$ is that due to the ground state. In the ground state, the BEC has zero energy(Unlike a particle in a box). All that remains to be shown is that $E_>$ scales with $V$.This is carried out by integrating the Bose distribution to get the energy:
$$E_>=\int_0^\infty dE g(E)E \frac{1}{z^{-1}e^{\beta E}-1}$$
Plugging in the expression for $g(E)$, one gets
$$E_>= \frac{V}{4\pi^2}\left(\frac{2m}{\hbar}\right)^2\int_0^\infty dE  \frac{E^{3/2}}{z^{-1}e^{\beta E}-1}$$
This shows that $E_>$ does scale linearly with V hence establishing the pressure (in)dependence on volume. Remember that at high temperature $z$ depends strongly on $\frac{N}{V}$, while at low temperatures it is almost fixed by the average number of particles.
$$N=\frac{V}{\lambda^3} g_{\frac{3}{2}}(z)+\frac{z}{1-z}$$
In the low temperature limit $\lambda \to 0$ and $z$ is fixed by $N$.
Edit: At the request of the OP, I add a few details to the number of particles formula.
The total number of particles is given by integrating the Bose Einstein distribution:
$$N=\int_0^\infty dE g(E) \frac{1}{z^{-1}e^{\beta E}-1}$$
However, this integral is exactly $0$, in the neighborhood of the region $E=0$ since the density of states vanishes near $E=0$. Therefore this formula does not account for the particles in the ground state. At high temperatures, this is okay since most particles are in fact in higher excited states. However, in anticipation of the importance on the ground state at low temperature, we will need to account for the ground state separately, by hand. So the corrected formula looks like:
$$N=\int_0^\infty dE g(E) \frac{1}{z^{-1}e^{\beta E}-1}+n_0$$
Where $n_0$ is the average number of particles in the ground state. Now, explicitly working out the density of states gives us:
$$g(E)=\frac{V\sqrt{E}}{4\pi^2}\left(\frac{2m}{\hbar}\right)^{\frac{3}{2}}$$
Plugging this back into the equation for $N$ gives you:
$$N= \frac{V}{4\pi^2}\left(\frac{2m}{\hbar}\right)^{\frac{3}{2}} \int_0^\infty dE \sqrt{E}  \frac{1}{z^{-1}e^{\beta E}-1}+n_0$$
This equation tells you exactly why reducing the volume increases the number of particles in the ground state. If we reduce the volume, the first term in the equation reduces(remember $z=1$ for a condensate). But the total number of particles is held fixed in the system. Therefore the second term must increase for the left hand hand side to remain constant. This means that the number of particles in the ground state increases.
Intuitively, The density of states decreases when we reduce the volume. This makes the spacing between states larger, and the higher states become less accessible at very low temperature. Therefore, particles tend to get pushed into the ground state.


text:
Q: Starting MySQL database server: mysqldinstall: invalid user `mysql' i have a problem with mysql on my Raspberry Pi running Linux raspberrypi 3.18.7+ #755 PREEMPT Thu Feb 12 17:14:31 GMT 2015 armv6l GNU/Linux.
This is error I have when I run sudo service mysql start
Starting MySQL database server: mysqldinstall: invalid user `mysql'

I haven't found answer anywhere, so I'm asking here.
mysql version: mysql  Ver 14.14 Distrib 5.5.41, for debian-linux-gnu (armv7l) using readline 6.2
etc/passwd file:
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh list:x:38:38:Mailing List
Manager:/var/list:/bin/sh irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System
(admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
pi:x:1000:1000:,,,:/home/pi:/bin/bash
sshd:x:101:65534::/var/run/sshd:/usr/sbin/nologin
ntp:x:102:104::/home/ntp:/bin/false
statd:x:103:65534::/var/lib/nfs:/bin/false
messagebus:x:104:106::/var/run/dbus:/bin/false usbmux:x:105:46:usbmux
daemon,,,:/home/usbmux:/bin/false lightdm:x:106:109:Light Display
Manager:/var/lib/lightdm:/bin/false mysql:x:107:112:MySQL
Server,,,:/nonexistent:/bin/false ftp:x:108:113:ftp
daemon,,,:/srv/ftp:/bin/false
wp:x:1001:1004::/media/usb/www/wordpress:/bin/bash
ntop:x:109:114::/var/lib/ntop:/bin/false
git:x:1002:1005:,,,:/home/git:/usr/bin/git-shell
/var/log/mysql.err and /var/log/mysql.log empty.
grep 'mysql' /var/log/syslog: (I solved another problem before)
Apr 14 13:55:11 raspberrypi mysqld: 150414 13:55:11 [Note] /usr/sbin/mysqld: Normal shutdown
Apr 14 13:55:11 raspberrypi mysqld:
Apr 14 13:55:11 raspberrypi mysqld: 150414 13:55:11 [Note] Event Scheduler: Purging the queue. 0 events
Apr 14 13:55:12 raspberrypi mysqld: 150414 13:55:12  InnoDB: Starting shutdown...
Apr 14 13:55:14 raspberrypi mysqld: 150414 13:55:14  InnoDB: Shutdown completed; log sequence number 6669110
Apr 14 13:55:14 raspberrypi mysqld: 150414 13:55:14 [Note] /usr/sbin/mysqld: Shutdown complete
Apr 14 13:55:14 raspberrypi mysqld:
Apr 14 13:55:15 raspberrypi mysqld_safe: mysqld from pid file /var/run/mysqld/mysqld.pid ended
Apr 14 21:03:00 raspberrypi /etc/init.d/mysql[3611]: ERROR: The partition with /var/lib/mysql is too full!
Apr 14 21:03:56 raspberrypi /etc/init.d/mysql[3706]: ERROR: The partition with /var/lib/mysql is too full!
Apr 14 21:04:36 raspberrypi /etc/init.d/mysql[2269]: ERROR: The partition with /var/lib/mysql is too full!
Apr 14 21:08:02 raspberrypi /etc/init.d/mysql[2592]: ERROR: The partition with /var/lib/mysql is too full!
Apr 14 21:10:51 raspberrypi /etc/init.d/mysql[2750]: ERROR: The partition with /var/lib/mysql is too full!
Thank you very much for your help!


text:
Q: Cross Entropy Loss - Why the loss is not affected by the probability to make an error for a sample? Consider a classification network of 3 classes.
I am using softmax as the last layer and cross entropy loss.
Lets consider a single sample (x,y) that is ran through the network, where the correct class for this example is the first class.
Lets consider two cases (two different samples for the network):

*

*The softmax outputs (0.5,0.49,0.01)

*The softmax outputs (0.5,0.25,0.25).

For both samples the loss would be -log(0.5), but  my intution says that the first case should have a higher loss, because it is very close to making an error in prediction.
Am I wrong ? Why is this not a problem?

A: In softmax cross entropy you only care about how likely the correct class is. You get a small loss if it is very likely or a large loss if it is unlikely. In cases like 1 the second class has a way higher gradient and is pushed down by the gradient descent to a much larger extent than class 2 in the second case.
What you are actually optimizing for in classification tasks is accuracy and in accuracy you also only care about correctly classifying all the examples and not by how much. Logits are not trustworthy anyways, as they tend to output really confident predictions of elements far from your typical set of inputs.


text:
Q: Excel VBA, naming arguments causes "invalid procedure call or argument" Error 5 I have an Excel VBA script that creates a Table (a ListObject) from a range stored in the variable Storytable and then applied list formatting.
The positional parameter version of this line works fine:
Set Tbl = ActiveSheet.ListObjects.Add(xlSrcRange, StoryTable, , xlYes)

I would prefer to use named parameters, but naming the parameters causes an "invalid procedure call or argument" error (Error code 5) on this line:
Set Tbl = ActiveSheet.ListObjects.Add(SourceType:=xlSrcRange, Source:=StoryTable, TableStyleName:=xlYes)

even though this is pretty much identical to the example provided for the ListObjects.Add method in the Excel online help.
A bit of experimentation has shown that even naming just the final parameter TableStyleName:=xlYes in the first version of this line is enough to trigger the error.
What am I doing wrong here?

A: The fourth parameter to which you originally supplied xlYes is called XlListObjectHasHeaders, not TableStyleName. TableStyleName is the sixth parameter, and it does not accept xlYes as a valid option.
The online help is not only wrong in naming the parameters, it's also outdated and does not include TableStyleName.


text:
Q: wrong scope from $compile in angularjs i have a problem with $compile and get the correct scope to get my data.
i made a simplified codepen here
http://codepen.io/destroy90210/pen/GgZvXO?editors=001
but this is the problem, i try to put some data from one directive to his child-directive
...
angular.element(wrapper).append($compile("<navigationlist data-title="+navi.title+" navigation-list-data='data'></navigationlist>")(scope));
....

app.directive('navigationlist', function($compile) {
    var link = function (scope, elem, attrs) {
        console.log(scope.navigationListData);
    }
    return {
    scope:{
      navigationListData: "="
    },
    replace: true;
    restrict: "E",
    template: '

{{item.title}}

',
    link: link
    };
});

the log of the console shows me the correct values but the view renders just the last object of my navigation array, which you can see in the codepen...
anybody has some ideas how i solve that problem??
UPDATE
if i have not choosen the best way to build my navigation, perhaps somebody can show me how i can build it better ;)
i need this html structure

mainitem1

mainitem2

mainitem3

item1

item1

item1

item2

item1

item2

item1

item2

from this
var navigation = [
    {"title": "Album", "child": {"title": "category", data: ["item1", "item2", "item3"], "child": {"title": "gallery", data: ["item1", "item2", "item3"]}}},
    {"title": "Pages", "child": {"title": "pages", data: ["item1", "item2", "item3"]}},
    {"title": "Statistik"}
]

the numbers of childs can change so i cant use a "static" template
best regards
gregor ;)

A: When you use compile like you have, it only knows about data in context of the scope that you pass in. In your case, you are expecting it to somehow use your local data variable that you have defined within your loop. to use the rendering setup you currently have, you would need to reference the full path to that data in your template (i.e. navi[i][key].data) which would kinda suck. Especially since that would need to change as you got deeper into the tree structure.
To be honest, the way you have your directives setup makes very little sense to me. Why don't you just loop through the children again in the navigationsub template, instead of doing crazy logic in the controller and appending compiled elements?

A: ok i have done another approach to setup my navigation. i rebuild the navigationarray that it represents more the html markup which i need and splitted it in 2 items and subNavi has for every depth his own array
$scope.mainNavi = [];
$scope.subNavi = {depth1: Array[2], depth2: Array[1],...};

but thank you for your answers ;)
http://codepen.io/destroy90210/pen/pvyWzM?editors=101
now everythink works as expected ;)


text:
Q: Where date difference between now and max date value is greater than X I want to return a result set (from postgres database) containing clients whose last payment date was more than X number of days ago.
This is what I have currently to get a list of all clients and their last payment date:
  select usermaster.userid, date_trunc('days', now()-max(paymentdate)) as last_payment
  from usermaster, paymentdetail
  where usermaster.userid=paymentdetail.userid
  group by usermaster.userid;

I would like to limit with an extra where condition: where ... and last_payment > 100 days

A: You could add having at the end:
having trunc('days', now()-max(paymentdate)) > 100

A: This should do the trick
EDIT -
select * from
(SELECT usermaster.userid, date_trunc('days', now()-max(paymentdate)) as
        last_payment
from usermaster, paymentdetail
where usermaster.userid=paymentdetail.userid
group by usermaster.userid ) as temptab
where last_payment>100;


text:
Q: How to disable check of modules updates in Node-RED? Every time when Node-RED is starting too much time spends to check of modules updates. In our stateless containerization there is no sense to check updates. Could anyone know how to disable the update check to accelerate of starting process?
EDITED:
As @knolleary says the check process happening NOT when Node-RED is starting. The above conclusions were my mistake.

A: The check for updates is done entirely within the editor in the browser - the runtime doesn't play any part in that. So the startup time of the runtime has nothing to do with the update check.
The editor loads the palette catalog from https://catalogue.nodered.org in the background when you open it in your browser. It only does the work to compare the catalog with the list of what you have installed when you open up the palette editor. None of that should cause any start-up delays.
On what basis are you saying this is the cause of any delays you are seeing?
You can delay the palette manager entirely by setting editorTheme.palette.editable to false in your settings.js file.


text:
Q: the project target (android 2.2) was not properly loaded hi i have to create one new android project on my eclipse means am getting following error.how can i resolve this.please help me.here i have to change to layout file means doesnot display grapical layout.it is display below error.the gen file is doesnot create automatically here.
the error is display graphical layout file:
the project target (android 2.2) was not properly loaded
this error is display on my console window:
2012-09-28 12:00:33 - XcartAdmin] Android Launch!
   [2012-09-28 12:00:33 - XcartAdmin] adb is running normally.
   [2012-09-28 12:00:33 - XcartAdmin] Could not find XcartAdmin.apk!

A: There are several possible reasons behind this..

*

*You may run eclipse as an administrator (just right click on eclipse - run as administrator)

*go to window --> preferences and check whether android (in your case latest version should be 2.2) is there or not

*select your project -> right click > source > format (after that clean your project)


text:
Q: Seaside - What's the point of implementing #children in a WAComponent when a direct call to "html render:" is made in "renderContentOn: html"? Whatever >> children
        ^Array with: oneComponent with: anotherComponent.

Later in the code one might have something like this.
Whatever >> renderContentOn: html
        ...
        html render: oneComponent.
        ...
        html render: anotherComponent.

Since I make a call explicitly to render these components, what's the use of having them in #children? Is #children used for anything else?

A: Seaside depends on #children being correctly implemented for the following callbacks:

*

*#updateRoot: to customise the head section of the generated HTML document,

*#initialRequest: to initialise the component at the beginning of a session,

*#updateUrl: to modify the current URL,

*#updateStates: to registers objects for backtracking,

*as well as to support helper methods like #states, #scripts, and #styles.

Search the Seaside Book for these methods to learn more about them.


text:
Q: MVC list of HTML helper attributes @Html.EditorFor(model => model.SongName, new { htmlAttributes = new { @class = "form-control", @placeholder = "SongName" } }))

For Html helpers you can add attributes to them. However there isn't any intellisence that says all of the attributes you can add. I have tried searching online but I can't find a list of all types of attributes you can add here.
Can anyone tell me where I can find a full list of all attributes you can add in these helpers please?

A: There is no complete list.  This is why it's an anonymous object and not a defined class.
You can add any attribute you like to an HTML element.  There are a number of defined attributes, but HTML itself doesn't require that you use only the defined ones.  Various JavaScript frameworks and tools may sometimes define their own, for example.  (And even in the list of defined attributes there is data-* which is open-ended and variable.)


text:
Q: Recover hexdump asterisk with original content Say I've generated two hexdump, which include the asterisk.
First file (xxd -r works):
hexdump random.dat

0000000 6161 6161 6161 6161 6161 6161 6161 6161
*
0000020 6161 6261 6262 6262 6262 6262 6262 6262
0000030 6262 6262 6262 6262 6262 6262 6262 6262
*
00000b0

Second file (xxd -r doesn't work):
hexdump data2.dat

0000000 6161 6161 6161 6161 6161 6161 6161 6161
*
0000020 6161 6261 6262 6262 6262 6262 6262 6262
0000030 6262 6262 6262 6262 6262 6262 6262 6262
*
00000b0 000a
00000b1

Would like to be able to generate the original dump without the squeezing, and without having the original file. Exactly like this:
hexdump -v random.dat

0000000 6161 6161 6161 6161 6161 6161 6161 6161
0000010 6161 6161 6161 6161 6161 6161 6161 6161
0000020 6161 6261 6262 6262 6262 6262 6262 6262
0000030 6262 6262 6262 6262 6262 6262 6262 6262
0000040 6262 6262 6262 6262 6262 6262 6262 6262
0000050 6262 6262 6262 6262 6262 6262 6262 6262
0000060 6262 6262 6262 6262 6262 6262 6262 6262
0000070 6262 6262 6262 6262 6262 6262 6262 6262
0000080 6262 6262 6262 6262 6262 6262 6262 6262
0000090 6262 6262 6262 6262 6262 6262 6262 6262
00000a0 6262 6262 6262 6262 6262 6262 6262 6262
00000b0

hexdump -v data2.dat

0000000 6161 6161 6161 6161 6161 6161 6161 6161
0000010 6161 6161 6161 6161 6161 6161 6161 6161
0000020 6161 6261 6262 6262 6262 6262 6262 6262
0000030 6262 6262 6262 6262 6262 6262 6262 6262
0000040 6262 6262 6262 6262 6262 6262 6262 6262
0000050 6262 6262 6262 6262 6262 6262 6262 6262
0000060 6262 6262 6262 6262 6262 6262 6262 6262
0000070 6262 6262 6262 6262 6262 6262 6262 6262
0000080 6262 6262 6262 6262 6262 6262 6262 6262
0000090 6262 6262 6262 6262 6262 6262 6262 6262
00000a0 6262 6262 6262 6262 6262 6262 6262 6262
00000b0 000a
00000b1

So the procedure would be:

*

*Read dump from file (or from stdin).

*For each asterisk:

*

*Read ending offset at start of next line.

*Read starting offset at start of previous line.

*Rest them to determine how many lines require to be inserted.

*Insert that many lines, with the offset being increasing as corresponding.

*Output the entire dump to another file or stdout.

A: Try
awk '
/^\*/   {GAP = 1                                # check if action needed
         next                                   # don''t print, proceed to next line
        }
GAP     {TGT = sprintf ("%d", "0x" $1) + 0      # if action, calculate the end target
         do     {printf "%07x %s\n", L1, L0     # loop printing identical lines
                 L1 += 16                       # increment the first field
                }
         while (TGT > L1)                       # until target reached
         GAP = 0                                # reset action flag
        }
        {L1 = sprintf ("%d", "0x" $1) + 16      # save "to come" first field
         L0 = $0                                # and rest of line
         sub ("^" $1 FS, _, L0)
        }
1                                               # print input line
' file2
0000000 6161 6161 6161 6161 6161 6161 6161 6161
0000010 6161 6161 6161 6161 6161 6161 6161 6161
0000020 6161 6261 6262 6262 6262 6262 6262 6262
0000030 6262 6262 6262 6262 6262 6262 6262 6262
0000040 6262 6262 6262 6262 6262 6262 6262 6262
0000050 6262 6262 6262 6262 6262 6262 6262 6262
0000060 6262 6262 6262 6262 6262 6262 6262 6262
0000070 6262 6262 6262 6262 6262 6262 6262 6262
0000080 6262 6262 6262 6262 6262 6262 6262 6262
0000090 6262 6262 6262 6262 6262 6262 6262 6262
00000a0 6262 6262 6262 6262 6262 6262 6262 6262
00000b0 000a
00000b1

A: @RudiC Thanks a lot. Your script works with awk (original-awk) and mawk, but not with gawk. Check beforehand which one is the developer and whose version it is. You can also use namei /usr/bin/awk. Certain linux distros / *BSD may include any version of it and be a symlink to any other.
A lot of times, 'awk' is just a symlink to gawk, original-awk or mawk.
hexdump.exe random.dat | gawk '
/^\*/   {GAP = 1                                # check if action needed
         next                                   # don''t print, proceed to next line
        }
GAP     {TGT = sprintf ("%d", "0x" $1) + 0      # if action, calculate the end target
         do     {printf "%07x %s\n", L1, L0     # loop printing identical lines
                 L1 += 16                       # increment the first field
                }
         while (TGT > L1)                       # until target reached
         GAP = 0                                # reset action flag
        }
        {L1 = sprintf ("%d", "0x" $1) + 16      # save "to come" first field
         L0 = $0                                # and rest of line
         sub ("^" $1 FS, _, L0)
        }
1                                               # print input line
'
0000000 6161 6161 6161 6161 6161 6161 6161 6161
0000010 6161 6161 6161 6161 6161 6161 6161 6161
0000020 6161 6261 6262 6262 6262 6262 6262 6262
0000030 6262 6262 6262 6262 6262 6262 6262 6262
0000010 6262 6262 6262 6262 6262 6262 6262 6262
00000b0

hexdump.exe data2.dat | gawk '
> /^\*/   {GAP = 1                                # check if action needed
>          next                                   # don''t print, proceed to next line
>         }
> GAP     {TGT = sprintf ("%d", "0x" $1) + 0      # if action, calculate the end target
>          do     {printf "%07x %s\n", L1, L0     # loop printing identical lines
>                  L1 += 16                       # increment the first field
>                 }
>          while (TGT > L1)                       # until target reached
>          GAP = 0                                # reset action flag
>         }
>         {L1 = sprintf ("%d", "0x" $1) + 16      # save "to come" first field
>          L0 = $0                                # and rest of line
>          sub ("^" $1 FS, _, L0)
>         }
> 1                                               # print input line
> '
0000000 6161 6161 6161 6161 6161 6161 6161 6161
0000010 6161 6161 6161 6161 6161 6161 6161 6161
0000020 6161 6261 6262 6262 6262 6262 6262 6262
0000030 6262 6262 6262 6262 6262 6262 6262 6262
0000010 6262 6262 6262 6262 6262 6262 6262 6262
00000b0 000a
00000b1


text:
Q: How i draw a route with react-google-maps component? I'm traying to draw a route between two points with react-google-maps but is not working for me. Can u help me with this problem? Here's a example of my react component.
import React from 'react';
import {
  withScriptjs,
  withGoogleMap,
  GoogleMap,
  Marker,
} from 'react-google-maps';
import MapDirectionsRenderer from './app_map_directions_render';

const Map = withScriptjs(
  withGoogleMap(props => (
    <GoogleMap
      defaultCenter={props.defaultCenter}
      defaultZoom={props.defaultZoom}
    >
      {props.places.map((marker, index) => {
        const position = {lat: marker.latitude, lng: marker.longitude};
        return <Marker key={index} position={position}/>;
      })}
      <MapDirectionsRenderer places={props.places} travelMode={window.google.maps.TravelMode.DRIVING} />
    </GoogleMap>
  ))
);

const AppMap = props => {
  const {places} = props;

  const {
    loadingElement,
    containerElement,
    mapElement,
    defaultCenter,
    defaultZoom
  } = props;

  return (
    <Map
      googleMapURL={
        'https://maps.googleapis.com/maps/api/js?key=' +
        googleMapsApiKey +
        '&v=3.exp&libraries=geometry,drawing,places'
      }
      places={places}
      loadingElement={loadingElement || <div style={{height: `100%`}}/>}
      containerElement={containerElement ||
}
      mapElement={mapElement || <div style={{height: `100%`}}/>}
      defaultCenter={defaultCenter || {lat: 25.798939, lng: -80.291409}}
      defaultZoom={defaultZoom || 11}
    />
  );
};

export default AppMap;

And my MapDirectionsRenderer Component
import React, {Component} from 'react';
import { DirectionsRenderer } from "react-google-maps";

export default class MapDirectionsRenderer extends Component {
  state = {
    directions: null,
    error: null
  };

  componentDidMount() {
    const { places, travelMode } = this.props;

    const waypoints = places.map(p =>({
        location: {lat: p.latitude, lng: p.longitude},
        stopover: true
    }))
    if(waypoints.length >= 2){
    const origin = waypoints.shift().location;
    const destination = waypoints.pop().location;

    const directionsService = new window.google.maps.DirectionsService();
    directionsService.route(
      {
        origin: origin,
        destination: destination,
        travelMode: travelMode,
        waypoints: waypoints
      },
      (result, status) => {
        if (status === window.google.maps.DirectionsStatus.OK) {
          this.setState({
            directions: result
          });
        } else {
          this.setState({ error: result });
        }
      }
    );
    }
  }

  render() {
    if (this.state.error) {
      return
{this.state.error}
;
    }
    return <DirectionsRenderer directions={this.state.directions} />;
  }
}

A: To render a route Google Maps API provides Directions Service, in case of react-google-maps library DirectionsRenderer component is available which is a  wrapper around DirectionsRenderer class which in turn:

Renders directions obtained from the DirectionsService.

Assuming the data for route is provided in the following format:
const places = [
  {latitude: 25.8103146,longitude: -80.1751609},
  {latitude: 27.9947147,longitude: -82.5943645},
  {latitude: 28.4813018,longitude: -81.4387899},
  //...
]

the following component could be introduced to calculate and render directions via react-google-maps library:
class MapDirectionsRenderer extends React.Component {
  state = {
    directions: null,
    error: null
  };

  componentDidMount() {
    const { places, travelMode } = this.props;

    const waypoints = places.map(p =>({
        location: {lat: p.latitude, lng:p.longitude},
        stopover: true
    }))
    const origin = waypoints.shift().location;
    const destination = waypoints.pop().location;

    const directionsService = new google.maps.DirectionsService();
    directionsService.route(
      {
        origin: origin,
        destination: destination,
        travelMode: travelMode,
        waypoints: waypoints
      },
      (result, status) => {
        if (status === google.maps.DirectionsStatus.OK) {
          this.setState({
            directions: result
          });
        } else {
          this.setState({ error: result });
        }
      }
    );
  }

  render() {
    if (this.state.error) {
      return
{this.state.error}
;
    }
    return <DirectionsRenderer directions={this.state.directions} />;
  }
}

Here is a demo

For React 16.8 or above, MapDirectionsRenderer could be implemented (using Hooks) as below:
function MapDirectionsRenderer(props) {
  const [directions, setDirections] = useState(null);
  const [error, setError] = useState(null);

  useEffect(() => {
    const { places, travelMode } = props;

    const waypoints = places.map(p => ({
      location: { lat: p.latitude, lng: p.longitude },
      stopover: true
    }));
    const origin = waypoints.shift().location;
    const destination = waypoints.pop().location;

    const directionsService = new google.maps.DirectionsService();
    directionsService.route(
      {
        origin: origin,
        destination: destination,
        travelMode: travelMode,
        waypoints: waypoints
      },
      (result, status) => {
        console.log(result)
        if (status === google.maps.DirectionsStatus.OK) {
          setDirections(result);
        } else {
          setError(result);
        }
      }
    );
  });

  if (error) {
    return
{error}
;
  }
  return (
    directions && (
      <DirectionsRenderer directions={directions} />
    )
  );
}


text:
Q: adding html element using js I have generated html content

how can I on dom ready use image alt content (in this case asdsadasdsa) and add new attribute title with alt image content, in other words above html should be

js should target only code which has target="_blank" as part of a href attribute.

A: Try
$('a[target="_blank"]:has(img[alt])').attr('title', function () {
    return $(this).find('img').attr('alt');
});

DEMO - jsfiddle
Reference
:has()
.attr()
.find()
[ ] has-attribute-selector

A: You can try with this:
var $target = $('a[target="_blank"]');
var $content = $target.find('img').attr('alt');

$target.attr('title', $content);

or this way:
var $target = $('a[target="_blank"]');

$target.each(function(){
    $(this).attr('title', $(this).find('img').attr('alt'));
});

Demo Fiddle to try


text:
Q: Fuzzy c- means categorical data Can the fuzzy c-means applied on non numerical data sets ? i.e categorical or mixed numerical and categorical..
if yes (I hope so :( ):

*

*how we calculate cluster centers ?

If NO , what is the alternative .. how to fuzzy clusters these data ?
I need the response please help
NOTE: I've used the Jacard's coefficient to calculate the distance between 2 points but still didn't get the way to calculate the cluster centers see the attachements

A: You'll have to transform your data into a numeric form. There are various ways of doing that, two of them being:

*

*use vectors of feature counts (common in, e.g., text categorization)

*use a one-hot representation, where a categorical feature that can take on n distinct values is represented as string of n bits, with only the i'th bit set if a feature has the i'th value in its allowed range.

Both are very common transformations that many machine learning programs do under the hood. Also, you might want to experiment with a different metric than the Euclidean one. Esp. with one-hot representation, but depending on the data, the L1 norm (Manhattan/city block distance) may be more appropriate.
Apart from that, just apply the given formulas to your transformed dataset.


text:
Q: C++ error: "no instance of function template matches the required type" I'm a C++ newbie and am writing a class to add, subtract and multiply polynomials.  I'm seeing this error:
"no instance of function template matches the required type"
resulting from these statements:
display(add, count);
display(sub, count);
display(mult, count);
P1.display(add, count); (as well as for sub and mult)
P2.display(add, count); (as well as for sub and mult)

My code is:
#include "stdafx.h"
#include <iostream>
#include <cstdlib>

using namespace std;

class Poly
{

private:

    int order;                                  // the order of the polynomial
    int *coeff;                                 // pointer to an array of coefficients
                                                // size of the coefficient array is predicated on [order + 1]
    int *add;
    int *sub;
    int *mult;

public:

//  Poly();                                     // the default constructor
    int setOrderAndCoeff();                     // sets the order and coefficients
    int display(int *data, int count);          // displays the resutling polynomial
    void addition(Poly P1, Poly P2);            // adds 2 polynomials
    void subtraction (Poly P1, Poly P2);        // subtracts 2 polynomials
    void multiplication (Poly P1, Poly P2);     // multiplies 2 polynomials

//  ~Poly();                                    // the destructor
};

int Poly::display(int *data, int count)
{
    for (int i = count; i >= 0; i--)
    {
        cout << data[i] << "x^" << i;
        if ((i - 1) != -1)
        {
            cout << "+";
        }
    }
    cout << "\n";
    return 0;
}

int Poly::setOrderAndCoeff()
{
    int i;
    cout << "Please enter the order of the polynomial: ";
    cin >> order;
    coeff = new int[order + 1];
    for (i = order; i >= 0; i--)
    {
        cout << "Please enter the coefficient of x^" << i << " :";
        cin >> coeff[i];
    }
    return 0;
}

void Poly::addition(Poly P1, Poly P2)
{
    int max;
    int i;
    max = (P1.order > P2.order) ? P1.order : P2.order;
    add = new int [max + 1];

    if (P1.order == P2.order)
    {
        for (i = P1.order; i >= 0; i--)
        {
            add[i] = P1.coeff[i] + P2.coeff[i];
        }
    }

    if (P1.order > P2.order)
    {
        for (i = P1.order; i > P2.order; i--)
        {
            add[i] = P1.coeff[i];
        }
        for (i = P2.order; i >= 0; i--)
        {
            add[i] = P1.coeff[i] + P2.coeff[i];
        }
    }

    if (P1.order < P2.order)
    {
        for (i = P2.order; i > P1.order; i--)
        {
            add[i] = P2.coeff[i];
        }
        for (i = P1.order; i >= 0; i--)
        {
            add[i] = P1.coeff[i] + P2.coeff[i];
        }
    }
    cout << "\nAddition:";
    display(add, count);
    cout << "\n";
}

void Poly::subtraction(Poly P1, Poly P2)
{
    int max;
    int i;
    max = (P1.order > P2.order) ? P1.order : P2.order;
    int *sub = new int[max + 1];

    if (P1.order == P2.order)
    {
        for (i = P1.order; i >= 0; i--)
        {
            sub[i] = P1.coeff[i] - P2.coeff[i];
        }
    }

    if (P1.order > P2.order)
    {
        for (i = P1.order; i > P2.order; i--)
        {
            sub[i] = P1.coeff[i];
        }
        for (i = P2.order; i >= 0; i--)
        {
            sub[i] = P1.coeff[i] - P2.coeff[i];
        }
    }

    if (P1.order < P2.order)
    {
        for (i = P2.order; i > P1.order; i--)
        {
            sub[i] = -P2.coeff[i];
        }
        for (i = P1.order; i >= 0; i--)
        {
            sub[i] = P1.coeff[i] - P2.coeff[i];
        }
    }
    cout << "\nSubtraction:";
    display(sub, count);
    cout << "\n";
}

void Poly::multiplication(Poly P1, Poly P2)
{
    int i;
    int j;
    int max;

    max = P1.order + P2.order;
    int *mult = new int[max + 1];

    for (i = P1.order; i >= 0; i--)
    for (j = P2.order; j >= 0; j--)
    {
        mult[i + j] += P1.coeff[i] * P2.coeff[i];
    }
        cout << "\nMultiplication:";
        display(mult, count);
}

int main()
{
    int choice;
    Poly P1, P2, P3;
    cout << "-------- Instructions --------" << endl;

    cout << "For polynomial 1... " << endl;
    P1.setOrderAndCoeff();

    cout << endl;

    cout << "For polynomial 2... " << endl;
    P2.setOrderAndCoeff();

    while (1)
    {
        cout << "\n******** Menu Selection ********" << endl;
        cout << "1: Addition\n2: Subtraction\n3: Mutiplication\n0: Exit" << endl;
        cout << "Please enter your choice (1, 2, 3 or 0):";
        cin >> choice;

        switch (choice)
        {
        case 1:
            cout << "\n-------- Addition --------\n";
            cout << "Polynomial 1: ";
            P1.display(add, count);
            cout << "Polynomial 2: ";
            P2.display(add, count);
            P3.addition(P1, P2);
            cout << "--------------------------\n";
            break;

        case 2:
            cout << "\n-------- Subtraction --------\n";
            cout << "Polynomial 1: ";
            P1.display(sub, count);
            cout << "Polynomial 2: ";
            P2.display(sub, count);
            P3.subtraction(P1, P2);
            cout << "--------------------------\n";
            break;

        case 3:
            cout << "\n-------- Multiplication --------\n";
            cout << "Polynomial 1: ";
            P1.display(mult, count);
            cout << "Polynomial 2: ";
            P2.display(mult, count);
            P3.multiplication(P1, P2);
            cout << "--------------------------\n";
            break;

        case 0:
            cout << "The program will now terminate.  Thank you." << endl;
            exit(0);

        default:
            cout << endl;
            cout << "You have entered an invalid selection." << endl;
            cout << "Please enter a positive integer between 0 and 3.";
            cout << endl;
        }
    }
    return 0;

Does anyone know what's causing this?
Thanks for any guidance you can give?
-Ryan

A: In this code snippet
        switch (choice)
        {
        case 1:
            cout << "\n-------- Addition --------\n";
            cout << "Polynomial 1: ";
            P1.display(add, count);
            cout << "Polynomial 2: ";
            P2.display(add, count);
            P3.addition(P1, P2);
            cout << "--------------------------\n";
            break;

        case 2:
            cout << "\n-------- Subtraction --------\n";
            cout << "Polynomial 1: ";
            P1.display(sub, count);
            cout << "Polynomial 2: ";
            P2.display(sub, count);
            P3.subtraction(P1, P2);
            cout << "--------------------------\n";
            break;

        case 3:
            cout << "\n-------- Multiplication --------\n";
            cout << "Polynomial 1: ";
            P1.display(mult, count);
            cout << "Polynomial 2: ";
            P2.display(mult, count);
            P3.multiplication(P1, P2);
            cout << "--------------------------\n";
            break;

        case 0:
            cout << "The program will now terminate.  Thank you." << endl;
            exit(0);

        default:
            cout << endl;
            cout << "You have entered an invalid selection." << endl;
            cout << "Please enter a positive integer between 0 and 3.";
            cout << endl;
        }

in all calls of function display neither the first nor the second argument is defined. For example
where is there defined add and count in main?
            P1.display(add, count);

The function is defined as having two parameters
int Poly::display(int *data, int count)

If you want to pass as the first argument for example data member add then you should write at least
            P1.display( P1.add, count);

making data member add public.
However I do not see where the second argument with name count is defined.
For example in member function void Poly::addition(Poly P1, Poly P2); count can be defined as an expression max + 1 But in the main you call display outside other member functions of the class. So I can conclude that the code is in general wrong.

A: It's not a great error message, certainly.
The issue is that when you call Poly::display() from main(), you're passing the names of the members of Poly - add, mult and count - which aren't visible from the main method as they're declared as private within the class.
To resolve this, you would need to either:

*

*Define a method which displays the members you need without having to pass a reference to them from outside the class (for example displayMult(), etc)

*move the main loop you currently have within main() somewhere where those fields are visible - either into a member of Poly or a friend function of Poly

*Add public getters to retrieve the values of those member variables to Poly

A: int setOrderAndCoeff()

the member method would return an integer. however, in your main function,
   int choice;
    Poly P1, P2, P3;
    cout << "-------- Instructions --------" << endl;

    cout << "For polynomial 1... " << endl;
    P1.setOrderAndCoeff();   '<=  this is valid as long as there exists a setOrderAndCoeff overloading, return type is void.

i think one way to fix the error would be changing
int setOrderAndCoeff()

to
void setOrderAndCoeff(){
    int i;
    cout << "Please enter the order of the polynomial: ";
    cin >> order;
    coeff = new int[order + 1];
    for (i = order; i >= 0; i--)
    {
        cout << "Please enter the coefficient of x^" << i << " :";
        cin >> coeff[i];
    }

}

similar changes are required to Display member method in the class.


text:
Q: bat file to delete containing folder when double clicked? What I would like to do in my batch file is delete ALL the contents of the containing directory AND the directory itself.  Currently I am using the following command:
rmdir ..\dir /S /Q & exit

This works in that it deletes ALL of the contents in dir including the batch file but it fails to delete the directory, dir.  Is there a way to do this while deleting the dir also?  Essentially what I would like to do is create a batch script that would reside inside a ZIP file and deletes everything that gets created from unzipping the file.  The above command still leaves behind an empty directory.

A: What about the following?
cd ..
rmdir .\dir /S /Q & exit

You can't delete a directory which is occupied by a running process.


text:
Q: Node cluster not spawning phantom instances in the proper worker I'm using NodeJS with PhantomJS. My goal is to create 4x node instances with node cluster, each with 2 phantom children. And my code looks like this:
cluster.js:
var numCPUs = 4;

if (cluster.isMaster) {

    for (var i = 0; i < numCPUs; i++) {
        cluster.fork();
    }

    cluster.on('exit', function(worker, code, signal) {
        console.log('worker ' + worker.process.pid + ' died');
        cluster.fork();
    });

} else {
    require("./app");
}

App.js looks like this:
var instances = [];
var phantom = require('phantom');

function InstanceManager(instCount) {
    for (var i = 0; i < instCount; i++) {
           phantom.create(function(phantomInstance) {
            instances.push({
                cycle: 0,
                locked: false,
                instance: phantomInstance
            });
        });
    }
}

InstanceManager(2);

setInterval(function() {
    var i = 0;
    console.log('--' + instances.length);
}, 5000);

So after running cluster.js the expected output in node console each 5 seconds should be:
--2
--2
--2
--2

but instead looks like this:
--0
--0
--0
--8

Why the phantom instances aren't attached to the proper worker?

A: The problem seems to be with the phantom module, not working properly with the cluster.  If you replace it with a sort of test double, like
var phantom = {
    create: function (callback) {
        setImmediate(callback);
    }
};

you get the expected all-2 output.  To continue my investigation, I modified node_modules/phantom/phantom.js to get a minimal set up where your problem occurs.  This is it:
var http = require('http'), shoe = require('shoe'), spawn = require('win-spawn');

exports.create = function(cb) {
    var httpServer, sock;
    httpServer = http.createServer();
    httpServer.listen(0);
    httpServer.on('listening', function() {
        var listeningPort = httpServer.address().port;
        spawn('phantomjs', [].concat([__dirname + '/shim.js', listeningPort]));
    });
    sock = shoe(cb);
    return sock.install(httpServer, '/dnode');
};

What happens here is that a listening server is started, then a phantomjs process is started, which connects to the listening server via a WebSocket, and writes to it, after which the callback cb() is called.  You can get at this understanding by looking at shim.js and experimenting a bit.
What's the problem then!?  Well, if you console.log() the listeningPort you will see that you get the same port 8 times.  So it appears that every time you call phantom.create(), you somehow reuse the same listening server, hence your callback is called only in one process.
This seems to be a peculiar behaviour of the Node version you're using, when trying to listen on port 0.  Which would also explain why with another version of Node, the problem didn't occur (according to a comment
above).  Here is a gist of mine which isolates this counter-intuitive behaviour.
The solution is to specify a port when calling phantom.create(), and use 8 different ports, e.g., phantom.create(fn, { port: YOUR_PORT }) in your app.js.


text:
Q: Approval Process deployment failing with strange error I am deploying a Approval Process file via Metadata API and it is erroring out stating:
The approval process contains an invalid submitter value abc@validusername.com for type user.
The abc@validusername.com is a valid and active username and I have included that under the allowedSubmitters element with a type 'User' as below:
    <allowedSubmitters>
        <submitter>abc@validusername.com</submitter>
        <type>user</type>
    </allowedSubmitters>

But event when it is valid, the deployment fails with the stated error.
Any suggestions to resolve this? I want to deploy this file as a metadata itself rather than manually edit the component in Production.
Any help will be appreciated!

A: After trying a lot of things, I deployed the component by commenting out the allowedSubmitters node and fixing it in Production. Nothing else seemed to work.


text:
Q: DataHub: проблема с построением связей (lineage) между Looker и Snowflake Всем привет. Почему-то не строится lineage между Looker и Snowflake. Использую следующие recepie конфиги:
LookML:
source:
    type: lookml
    config:
        parse_table_names_from_sql: true
        stateful_ingestion:
            enabled: true
        api:
            client_secret: '${DEVELOPMENT_LOOKER_R_CLIENT_SECRET}'
            client_id: '${DEVELOPMENT_LOOKER_R_CLIENT_ID}'
            base_url: 'https://healthunion.looker.com'
        github_info:
            deploy_key: ""
            repo: ''
        extract_column_level_lineage: true
pipeline_name: 'pname'

Looker:
source:
    type: looker
    config:
        base_url: ''
        client_secret: '${DEVELOPMENT_LOOKER_R_CLIENT_SECRET}'
        client_id: '${DEVELOPMENT_LOOKER_R_CLIENT_ID}'
        extract_column_level_lineage: true
        extract_usage_history: true
        extract_owners: true
pipeline_name: 'pname'

Snowflake:
source:
    type: snowflake
    config:
        account_id: ''
        warehouse: ANALYST_MD
        username: '${DEVELOPMENT_SNOWFLAKE_RW_USER}'
        password: '${DEVELOPMENT_SNOWFLAKE_RW_PASSWORD}'
        role: el_role
        include_column_lineage: true
        include_views: true
        include_tables: true
pipeline_name: 'pname'


text:
Q: Why is my MySql query not returning the returning rows I want? I am working on a hotel rate system and am in a situation where some of the records which I don't want is displaying. Here's my table
room id    room_name    rate_starts   rate_ends    single_room   double_room
1          standard     2014-01-01    2014-02-28   150           200
1          standard     2014-03-01    2014-03-05   200           250
1          standard     2014-03-06    2014-03-31   300           350
2          Garden Villa 2014-01-01    2014-02-28   300           400

Here is my MySQL query
    SELECT room_id, room_name,
      SUM(`single_room` * DateDiff(
          Least(rate_ends + INTERVAL 1 DAY, '$ends'),
          Greatest(rate_starts, '$starts')
        )) AS Total
    FROM
        room_rate
    WHERE
          hotel_id   = '$hotel_id' AND
          rate_ends >= '$starts' AND
          rate_starts <= '$ends'
          GROUP BY room_id

here is my search parameter ($starts)'2014-02-27' to ($ends)'2014-03-02'
here is my result
Standard room 500
Garden Villa 600

for the time am searching only for single_room rates.
Actually i don't want to display Garden villa because that room rate is not complete. That room does not have the date range between 2014-03-01  to  2014-03-05. However it is still displaying the first date range results.
I hope you understood my problem. Thanks in advance

A: If you want the room rate to be in your start-end search interval, use
  WHERE
          hotel_id   = '$hotel_id' AND
          rate_starts>= '$starts' AND -- room rate starts in the search interval
          rate_ends<= '$ends'     --room rate ends in the search interval

we need another way to check availability
table:
room_id, date, running_availability:

select room_id, date,
  (select sum(availability from (select room_id, rate_starts as date, 1 as availability from     table
  union all
  select room_id, rate_ends, -1 as availability from table) as av2 where av1.date <= av2.date) as running_availability
from
(select room_id, rate_starts as date, 1 as availability from table
union all
select room_id, rate_ends, -1 as availability from table) as av2

Now you can check if the room is ever unavailable in your time interval (running_avaliability!=0 and date between start and end)
If you want to check price and availability in one go, you need to join the two. For the sake of readability, let's jsut call this table 'available'
SELECT room_id, room_name,
  SUM(`single_room` * DateDiff(
      Least(rate_ends + INTERVAL 1 DAY, '$ends'),
      Greatest(rate_starts, '$starts')
    )) AS Total
FROM
    room_rate
    left join
    (select * from available where running_availability!=1) av
    on av.date between '$starts' and '$ends'
WHERE
      hotel_id   = '$hotel_id' AND
      rate_ends >= '$starts' AND
      rate_starts <= '$ends'
      and av.date is null
      GROUP BY room_id


text:
Q: Windows 7 - Open the Volume Control popup from the command prompt I would like to open the Volume Control popup directly without using the mouse or keyboard. Currently, I am using AutoHotkey to press Win+B to focus on the system tray, Left to highlight the Volume Control icon , and then Enter to bring up the popup.

I assume that this is possible, considering that you can open the View Available Networks window with
rundll32 van.dll,RunVAN

as opposed to using the Network icon .

Is there a way to invoke the Volume Control popup from the command prompt? Please note that I am not looking to use the Volume Mixer (sndvol):

A: sndvol.exe allows you to specify window coordinates after -f and -t switches:

coordinates = y * 65536 + x, where x and y are signed integers

This command will open a window at x=500 y=400:
sndvol.exe -f 26214900

-f switch opens Volume Control, -t opens Volume Mixer.

A: Addendum:
As mentioned in my comment, using sndvol -f as per @Indrek's answer opens the Volume Control window in an unusual location, away from the system tray. Using AutoHotkey, we can make the popup appear where we see fit:
SetWinDelay, -1
Run, % "sndvol -f"
WinWaitActive, ahk_class #32770
WinMove, % A_ScreenWidth - 84, % A_ScreenHeight - 305 - 48

This script places the window at the bottom right of the screen. You can customize it to by changing the last line (WinMove).

A: sndvol.exe is what you want, you just need to use the -f flag to make it show just the master volume slider:
sndvol.exe -f

Running just sndvol.exe opens the volume mixer, as you noted.

A: On windows XP:  Use sndvol32 as follows
sndvol32 no params to display master volume window
sndvol32 -x to display small master volume window
sndvol32 -t to display volume control only (as per sound icon)


text:
Q: how to fix error "net::ERR_SSL_SERVER_CERT_BAD_FORMAT" When useing vuejs and nodejs with https and express I have some code to send https request in vue.js and when use actions methods in vuex for send https request I get this error in console

GET https://localhost/api/getpeople
  net::ERR_SSL_SERVER_CERT_BAD_FORMAT

my code is :
vue.js table.js
 import Axios from "axios";

 let state = {
people: []
  };

     let getters = {
     getPeople(state) {
         return state.people;
    }
}

      let mutations = {

    setPeople(state, people) {

          state.people = people
        }

       }

            let actions = {
            sendHttpReq({ commit }) {
             Axios.get('https://localhost:443/api/getpeople').then(response=>response.data).then(result=>{
                   commit('setPeople',result);
               }).catch(error=>{
             console.log(error.response)
        })
    }
}

    export default {
       state,
        getters,
        mutations,
       actions
              }

Node.js server side:
let express=require('express');
  let cors=require('cors');
  let https=require('https');
  let pem=require('pem');
  let mydb=require('./mydb')
  pem.createCertificate({days:1,selfSigned: true},(err,keys)=> {

if (err)
    return err;

let app = express();
app.use(express.json());
app.use(cors());
app.post('/api/setPeople', (req, res) => {
    let body = req.body;
    mydb.insert(body.firstName, body.lastName, body.phone, (result) => {
        res.status(200).send(result)
    });

});
app.get('/api/getpeople', async (req, res) => {
    mydb.getPoeple((result) => {
        console.log(result);
        res.status(200).send(result)
    });
});

https.createServer({key: keys.serviceKey, cert: keys.certificate}, app).listen(443, () => {
    console.log('server is run ' + 443);
});

  })

this is code send https request and get response and set in to people and other code show people in to the table. other code is correct but problem from this code
i get console.log(key.certificate) and get this result:
-----BEGIN CERTIFICATE-----
    MIICpDCCAYwCCQD1yVw3YCtIUDANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAls
    b2NhbGhvc3QwHhcNMTkxMDA2MTgxNzE3WhcNMTkxMDA3MTgxNzE3WjAUMRIwEAYD
    VQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDc
    e+2PKex1g7qkKljtWD9JgP7MBgL/YTsmMj3TGtn1cmV0415jb8tSJZi8x8zJwudY
    pDAjxk4bCRud0maV4Ag3LNSC8R+GrVpMd5oPzFI9crATf5OHzyJWhb3qYAutkw3s
    GB78q9VoFZygwV7LF2nAU61z6VS/mwECohEoJUvUSvcMmt4Qa3IBrFxpJhf5K6B8
    kLRYzhM/FpRxBGql9vuSYZWIpgWTpOIdUNwUtDejNE35CzrV8fhKzQWVEPQUSX3D
    7wJVIa5YBtJnxmPAIthiDTR6Z/N8VTccWJgWXxJsJ8qxIl1jn3xkOvaGRo2PyeVW
    +baSzEu6jYYkcSWj6DWJAgMBAAEwDQYJKoZIhvcNAQELBQADggEBABe9xrSwiJqW
    TUpgjc2mhXjsFlAZ9E1tkd3X+rayqfT236fsqtI0oifbCHtcSVGAxS9mu8rrSjLr
    uLOA8Guiod+pLvyizf1vZHYX6PAFiUOrOSj6i1IPN911yhMTrD1c9F1nHGuaklSv
    De+A5Vqu0VZdoZx2mtfZthILerqBr/iSMweeTdrTOedbLz9+AbtrEpowEUedytH0
    kOpljE0ndoPoqY7Q/CbZq8GlI6Zg504wDuYhUcFAnPgAoY+MWhP/+wquCbnlQfVD
    /DlWQh51Y+rpUghrf3GNenF58StvD7XpYIwCItpw2F3eWluB8QfDoRJ9rVTtEevA
    S+44fP5pe4U=
    -----END CERTIFICATE-----

A: axios performing a GET request, you should send data in url
axios.get('/user?ID=12345')
  .then(function (response) {
    // handle success
    console.log(response);
  })
  .catch(function (error) {
    // handle error
    console.log(error);
  })
  .finally(function () {
    // always executed
  })

and performing a POST request
axios.post('/user', {
    firstName: 'Fred',
    lastName: 'Flintstone'
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

now in your code you send POST request and this have object to send, you shod use
Axios.post('https://localhost:443/api/getpeople',{ withCredentials:
             true}).then(response=>response.data).then(result=>{
                   commit('setPeople',result);
               }).catch(error=>{
             console.log(error.response)

for GET request
Axios.get('https://localhost:443/api/getpeople').then(response=>response.data).then(result=>{
                   commit('setPeople',result);
               }).catch(error=>{
             console.log(error.response)

A: Taking the certificate PEM shown in the question one can do a openssl x509 -text and see:
Certificate:
    Data:
        Version: 1 (0x0)
        ...
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN=localhost
        ...
        Subject: CN=localhost

Thus, this is a X509v1 certificate issued for localhost. It does not have any Subject Alternative Names extension as required by at least Chrome. Only X509v3 certificates can have such extensions and they need to be specifically configured. The documentation of pem contains examples on how to create certificates with the necessary extensions.


text:
Q: One-To-Many Spatial Join With Tabular Output Only? I need to run a "one-to-many" spatial join between two large and complex polygon layers.  The problem is that the output saved to a file GeoDB results in a layer that is almost 1 TB in size and it takes hours to run.  However, the only thing I really care about is the output of that attribute table itself, which has a separate row for each record in the join layer that each record in the target layer intersects with, and that is the only thing I need to generate various tabular summaries I need to run.
Does anyone know if there's a way to basically run a one-to-many spatial join, but only have it write the tabular results in the output, without any shapes?  The shapes in this output are not useful for anything, and just take up a massive amount of space and probably add a lot to the processing time to write them all (hundreds of thousands).

A: Just adding an update to my own question that I think I may have figured out a couple of different existing tools that can accomplish this based on feedback above and from other folks I've reached out to.
One is the "Tabulate Intersection" tool, which basically outputs a table with a separate row for each type of value that records in the input layer intersect with in a second layer (or you can run a layer against itself).  If you use the unique record ID for each layer, it will essentially give you a table with a separate row for each record that overlaps in each layer.  The only problem is that it won't output records as an intersection if they only touch but do not cross like a spatial join will.  This ran on my same input dataset in only about 1.5 hrs and the output table was only 35 MB.
The other tool that could potentially work as suggested above, is the Generate Near Table utility, which I haven't tried yet.  Presumably if you set a search distance of zero, it would also generate a table with a separate row for each record with every other record that is within a distance of zero, which is essentially the set of all records that touch or cross each other.  The difference with the Tabulate Intersection tool is that you wouldn't be able to discern whether records cross or just touch if that is important; you'd only know it's one or the other I think.
The coding solution could definitely be helpful if we decide to try and tackle this with a custom tool or script.

A: To do this, what I would try starting from is:

*

*Use an arcpy.da.SearchCursor and @SHAPE token to write a Python dictionary for SHAPE and ID

*Use an arcpy.da.InsertCursor to have a table ready to write records into

*Use a second arcpy.da.SearchCursor to compare each geometry with every geometry in the dictionary, and whenever they intersect write a record to the table

If it provides adequate performance then fine, and if not you will have learned more about your problem, and may need to think about ways to divide and conquer your data.
If Python and ArcPy do not provide the performance that you seek then at least you will have a quickly written prototype from which to write lower level code using ArcObjects.


text:
Q: Prolog - Display prime numbers I am new to Prolog programming so still learning. I'm tryingto create a program that accepts a value X and returns a list of all prime numbers between 6 and X. I'll also be later adding an error output if X is entered as 6 or lower.
I have come up with the below code so far to have the value of x entered, y as the first prime number and the counter as 1. Even this is not working, as I try to increment the values of Y. If i can get this working I plan to then add conditions to only show Y if it is a prime, by checking that it divides by itself and 1.
If anyone has any advice it would be greatly appreciated.
prime (X, Y, Counter) :-
    X >= Y,
    writeln(Y),
    Next is Y + Counter,
    prime (X, Next, Counter).

prime(X, Y, _) :-
     Y > X.

A: Remove the spaces in prime ( here and here:

Then it works to call ?- prime(10, 3, 1). and have it count.


text:
Q: How to integrate checkstyle and PMD into Play framework Build.scala file I am trying to integrate Checkstyle and PMD into the Play framework. I started by using the giter8 template created by ymasory to produce a sample build.scala file that supports the checkstyle and pmd commands in the sbt console.  This works fine and I've uploaded the resulting project to github:
https://github.com/ics-software-engineering/sbt-example-qa
The problem occurs when I try to use this code with the Build.scala file created by the Play new command.  The giter8 template integrates checkstyle and pmd using the 'settings' value, as illustrated here (see the actual file for the entire definition):
object ProjectBuild extends Build {

  val main = Project(
    "sbt-example-qa",
    new java.io.File("."),
    settings = Defaults.defaultSettings ++ ProjectSettings.all
  )
}

On the other hand, the Build.scala file generated by the 'play new' command has a different structure:
object ApplicationBuild extends Build {

  val appName         = "play-example-qa"
  val appVersion      = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    // Add your project dependencies here,
    javaCore,
    javaJdbc,
    javaEbean
  )

  val main = play.Project(appName, appVersion, appDependencies).settings(
    // Add your own project settings here
  )
}

Specifically, the Build.scala file created by 'play new' defines a play.Project rather than a Project as create by the giter8 template.
All my attempts to "Add my own project settings here" to get Checkstyle and PMD into the Play projecthave failed with syntax errors such as the following:
[info] Loading project definition from /Users/johnson/projecthosting/github/play-  example-qa/project
[error] /Users/johnson/projecthosting/github/play-example-qa/project/Build.scala:17:   overloaded method value settings with alternatives:
[error]   (ss: sbt.Project.Setting[_]*)sbt.Project <and>
[error]   => Seq[sbt.Project.Setting[_]]
[error]  cannot be applied to (settings: Seq[sbt.Project.Setting[_]])
[error]   val main = play.Project(appName, appVersion, appDependencies).settings(
[error]                                                                 ^
[error] one error found
[error] (compile:compile) Compilation failed

For your reference, here is the sample Play project I am trying to create that merges the giter8 template:
https://github.com/ics-software-engineering/play-example-qa
Can someone explain how to modify Build.scala in this project so that the Play console can accept the "checkstyle" and "pmd" commands in a manner similar to the giter8 template? Perhaps by forking the play-example-qa project and fixing Build.scala?  I intend to make the working code available to the Play community for future reference. Thanks in advance.

A: I've created a GitHub repo that answers your question.
You can start with that project, or manually follow these steps to adapt my giter8 template to Play:

*

*First make a new Play project with play new foo, choosing 2 for Java.

*Put the template's pmd-ruleset.xml and checkstyle-config.xml in the Play project directory.

*Copy the object ProjectSettings from the template's project/build.scala into Play's project/Build.scala.

*Add the contents of the template's project/plugins.sbt to Play's project/plugins.sbt, remembering to leave a blank line before you paste.

*Last, change the Play project/build.scala to actually use ProjectSettings.all from the template:

val main = play.Project(appName, appVersion, appDependencies).settings(
  ProjectSettings.all: _*
)


text:
Q: Table Compilation Error I wish to produce a table in LaTeX, and I have the following code:
\begin{document}
\usepackage{graphicx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

    \begin{table}[htbp]\centering
    \caption{\label{}
    \textbf{} }\begin{tabular} {@{} l r r r r @{}} \\ \hline
    \textbf{decade   variable } & \textbf{      mean} & \textbf{        sd} & \textbf{       min} & \textbf{       max} \\
    \hline
    1870             FX  &   .0067936 &   .0213805 &          0 &   .2598524 \\
    1880             FX  &    .007234 &   .0247923 &          0 &   .4339035 \\
    1890             FX  &    .006457 &   .0262819 &          0 &   .5958799 \\
    1900             FX  &   .0053169 &   .0250915 &          0 &   .6504794 \\
    1910             FX  &   .0040217 &   .0212009 &          0 &   .6297928 \\
    1920             FX  &   .0037496 &   .0183218 &          0 &   .6062132 \\
    1930             FX  &   .0032832 &   .0180154 &          0 &   .6439216 \\
    1940             FX  &   .0017647 &   .0124483 &          0 &   .5444609 \\
    1950             FX  &   .0013486 &   .0098272 &          0 &   .5584736 \\
    1960             FX  &   .0013742 &   .0109455 &          0 &   .9799178 \\
    1970             FX  &   .0018738 &   .0152187 &          0 &    1.62081 \\
    1980             FX  &   .0018762 &   .0126865 &          0 &   1.141317 \\
    1990             FX  &   .0016994 &   .0114209 &          0 &   .7125121 \\
    2000             FX  &   .0018457 &   .0132574 &          0 &   1.298152 \\
    2010             FX  &   .0018348 &   .0117263 &          0 &   1.262003 \\
    \hline
    \multicolumn{5}{@{}l}
    \end{tabular}
    \end{table}

`\end{document}

I receive an error that a missing \endcsname is inserted on the \end{table} line. Any help on this is much appreciated!


text:
Q: Massive WordPress botnet hack attack - how to fight back? Surely many of you have read about the WordPress botnet hacking attempts taking place over the last several weeks. I have seen a massive spike tonight and wanted to voice this information.
What are some ways to tighten up WordPress and the server environment to address brute force hack attempts?
I know this is not the intended use of Stack Overflow, but I know many of you are webmasters running WordPress and I hope this will be helpful to you and your clients/projects.

A: I am using Parallels Plesk Firewall to block IP addresses associated with this attack.
Server Management > Tools & Settings > Firewall
Click Edit Firewall Configuration, then the icon for Add Custom Rule.
Match: Incoming traffic
Action: Deny
Ports: All (or at least 80, and 443 if SSL)
Sources: all IPs below.

I had previously been using .htaccess in the root directory to restrict access, like so:
<Files *>
order allow,deny
allow from all
deny from 1.2.3.4
deny from 5.6.7.8
</Files>

I have also installed the following WordPress plug-ins:
Limit Login Attempts: http://wordpress.org/extend/plugins/limit-login-attempts/
Google Two-Step Authenticator: http://wordpress.org/extend/plugins/google-authenticator/
In the past thirty minutes, I've seen brute force attempts at several of my WordPress installations from these IP addresses:
190.234.216.92 # 12:05 AM CDT
201.240.162.223
180.151.140.137
178.61.152.129
187.202.244.21
194.44.84.85
1.54.9.202
5.46.71.93
123.28.90.52
113.182.216.235
118.172.136.255
189.238.204.124
187.149.54.161
27.75.87.103
204.44.158.11
219.92.194.35
212.253.62.52
79.134.140.222
109.127.164.147
183.80.145.45
58.186.5.37
123.21.195.28
186.160.7.50
187.152.42.228
1.179.159.129
92.47.171.78
187.170.115.29
190.233.229.55
202.179.20.181
61.28.152.30
181.64.188.226
203.194.116.98
113.172.86.89
161.246.193.147
117.223.56.73
178.168.37.228
125.161.8.238
101.51.197.248
180.191.91.210
121.1.38.244
94.247.129.203
91.216.189.82
182.18.208.2
58.186.34.96
27.109.119.200
121.54.112.183
103.3.80.207
1.4.225.183
190.119.34.83
110.54.233.98

49.49.210.189 # 12:35 AM CDT
113.165.162.170
201.173.85.250
190.119.20.173
124.105.160.244
201.141.76.93
123.21.109.49
122.53.79.32
183.80.8.204
201.102.186.62
182.18.208.4
180.191.111.75

124.82.238.54 # 12:43 AM CDT
223.206.192.208
124.106.123.179

I know this is not the intended use of StackOverflow, but I know many of you are webmasters running WordPress and I hope this will be helpful to you in securing your clients/projects.