text:
Q: Your account already has a valid Developer ID Application certificate The last couple of days I've struggled with code signing my cocoa app in Xcode. I've read through all similar topic that looked to be related, but nothing has helped.
Whenever I try to export my archive I get this error message:

I've tried to delete everything in my keychain and all profiles/certificates that I'm allowed to delete/revoke in the member center. However, I still get the same error with no "Fix" or "Reset" button. How should I proceed in order to get my application signed for distribution outside of store?

A: I'm hitting this same issue.
The error appears to be telling you that valid Developer ID Certs have been created under your developer account, but they are not currently on your Mac, so they cannot be used.
The solution would be to download the Developer ID Cert(s) from the web. However, you likely do not have the Private Key used to sign these certs. So at this point they are rather useless.
In my case, the further problem is that I already have 5 Developer ID Certificates in my account. I'm not quite sure where these came from. They were created years ago, perhaps when I was attempting to create Mac App Store certs? Or perhaps by clicking that damn Fix Issue button...
There appears to be a limit of 5 Developer ID Certificates per developer account, by default.
Developer ID Certificates are created, now, through Xcode rather than via the Members Center:

However, in Xcode, there is no longer a button to "Create" a new cert. The only button is "Reset". This button simply links me back to the Members Center in my web browser, so is completely useless...

Via the Members Center, Developer ID Certificates cannot be revoked, as you would an iOS or Mac App Store certificate. The "Revoke" button is Grayed out.

You can't revoke Developer ID or Pass Type ID certificates using Member Center. Instead, send a request to Apple at product-security@apple.com to revoke these types of certificates.

Apple will only revoke these certificates in cases of security, to disable installation of the app on all client machines. I've tried emailing the above address, and they told me they could not revoke the cert.
The solution, then, is to have additional Developer ID Certificate slots added to your account, past the limit of 5.
Product Security told me, rather than revoking the certs,

We encourage you to contact Apple Developer Connection at https://developer.apple.com/support/ to resolve the issue you're experiencing.

I've now contacted developer support. I recommend calling. They are currently, hopefully, setting up new Developer ID slots on my dev account.
When you create a new Developer ID Certificate that you will actually use, be sure to back up the Certificate and Private Key so that you do not hit this issue in the future.
EDIT:
I waited for over a month, I believe, with no response. I happened to have a ticket to an Apple TV Tech Talk and talked to an Apple representative at their lab. He was able to reset my Developer ID Certificate limit in about 5 minutes. So this is possible, but to expedite the process I would attempt to talk with a Developer Evangelist at Apple either in person or over the phone.

A: Go to Preferences -> Accounts, choose your account, click "View Details" in the bottom right corner and in the dialog click Download all in the bottom left corner.
Also, take a look at fastlane.tools. It is a great set of tools, which is, among other things, capable of dealing with code signing issues. Calling cert and sigh is sometimes enough to deal with many code signing-related problems.

A: One issue could be the private key is missing for your developer cert.  With Keychain Access find your developer cert and verify it has a little triangle beside it. Click on the triangle to reveal the private key.
If it's not there you'll need to restore this private key from the Mac you created your certificate.
Otherwise, delete the cert from the Apple Developer website and then create a new one.

A: I had installed my Developer ID Application Certificate on a different Mac and was getting the same error as in the question when I tried to use that certificate on a "new" Mac.
This fixed it for me:
I still have the other Mac so I exported the Developer Accounts from that one again:

*

*Go to XCode | Preferences | Accounts

*Click the "cog" in the bottom-left-hand-corner next the the plus and minus signs

*Click "Export Developer Accounts"

*Save the exported file somewhere accessible to your other Mac

Then, on my "new" Mac:

*

*Go to XCode | Preferences | Accounts

*Select the Apple ID that represents my dev certs

*Click the minus sign in the bottom left hand corner to delete that account

*Quit XCode

*Open Key Chain Access

*Delete all Developer Certificates

*Close Keychain Access

*Go to XCode | Preferences | Accounts

*Click the "cog" in the bottom-left-hand-corner next the the plus and minus signs

*Click "Import Developer Accounts"

*Select the file exported on the "old" Mac above and import

A: Same issue here but i was using "automatically manage settings" on Xcode 8. And for a particular reason there were two distribution certificates in my developer account.
Xcode seems to choose the most recent automatically and I didn't have it installed on my mac. So I switch to the old way by creating manually my app ID and my provisioning profile (which use the appropriate certificate) and it works :)

A: I had similar issue. I've discovered that my provisioning profile was invalid since I've updated iOS Developer certificate. After PP regeneration everything works as expected.

A: I ran into this same issue, and I fixed it at last. There are some tips:

*

*in Xcode -> Preferences -> Accounts, click button View Details, then
click button Download All Profiles

*in Keychain Access, check if the certificate exists. if not, choose
File->Import items, then choose the .cer file you download
    from developer website
Hope it helps.

A: On Xcode Version 8.3.3 go to Preferences ->Accounts -> Manage Certificates -> then click (+) ->on dropdown menu click iOS Development. Do the same for iOS App Store -> Done -> Download All Profiles.

A: If you have changed the machine Exporting the developer account from old mac and then importing into new mac solves the problem


text:
Q: EL resolving bean name Having a @Named Bean: HelloBean
In a JSF page, Why this reference is correct:
#{helloBean.var1}

And this doesn't appear to: (IDE Warning: "Can't resolve variable Name")
#{HelloBean.var1}

A: From the Oracle's Java EE 6 Tutorial:

The @Named qualifier allows you to access the bean by using the bean name, with the first letter in lowercase.

The same rule applies also for ManagedBean annotation:

If the value of the name  attribute is unspecified or is the empty String, the managed-bean-name is derived from taking the unqualified class name portion of the fully qualified class name and converting the first character to lower case

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why is Java not finding classes that are in the CLASSPATH? I am trying to install Mooshak which is distributed as a .jar installer.  When I run the file, it gives me the following error about a missing class:
ifinlay@mooshak:~$ sudo java -jar MooshakInstaller.jar -cui
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/ArchiveException
    at pt.up.fc.dcc.mooshak.installer.Installer.<init>(Installer.java:26)
    at pt.up.fc.dcc.mooshak.installer.Installer.main(Installer.java:52)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.archivers.ArchiveException
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 7 more

So it can't find the org/apache/commons/compress/archivers/ArchiveException class.  But I have installed this library and have the following in my CLASSPATH:
ifinlay@mooshak:~$ echo $CLASSPATH
.:/usr/share/maven-repo/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar

And this .jar file in the CLASSPATH does seem to contain the class in question:
ifinlay@mooshak:~$ jar tvf /usr/share/maven-repo/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar

# ... other classes edited out
   722 Fri Mar 01 16:57:28 UTC 2019 org/apache/commons/compress/archivers/ArchiveException.class
# ... other classes edit out

So why can Java not find this class when it does seem to be in the path?  Any help would be so awesome, I'm really scratching my head at this.
Thanks for reading!
EDIT: The Manifest file for the .jar looks like this:
Manifest-Version: 1.0
Rsrc-Class-Path: ./ junit.jar org.hamcrest.core_1.3.0.v201303031735.ja
 r commons-compress-1.12.jar BrowserLauncher2-all-1_3.jar
Class-Path: .
Rsrc-Main-Class: pt.up.fc.dcc.mooshak.installer.Installer
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader

So this seems to imply that the commons-compress-1.12.jar file should just be placed in the same directory as the installer.  This doesn't seem to work though...

A:
Why is Java not finding classes that are in the CLASSPATH?

Short answer: because they are NOT on the actual classpath.
Long answer:
There is either something wrong with the installer, or you are not running it correctly / as it is designed to be run.
When you run a java like this with a -jar option:
java -jar MooshakInstaller.jar -cui

it will ignore the CLASSPATH variable, and any -cp arguments that you add.  That explains why Java is not finding classes in the commons-compress-1.18.jar JAR file on your (assumed) classpath.
This means one of the following:

*

*The MooshakInstaller.jar installer is missing a dependency; i.e. it is broken. (I doubt this is the case.  They would have spotted this.)

*The MooshakInstaller.jar installer is not designed to be run as an executable JAR.

*The MooshakInstaller.jar installer is expecting to find the dependency in some location relative to the location of the JAR file.  (See if there is a "Class Path" attribute in the JAR's manifest file.)
I would also note that when you run this:
sudo java -jar MooshakInstaller.jar -cui

the value of the CLASSPATH environment variable will probably not be passed through to the root process.  Check the manual entry for sudo.  This is not the actual problem here ... because the CLASSPATH variable is being ignored anyway, due to the -jar option.

UPDATE
It looks like you simply didn't follow the installation instructions:

To install Mooshak you must execute the following commands. Make sure your system has all requirements. Note that you must have root privileges
% tar xzf mooshak-version.tgz
% cd mooshak-version
% su
# ./install

That's not what you did, and I strongly suspect that what you actually did is not equivalent to the above.
(I'm not going to investigate this further, because the download procedure requires me to give them all sorts of personal details.  No way Jose!)

A: This answer is based on the new information you provided.  It changes things.
First of all, what I said about CLASSPATH and -jar remains true.
However, it turns out that the Mooshak 2 installer is an executable JAR that uses a "jar in jar" loader.

*

*The main class is org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.

*The manifest specifies that the classpath for the installer should include these nested JARs which are part of the installer JAR:
 junit.jar
 org.hamcrest.core_1.3.0.v201303031735.jar
 commons-compress-1.12.jar
 BrowserLauncher2-all-1_3.jar

*The JarRsrcLoader entrypoint classes should then set up classloaders for the above JARs, and then start the installer.
And it should all just work.
I do see one strange thing though.  The manifest has commons-compress-1.12.jar, but you seem to be trying to use commons-compress-1.18.jar.
You said:

So this seems to imply that the commons-compress-1.12.jar file should just be placed in the same directory as the installer.

I don't read it that way, but I will see if I can find the documentation.
UPDATE: nope.  I couldn't find the documentation, but it seems from the JarRsrcLoader source code, that it doesn't work that way.
But I did find a clue.  In the current version of JarRsrcLoader there is separate code for Java 8 and Java 9+.  So, if the Mooshak 2.0 installer uses an older version of JarRsrcLoader, AND you are trying to install with Java 9 or later, then it is possible that it won't work.
So, make sure that you use Java 8 ... like the requirements say.

However, what you are apparently trying to do here is to use a different version of the compress library.  The better way to do this is to set up your own build tree for Mooshak:

... checkout the full source code with svn checkout https://svn.dcc.fc.up.pt/projects/Mooshak/Mooshak/

Then modify the dependencies and build / install as per the instructions that I presume are in the tree.


text:
Q: XMLHttpRequest testing in Jest I want to test AJAX methods (vanilla XHR) and I can't find the way to do it with Jest framework. I found mock-ajax.js for Jasmine. The problem is I can't find the way to install it.
Is there maybe a better way to unit test Ajax functions in Jest?

A: The jest api has changed a bit. This is what I use. It doesn't do anything but it's enough to render my components.
const xhrMockClass = () => ({
  open            : jest.fn(),
  send            : jest.fn(),
  setRequestHeader: jest.fn()
})

window.XMLHttpRequest = jest.fn().mockImplementation(xhrMockClass)

and in the test file:
import '../../__mock__/xhr-mock.js'

A: As mentioned you don't need additional libraries:
 // mocks.js is where you could put your mocks (example below)
 const mocks = require('./mocks.js')

 test('XHR test', () => {
   let xhrMock = {
      open: jest.fn(),
      setRequestHeader: jest.fn(),
      onreadystatechange: jest.fn(),
      send: jest.fn(),
      readyState: 4,
      responseText: JSON.stringify(mocks),
      status: 200
    }

   window.XMLHttpRequest = jest.fn(() => xhrMock)

   sendData().then((response) => {
      // You could do you checks here. Some examples:
      expect(xhrMock.setRequestHeader).toBeCalledWith('Cache-Control', 'no-cache')
      expect(xhrMock.open).toBeCalledWith('POST', 'you_api_url.com/end_point/')
      expect(xhrMock.withCredentials).toBe(false)

      let formData = new FormData()
      formData.append('firstParam', 'firstParamValue')

      expect(yoloRequestMock.send).toBeCalledWith(formData)
      expect(JSON.stringify(response)).toBe(JSON.stringify(mocks))
   })
   // when onload is called, resolve and reject has been initialed.
   xhrMock.onreadystatechange()

    // the following function is the one which sends the request (to be tested)
    function sendData() {
       return new Promise(function(resolve, reject) {
         let formData = new FormData()
         formData.append('firstParam', 'firstParamValue')
         let xhr = new XMLHttpRequest()
         xhr.withCredentials = false
         xhr.onreadystatechange = function () {
           if (this.readyState === 4) {
             if(xhr.status === 200) {
               resolve(JSON.parse(xhr.responseText))
             } else {
               reject(xhr.responseText)
             }
           }
         }
         xhr.open('POST', T2S_VISUAL_SEARCH_PARAMS.t2sVisualSeacchApiUrl)
         xhr.setRequestHeader("Cache-Control", "no-cache");
         xhr.send(formData)
       })
    }
  }

The file mocks.js contains the mocks:
module.exports =
  {
    response: {
      body: { ... }
    }
  }

A: You can test XHR in Jest without additional packages. This is helper function which creates mock object for XMLHttpRequest:
let open, send, onload, onerror;

function createXHRmock() {
    open = jest.genMockFn();

    // be aware we use *function* because we need to get *this*
    // from *new XmlHttpRequest()* call
    send = jest.genMockFn().mockImpl(function(){
        onload = this.onload.bind(this);
        onerror = this.onerror.bind(this);
    });

    const xhrMockClass = function () {
        return {
            open,
            send
        };
    };

    window.XMLHttpRequest = jest.genMockFn().mockImpl(xhrMockClass);
}

And you can use it in test as follows:
it('XHR success', () => {
    createXHRmock();

    // here you should call GET request

    expect(open).toBeCalledWith('GET', 'http://example.com', true);
    expect(send).toBeCalled();

    // call onload or onerror
    onload();

    // here you can make your assertions after onload
});

A: Here's a function that will create a XMLHttpRequest mock and install it into window for you.
const mockXMLHttpRequest = () => {
  const mock = {
    open: jest.fn(),
    addEventListener: jest.fn(),
    setRequestHeader: jest.fn(),
    send: jest.fn(),
    getResponseHeader: jest.fn(),

    upload: {
      addEventListener: jest.fn(),
    },
  };

  window.XMLHttpRequest = jest.fn(() => mock);

  return mock;
};

Which you can then use in a test like so:
const mock = mockXMLHttpRequest();

// Get the upload progress callback
// This assumes you attach your listeners in a stable order
expect(mock.upload.addEventListener).toHaveBeenCalledTimes(1);
const [[, progress]] = mock.upload.addEventListener.mock.calls;

// Get the load callback
expect(mock.addEventListener).toHaveBeenCalledTimes(1);
const [[, load]] = mock.addEventListener.mock.calls;

expect(mock.open).toHaveBeenCalled();
expect(mock.send).toHaveBeenCalled();

// Fire a progress event
progress({ loaded: 12, total: 100 });

// ...

mock.status = 201;
mock.getResponseHeader.mockReturnValue('application/json');
mock.response = JSON.stringify({ id: 111 });

// Fire a load event
load();

// ...

A: Here's a TypeScript example working with Jest 26:
function performRequest(callback: any) {
  const xhr = new XMLHttpRequest();
  xhr.open('GET', 'https://example.com/');
  xhr.onreadystatechange = () => {
    if (xhr.readyState !== 4 || xhr.status !== 200) return;
    callback(xhr.response);
  };
  xhr.responseType = 'json';
  xhr.setRequestHeader('Accept', 'application/json');
  xhr.send(null);
}

describe('request', () => {
  const xhrMock: Partial<XMLHttpRequest> = {
    open: jest.fn(),
    send: jest.fn(),
    setRequestHeader: jest.fn(),
    readyState: 4,
    status: 200,
    response: 'Hello World!'
  };

  jest.spyOn(window, 'XMLHttpRequest').mockImplementation(() => xhrMock as XMLHttpRequest);
  const callback = jest.fn();
  performRequest(callback);
  expect(xhrMock.open).toBeCalledWith('GET', 'https://example.com/');
  expect(xhrMock.setRequestHeader).toBeCalledWith('Accept', 'application/json');
  (xhrMock.onreadystatechange as EventListener)(new Event(''));
  expect(callback.mock.calls).toEqual([['Hello World!']]);
});

A: This is how I did it.
test.js
const open = jest.fn();
const onload = jest.fn((x) => {/* <your response data> */});
const onerror = jest.fn();
const send = jest.fn(function(){
    this.onload()
})

const xhrMockClass = function () {
    return {
        open,
        send,
        onerror,
        onload
    };
};

global.XMLHttpRequest = jest.fn().mockImplementation(xhrMockClass);

// ...

test('Should make a request', () => {
 // do stuff to make request

 expect(send).toHaveBeenCalled()
 expect(onload).toHaveBeenCalledWith(/* <your response data> */)
 expect(open).toHaveBeenCalledWith('GET', 'some/url', true)
})

A: Taking @thajay's answer a step further, I mocked all the XMLHttpRequest properties (which extends from XMLHttpRequestEventTarget and EventTarget:
window.XMLHttpRequest = jest.fn(() => ({
  abort: jest.fn(),
  addEventListener: jest.fn(),
  dispatchEvent: jest.fn(),
  error: jest.fn(),
  getResponseHeader: jest.fn(),
  load: jest.fn(),
  loadend: jest.fn(),
  loadstart: jest.fn(),
  onreadystatechange: jest.fn(),
  open: jest.fn(),
  progress: jest.fn(),
  readyState: jest.fn(),
  removeEventListener: jest.fn(),
  response: jest.fn(),
  responseText: jest.fn(),
  responseType: jest.fn(),
  responseURL: jest.fn(),
  responseXML: jest.fn(),
  send: jest.fn(),
  setRequestHeader: jest.fn(),
  status: jest.fn(),
  statusText: jest.fn(),
  timeout: jest.fn(),
  upload: jest.fn(),
  withCredentials: jest.fn(),
}))

and put this in my jest.setup.js


text:
Q: Is netbook RAM smaller than laptop? I want to upgrade my netbook's RAM and my question is about its size. Can I use the RAM from my laptop?

A: To my knowledge all netbooks on the market use the same physical size module as laptops. You need to check your documentation though to ensure you get the right type: DDR2 and DDR3 modules are not compatible and you need to make sure you don't buy a module that is larger than your machines chipset will take. Also make sure your netbook it actually easily upgradable: the Acer AA1s (at least the early models) are upgradable but you have to practically take apart the whole machine to get to the spare slot (see this video to see how much hassle the procedure is). Many netbooks are much easier to upgrade though: the space RAM slot is often exposed under a panel on the underside and you only have to remove one screw to get in.
Edit: You will find several variations in speed available. Some old chipsets where very fussy and would not work correctly with mismatched speeds, but I'm not aware of anything made in the last decade or more that is so picky (the machine I had that was irritating in this way was, all those years ago, a 386 based box that didn't like 60ns and 70ns SIMMS being mixed). Your machine will detect the capability of the memory modules and run them all at the speed of the slowest, so make sure you get something as fast or faster than you already have. If you want to make doubly sure, either try match your existing module exactly or check the official specs which may state that speeds from X to Y are supported (i.e. have been tested).

A: Laptop and netbook RAM are pretty much the same size . However you do have to remember there are still different types of laptop/netbook RAM: DDR, DDR2, DDR3 all with different a number of pins. If you have the same type of laptop/netbook RAM you should be just fine.

A: Yes. They are the same. Only the number of slots may differ (netbooks have less slots; usually 1).

A: You should go to the Crucial website and use their memory identification tool to see what type of memory your systems require and see if they are the same.


text:
Q: Direct3D11: Flipping ID3D11Texture2D I perform a capture of Direct3D back buffer. When I download the pixels the image frame is flipped along its vertical axis.Is it possible to "tell" D3D to flip the frame when copying resource,or when creating target ID3D11Texture2D ?
Here is how I do it:
The texture into which I copy the frame buffer is created like this:
    D3D11_TEXTURE2D_DESC description =
    {
        desc.BufferDesc.Width, desc.BufferDesc.Height, 1, 1,
        DXGI_FORMAT_R8G8B8A8_UNORM,
        { 1, 0 }, // DXGI_SAMPLE_DESC
        D3D11_USAGE_STAGING,//transder from GPU to CPU
        0, D3D11_CPU_ACCESS_READ, 0
    };
    D3D11_SUBRESOURCE_DATA data = { buffer, desc.BufferDesc.Width * PIXEL_SIZE, 0 };
     device->CreateTexture2D(&description, &data, &pNewTexture);

Then on each frame I do:
     pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast< void** >(&pSurface));
     pContext->CopyResource(pNewTexture, pSurface);
     D3D11_MAPPED_SUBRESOURCE resource;
     pContext->Map(pNewTexture, 0, D3D11_MAP_READ , 0, &resource);
     //reading from resource.pData
     //...

PS: I don't have a control of the rendering pipeline. I hook an external app with this code.
Also,I don't want to mess with the pixel buffer on the CPU, like reverse copy in a loop etc.. The low latency of the copy is high priority.
UPDATE:
I also tried this:
    D3D11_BOX box;
    box.left = 0;
    box.right = desc.BufferDesc.Width;
    box.top = desc.BufferDesc.Height;
    box.bottom = 0;
    box.front = 0;
    box.back = 1;
    pContext->CopySubresourceRegion(pNewTexture, 0, 0, 0, 0, pSurface, 0, &box);

Which causes the frame to be empty from its content.

A: Create a texture with D3D11_USAGE_DEAFULT, with CPUAccessFlags=0 and BindFlags=D3D11_BIND_SHADER_RESOURCE. CopyResource the swapchain's backbuffer to it. Create another texture with D3D11_BIND_RENDER_TARGET. Set it as a render target, set a pixel shader and draw a flipped quad using the first texture. Now you should be able to CopyResource the second texture to the staging texture that you use now. This should be faster than copying a flipped image data using the CPU. However, this solution would take more resources on the GPU and might be hard to setup in a hook.

A: All Direct3D mapped resources should be processed scanline-by-scanline, so just reverse the copy:
auto ptr = reinterpret_cast<const uint8_t>(resource.pData)
           + (desc.BufferDesc.Height - 1) * resource.RowPitch;

for(unsigned int y = 0; y < desc.BufferDesc.Height; ++y )
{
    // do something with the data in ptr
    // which is desc.BufferDesc.Width * BytesPerPixel(desc.Format) bytes
    // i.e. DXGI_FORMAT_R8G8B8A8_UNORM would be desc.BufferDesc.Width * 4
    ptr -= resource.RowPitch;
}

For lots of examples of working with Direct3D resources, see DirectXTex.


text:
Q: How to next page number in gridview every 1 minute with code behind I try to refresh page with timer every 1 minute and display data in gridview on next page until last record.
What should I do?
protect void Timer1_Tick(object sender, EventArgs e)
{
   if(GridView1.PageIndex==GridView.PageCount)
   {
      GridView1.PageIndex=1;
   }
   else
   {  int pageno = GridView1.PageIndex+1;
      GridView1.PageIndex=pageno;
   }
   GridView1.DataBind(); Timer1.Interval=600000;
}

A: PageIndex is zero-based index  and PageCount is calculated by dividing the total number of records in the data source by the number of records displayed in a page (as specified by the PageSize property) and rounding up.
so PageIndex will never equal to PageCount
if(GridView1.PageIndex == (GridView1.PageCount -1))
{
   GridView1.PageIndex = 0;
}
else
{
   GridView1.PageIndex = GridView1.PageIndex + 1;
}
GridView1.DataBind();

You can use Ajax Update panel and put your grid inside the panel. Then you can use above code inside theOnTick event of Timer which set as AsyncPostBackTrigger, check below SO question for example
Timer in UpdatePanel


text:
Q: How to save changes of a docker container when you are in the container When I run a docker container and have some changes I want to save, I only know one way:

*

*open another window and run docker ps

*copy the container id and run docker commit <container id> .../...:tag

*go back to the initial window and exit
OS: MacOS
How can I save the changes without opening another window? Or what is the most efficient or most used way to do it.


text:
Q: Structures themes projects part having some issue I have recently created a new theme for a project. After that, it is working good in my environment and I have checked in to this main branch. Then anyone who got the latest start to giving above error. Including myself when I checked out to a new location.
I have updated visualizer couple of time and current version is "Version 8 Service Pack 4 Fix Pack 59" I am not sure what was the early version was.


text:
Q: How to correctly handle data object from REST API using fetch in React I have a React app that receives an object from WordPress site using fetch() over rest api (v2/posts).
The object contains an "acf" entry which holds ~30 sub entries: some arrays and some are objects. All generated with Advanced Custom Field plugin.
The application is updating this data (using this.state) and the server (fetch/post) upon user request. All is working. I am not using express, redux and the like.
My current problem is that I cannot access the internals of the "acf" entry in render() function, while I can access it within the fetch response.
I would like to be able to acccess  cpt['acf']['entry']['subentry']
using the entry's names. But I get "cannot access property of undefined..."

Example:

        // In constructor:
        //     this.state = {
        //            isLoading: false, title:"", terms:[], cpt: []
        //     }
        ...
                fetch(url)
                .then(response => {
                    if (response.ok)
                        return response.json()
                    throw new Error('fetchTerm: Something went wrong ...')
                })
                .then(cpt => {
                    var terms = Object.entries(cpt['acf'])
                    var title = Object.values(cpt['title'])

                    this.setState({cpt, terms, title, isLoading: false})
    .then( () => {
                console.log("title",this.state.cpt['title'])
                console.log("FAMILYLOG",this.state.cpt['acf']['familylog_array']) // shows ok
            })

                    return (true) // void - no one is looking...
                })
        //...
        render(){
            if (this.state.isLoading)
                    return (Loading)
        // occurs only after fetch resturn and this.state variables are instanciated
            console.log("title", this.state.title) // shows OK
            console.log("FAIL", this.state.cpt['title']) // cannot access property of NULL/Undefined...
            console.log("FAMILYLOG",this.state.cpt['acf']['familylog_array']) // same problem
        }

What am I missing?
I would like to be able to acccess cpt['acf']['entry']['subentry']
Should I regenerate the cpt into arrays/objects in the Component state?

A: according to your code you initialize
cpt: [] (which should rather be an object though) in the constructor and then you make a call to the api and only when the promise is resolved you will modify the state, the thing is it happens after the first render call is done, so you get "cannot access property of NULL/Undefined" for cpt['acf']['entry']['subentry'], though this.state.cpt['title'] will rather return undefined in the render()
Upd: To prevent this, isLoading should have been set as true in the constructor


text:
Q: Add two Ids on unsubscribe link in marketing cloud I have a global footer in the marketing cloud and there I put a unsubscribe link in which I created a site.come page and passed AccoundID.
So my updated requirement is, I need to pass LeadID too there. I am using two data extension one for Account and other for Lead. So whenever leadID would be there, LeadID should be worked and in other case AccoundID should be worked. my unsubscribe link is as follows https://google.com?Id=%%AccountID%%LeadID&EmaiId=%%PersonEmail%%">Unsubscribe />
When I am passing both IDs and getting one of the only ID lets say I am getting only AccountID, it's giving me an error  LeadID was not found.
So is there any way in which I can use both IDs in the link and the Id I am getting whether it is of Account as well as Lead, It should work.
Thanks

A: Pass the ID as a general ID of the record that wants to unsubscribe, regardless which one this is, instead of two separate IDs, and then use the following to determine which object this is and which table should be updated:
%%[
SET @Id = [retrieve Id passed as parameter]
    IF NOT EMPTY(@Id) THEN
        / Check if it's a Lead or Account/
        IF Substring(@subscriber_key, 1,3) == "00Q" THEN
            / it's a Lead /
            SET @UpdateLead = [use an Update function to update your DE with Leads]
        ELSE
            / it's an Account /
            SET @UpdateAccount = [use an Update function to update your DE with Accounts]
        ENDIF
    ENDIF
]%%

EDIT:
Based on new details provided, this should work:
%%[
SET @AccountID = [retrieve Account ID]
SET @LeadID = [retrieve Lead ID]
SET @email = emailaddr
Set @link = "http://site.com"

IF NOT EMPTY(@AccountID) THEN
    SET @url = concat(@link,"?Id=",@AccountID,"&EmaiId=",@email)
ELSE
    SET @url = concat(@link,"?Id=",@LeadID,"&EmaiId=",@email)
ENDIF
]%%

Unsubscribe


text:
Q: How to download full article text from Pubmed? I am working on a project that requires to work with Genia corpus. According to the literature Genia Corpus is made from articles extracted by searching 3 Mesh terms : "transcription factor", "blood cell" and "human" on Medline/Pubmed. I want to extract full text article(which are freely available) for the articles in Genia corpus from Pubmed. I have tried many approaches but I am not able to find a way to download full text in text or XML or Pdf format.
Using Entrez utils provided by NCBI :

*

*I have tried using the approach mentioned here -
http://www.hpa-bioinformatics.org.uk/bioruby-api/classes/Bio/NCBI/REST/EFetch/Methods.html#M002197
which uses the Ruby gem Bio like this to get the information for a given PubMed ID -
Bio::NCBI::REST::EFetch.pubmed(15496913)
But, it doesn't return the full text for the PMID.

*Internally, it makes a call like this -
http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=1372388&retmode=text&rettype=medline
But, both the Ruby gem and the above call don't return the full text.

*On further Internet search, I found that the allowed values for PubMed for rettype and retmode don't have an option to get the full text, as mentioned in the table here -
http://www.ncbi.nlm.nih.gov/books/NBK25499/table/chapter4.T._valid_values_of__retmode_and/?report=objectonly

*All the examples and other scripts I have seen on the Internet are only about extracting abstracts. authors etc. and none of them discuss extracting the full text.

*Here is another link that I found that uses Python package Bio, but only accesses the information about authors -
https://www.biostars.org/p/172296/
How can I download full text of the article in text or XML or Pdf format using Entrez utils provided by NCBI? Or are there already available scripts or web crawlers that I can use?

A: You can use biopython to get articles which are on PubMedCentral and then get PDF from it. For all articles which are hosted somewhere else, it is difficult to get a generic solution to get the PDF.
It seems that PubMedCentral does not want you to download articles in bulk. Requests via urllib are blocked, but the same URL works from a browser.
from Bio import Entrez

Entrez.email = "Your.Name.Here@example.org"

#id is a string list with pubmed IDs
#two of have a public PMC article, one does not
handle = Entrez.efetch("pubmed", id="19304878,19088134", retmode="xml")

records = Entrez.parse(handle)
#checks for all records if they have a PMC identifier
#prints the URL for downloading the PDF
for record in records:
    if record.get('MedlineCitation'):
        if record['MedlineCitation'].get('OtherID'):
           for other_id in record['MedlineCitation']['OtherID']:
               if other_id.title().startswith('Pmc'):
                   print('http://www.ncbi.nlm.nih.gov/pmc/articles/%s/pdf/' % (other_id.title().upper()))

A: I'm working on the exact same problem using ruby. So far I was able to achieve moderate success by doing the following with ruby:

*

*use the Mechanize+esearch from eutils to get an XML of your pubmed search, and then use Mechanize/Nokogiri to parse the PMIDs from the XML

*use the Mechanize+ID converter to convert the PMIDs to PMCIDs (when available). If you really are only interested in the papers available on PMC, you can set up the esearch to return PMCIDs as well.

*once you have the PMCIDs, you can use Mechanize to access the webpage, click on the pdf click on the page, and use Mechanize to save the file.

It's by no means straightforward but still not that bad. There is a gem that claims to do the same (https://github.com/billgreenwald/Pubmed-Batch-Download). I plan to test that out soon.

A: If you want XML or JSON by PubMed ID or PMC, then you want to use the "BioC API" to access PubMed Central (PMC) Open Access articles.
(see https://www.ncbi.nlm.nih.gov/research/bionlp/APIs/BioC-PMC/ )
Here an code-example:
https://www.ncbi.nlm.nih.gov/research/bionlp/RESTful/pmcoa.cgi/BioC_xml/19088134/ascii


text:
Q: FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()) returns null I am using Spring, Hibernate and JSF.
In order to get a bean from application context I write:
public static Object findBean(String name) {
  return FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()).getBean(name);
 }

However, the FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()) returns null, so calling getBean() on it throws NullPointerException
Do I need to define anything anywhere?
EDITED
I need to get the bean from application context and not jsf bean

A: FacesContext.getCurrentInstance() returns null if your are not within a request that is handled by the FacesServlet. Make sure you are handling a request passed through that servlet.
Update: If the faces context is not null, the reason why the application context may be null is that there is no servlet context attribute named org.springframework.web.context.WebApplicationContext.ROOT. This means spring is not initialized properly. Make sure you have either the spring ContextLoaderListener mapped in web.xml, or the DispatcherServlet


text:
Q: ASP.NET MVC - Cleaning Up URLS in Complex Model Binding Scenarios In one of the applications I am building I have constructed a very flexible attribute-based system for describing products in my database wherein each product can have an indeterminate number of attributes assigned to it with each attribute having a single "type". So, for example, one attribute type might be "Category" and the value assigned to a single attribute would be something like "Trucks". There are no restrictions on the number of attributes assigned to a given product and because the attributes and attribute types are stored in the database alongside the products, my application does not know ahead of time what any of them will be.
One of the features of the options for a given attribute type is whether or not it is "searchable". In the event of an attribute being searchable I can then use its value paired with its type name to search/filter my products. So, for example, a user might want to return all products having the attribute type "Category" equal "Trucks" and attribute type "Color" equal "Red". Nothing too unique there.
The trouble I am dealing with is that because my system does not know ahead of time what my attribute type names are, I cannot easily create an action method accepting parameters in a readable format like string category or string color. As a solution I have made use of the DefaultModelBinder's support for binding to a dictionary. With this approach I need only format my field names in the correct structure, and then my action method can accept an IDictionary<string,string> parameters. This all works fairly well, but it makes for some really nasty URLs when the user is performing a link-based filter by a single parameter, i.e. "See more Products in Category Trucks". With the DefaultModelBinder binding to a dictionary requires that your field naming pattern resembles the following:
<input type="hidden" name="parameters[0].Key" value="Category" />
    <select name="parameters[0].Value">
    <option value="Trucks">Trucks</option>
    <option value="Compacts">Compacts</option>
    <option value="SUVs">SUVs</option>
</select>
<input type="hidden" name="parameters[1].Key" value="Manufacturer" />
<select name="parameters[1].Value">
    <option value="Ford">Ford</option>
    <option value="Toyota">Toyota</option>
    <option value="Honda">Honda</option>
</select>

Not only is this incredibly verbose, but it also somewhat frustrating due to the fact that each Key/Value must contain an ordinal index in the field name. Although this is acceptable for a POST form, it is not particularly ideal in a GET URL because we end up with URLS resembling ?parameters[0].Key=Category&parameters[0].Value=Trucks&parameters[1].Key=Manufacturer&parameters[1].Value=Ford. Not only is this ugly, it is very limited in its implementation because any modification to the URL could potential destroy the entire result set (if the user wanted to just search by the second parameter via modifying the URL they would have to remove the first parameter and renumber the whole collection appropriately).
What I am looking for is a better way to handle this kind of situation. Ideally I'd like to simply have a querystring value ?Category=Red and filter accordingly, but then my action method doesn't know if there actually is a "Category" parameter to bind to. Is there any in between that would allow me to have cleaner querystring parameters that wouldn't make for such awful URL structures?
I was thinking about possibly building my own custom ModelBinder, but I'd like to avoid that if there's another way.

A: I much prefer your "clean" URIs: ?Category=Red. So let's start there and see how it could work.
You can load up all the categories at runtime, right? Off the top of my head:
IEnumerable<string> allCategories = Categories.GetAll();
var usedCategories = Request.QueryString.AllKeys.Intersect(allCategories);
var search = from c in usedCategories
             select new
             {
                 Key = c,
                 Value = Request.QueryString[c]
             };

You could use this as-is, or make a custom model binder. In either case, it's not a lot of code.


text:
Q: Replace a character in a file and copy the contents to a temp file and rename the temp file to original file I want to replace a character in a file and copy the contents to a temp file and rename the temp file to original file.
path = "/mnt/sdcard/TESTfile/"
File _f = new File(path);
File[] _f1 = _f.listFiles();
String[] s1 = { "t1.txt", "t2.txt", "t3.txt" };
_fOut = new FileOutputStream(path + File.separator + s1[i]);

// Copy the bits from input stream to output stream
StringBuffer sb = null;
BufferedWriter out = null;
while ((line = reader.readLine()) != null) {
    line = line.replaceAll("a"," ").replaceAll("g"," ");
    sb = new StringBuffer();
    Log.i("Line>>>" + line, "<<<<<");
    sb.append(line);

    s = sb.toString();
    byte[] temp = s.getBytes();
    _fOut.write(temp);
}
fis.close();
_fOut.close();

//old file name with path
String path1 = path + File.separator + s1[i];

 //new file name with path
String rename1 = path + File.separator + _f1[i].getName();
File oldFile = new File(path1);
File renameFile = new File(rename1);

for(int j = 0; j < _f1.length;j++)
{

oldFile.renameTo(renameFile);
}

This is how i tried to do it. I am not sure how to rename the file and delete the original file. Please help

A: To rename a file, you need 2 File objects. Create one using the original path and the second using the new name. Then call original.renameTo(newFile).
Deleting a file is even easier. Android contexts have a method called deleteFile(name). Call it to delete a file. Keep in mind that that method deletes a file from the local storage folders only and doesn't accept path separators. If you want to delete a file from a different location, there is a file.delete() method you could use too.


text:
Q: Devise not working properly I am creating rails mobile application using jQuery for mobile... and I am using devise for authentication, and I have created new controller called user controller to create userprofile page... until I create usercontroller devise was working properly but after creating user controller, after logging in login link will become logout link, if I refresh the page it will give a link to login but once again if I refresh the page it will show link to logout.
here is my routes
Kdproject::Application.routes.draw do
root :to => 'home#index'
 devise_for :users, :path_prefix => 'd'
  namespace :user do
    root :to => "pages#viewprofile"
  end
  match '/index', :to => 'users#index'
  match '/viewprofile', :to =>'pages#viewprofile'

Please help me to come out of this...

A: Devise has already a registrations controllers for this. If You want to add your own functionality there, you can inherit from the Registrations devise one:
class RegistrationsController < Devise::RegistrationsController

  def update
    ... your code here
  end
end

and update your routes then:
devise_for :users, :controllers => { :registrations => "registrations" }

but if you just want to add more fields, it would be much easier to get devise views, and modify the one you need (views/devise/registrations/edit)
to get views:
rails generate devise:views

A: This is was happening because the compiled js and css in public folder.
problem solved by doing
rake assets:clean

A: Did you include javascript for jquery and jquery_ujs ? If not include it in layout. For example :-
<%= javascript_include_tag "jquery", "jquery_ujs" %>

You can check this question too.


text:
Q: Mediawiki : Gadgets tab not appearing in appearance I am trying to use the navigation popup in mediawiki but my mediawiki under appearance tab has no gadgets option and gadget definition is empty.
Special:version shows the following – (bac29ae) 06:39, 5 May 2018. It seems the gadget extension is installed but no gadget tab appears.

A: In addition to the Gadgets extension, you also need to define each gadget separately as described in the Gadgets extensions documentation.


text:
Q: Automatic INotifyPropertyChanged Implementation through T4 code generation? I'm currently working on setting up a new project of mine and was wondering how I could achieve that my ViewModel classes do have INotifyPropertyChanged support while not having to handcode all the properties myself.
I looked into AOP frameworks but I think they would just blow up my project with another dependency.
So I thought about generating the property implementations with T4.
The setup would be this: I have a ViewModel class that declares just its Properties background variables and then I use T4 to generate the Property Implementations from it.
For example this would be my ViewModel:
public partial class ViewModel
{
    private string p_SomeProperty;
}

Then T4 would go over the source file and look for member declarations named "p_" and generate a file like this:
public partial class ViewModel
{
    public string SomeProperty
    {
        get
        {
            return p_SomeProperty;
        }
        set
        {
            p_SomeProperty= value;
            NotifyPropertyChanged("SomeProperty");
        }
    }
}

This approach has some advantages but I'm not sure if it can really work. So I wanted to post my idea here on StackOverflow as a question to get some feedback on it and maybe some advice how it can be done better/easier/safer.

A: Here's a great post by Colin Eberhardt on generating Dependency Properties from a T4 by inspecting custom attributes directly from Visual Studio with EnvDTE. It shouldn't be difficult to adapt it to inspect fields and generate code appropriately since the post contains simple utility methods to browse code nodes.
Note that when using T4 from VS, you shouldn't use Reflection on your own assemblies or they'll get locked and you'll have to restart Visual Studio in order to rebuild.

A: There are a lot of ways to skin this cat.
We have been toying with PostSharp to inject the INotifyProperty boilerplate.  That seems to work pretty good.
That being said, there's no reason why T4 wouldn't work.
I agree with Dan that you should create the base class implementation of OnPropertyChanged.
Have you considered just using a code snippet?  It will write the boilerplate for you.  The only disadvantage is that it will not update automatically if you want to change the property name at some later date.
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>propin</Title>
      <Shortcut>propin</Shortcut>
      <Description>Code snippet for property and backing field with support for INotifyProperty</Description>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>type</ID>
          <ToolTip>Property type</ToolTip>
          <Default>int</Default>
        </Literal>
        <Literal>
          <ID>property</ID>
          <ToolTip>Property name</ToolTip>
          <Default>MyProperty</Default>
        </Literal>
      </Declarations>
      <Code Language="csharp">
        <![CDATA[private $type$ _$property$;

    public $type$ $property$
    {
        get { return _$property$;}
        set
    {
      if (value != _$property$)
      {
        _$property$ = value;
        OnPropertyChanged("$property$");
      }
    }
    }
    $end$]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

A: It should definitely work.
I'd recommend first writing a base class that implements INotifyPropertyChanged, giving it a protected void OnPropertyChanged(string propertyName) method, making it cache its PropertyChangeEventArgs objects (one per unique property name -- no point in creating a new object every time the event is raised), and have your T4-generated class derive from this base.
To get the members that need properties implemented, you can just do something like:
BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
FieldInfo[] fieldsNeedingProperties = inputType.GetFields(flags)
    .Where(f => f.Name.StartsWith("p_"))
    .ToArray();

And go from there:
<# foreach (var field in fieldsNeedingProperties) { #>
<# string propertyName = GetPropertyName(field.Name); #>
    public <#= field.FieldType.FullName #> <#= propertyName #> {
        get { return <#= field.Name #>; }
        set {
            <#= field.Name #> = value;
            OnPropertyChanged("<#= propertyName #>");
        }
    }
<# } #>

<#+
    private string GetPropertyName(string fieldName) {
        return fieldName.Substring(2, fieldName.Length - 2);
    }
#>

And so on.


text:
Q: Does Nexus 3 support container image signing? Does Nexus 3 private docker registry support container image signing?  The RHEL documentation here suggests not, but I'd like confirmation.

A: In the sense that Nexus supports the v2 Registry API, it should be able to handle signed images. I don't believe Nexus supplies a Notary service though which is where most of the signing operations occur and image/key information is stored. The Nexus docco mentions nothing about signing.
You can delegate trust for your Nexus repo to a local Notary service (github) as you would for any private repo. Nexus repo's have a habit of tripping over edge cases though.


text:
Q: Express req.body is undefined in postman but in morgan fine im currently developing api for user auth to consume by vue. and i already read some discussions about this topic but still confused what is the problem.
i already use express.json() and express.urlencoded and sort the order. testing it in postman and using morgan.
the result is request body returned back from postman is undefined (see in screen shot below) but morgan prints the request body successfully
enter image description here
javascript
const express = require("express");
const cookieParser = require('cookie-parser')
const session = require('express-session');
const morgan = require("morgan");
const router = express.Router()
const app = express();

const PORT = 3000;

// app.use(session({
//     key: "user_id",
//     secret: "secret",
//     resave: false,
//     saveUninitialized: false,
//     cookie: {
//         expires: 600000,
//     },
// }))
router.use(express.json())
router.use(express.urlencoded({ extended: true }))

router.get('/hello', (req, res) => {
    res.status(200).send('hello world')
})

// handle register request
router.post('/register', (req, res) => {
    console.log(req.body.username, req.body.password)
    res.status(200).json({
        username: req.body.username,
        password: req.body.password
    })
})

//handle login request and check login state
router.post('/login', (req, res) => {

})

// handle logout
router.post('/logout', (req, res) => {

})

app.use(morgan('dev'))
app.use('/api', router)
app.listen(PORT, () => {
    console.log(`Server is running on port ${PORT}.`);
});

console output:

[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
Server is running on port 3000.
undefined undefined
POST /api/register?username=james&password=verystrongpassword 200 20.380 ms - 2

thanks for help

A: Repace body with params
Use req.params.username insted of req.body.username and same for password too
username: req.params.username,
password: req.params.password


text:
Q: Find span tag in table in c#

                08:00

                00

  for(int i = 0; i < mytable.Rows.Count - 1; i++)
                {
                    for(int j = 0; j < mytable.Rows[i].Cells.Count; j++)
                    {

    }
}

if(mytable.Rows[i].Cells[j].Attributes["class"] != null && mytable.Rows[i].Cells[j].Attributes["class"].Equals("csstdgreen"))
                {
                    //For finding class of td.I use above code
                }

I have to find span tag in table and have to add text in span tag.
which is in td of table.
i dont want to apply runat="server" because there are 50 span in my tabel.
i am looping through table like this.I have search google lot but didnt find anything in c#.
i have to put value in span tag from database
Note : No Javascript or Jquery !

A: When using jQuery, give all you span's a className and the TD an ID

    Blabla

In jQuery u can do the following:
var allSpans = $('#idOfTd .className');

A: you've got to use a asp:Label or put runat="server" on your  or generate your span from code-behind
 //Just an hint, can't remember the proper way to do this but you can

 myTable.Rows[i].Cells[last].InnerHtml = "value";

that gives you another option/idea

A: If you want to add text in span in code behind then as I know its too tuff without using runat="server". but if you want to add text in javascript then it can be done....by searching span using getElementusingTagName('span') inside td and add text to it.
For doing this in javascript you don't have need to give id to span as well as no need to write runat ="server".
below javascript code is written -

A: Give the TD or span an ID and add the data in it by code behind

A: If you don't want to use the server control, maybe javascript is a better idea to do this job.

A: Firstly give each span an unique id, say like the one given below...

and then using javascript you can find this span and add the required text, some thing like
 document.getElementById('test').innerHTML = 'your required message can go here';

here is a small fiddle link to it = http://fiddle.jshell.net/fFHbf/

A: If you can set an id to each tag, you could do something like this:
HTML:

Then, with java script:
document.getElementById('spanTagId').innerHTML = 'Your text...';

A: If you want to add text in span in code behind then as I know its too tuff without using runat="server". but if you want to add text in javascript then it can be done....by searching span using getElementusingTagName('span') inside td and add text to it. For doing this in javascript you don't have need to give id to span as well as no need to write runat ="server". below javascript code is written -


text:
Q: Create UBL 2.1 XML from Oracle SQL or PL/SQL How to create UBL 2.1 XML from Oracle SQL or PL/SQL that pass the requirements from ZATCA.
SQL XML - Create a XML file from SQL Server for an invoice including invoice positions in one XML file
I'm trying this sample but this is sqlserver.


text:
Q: Hide the iOS status bar on Flutter Is there any way to hide the status bar in an iOS application?
I tried with this soluton to do it in Android, but it doesn't work on iOS.
In addition, I also tried hiding it by using the native iOS way to do it, but the FlutterViewController is being regenerated in every build, so I can't apply the solution described in this other answer.

A: The solution is to call SystemChrome.setEnabledSystemUIOverlays([]);.


text:
Q: Connected Unbounded Subset of a Normed Vector Space Let $(X, ||.||)$ be a normed vector space and let $V \subset X$ be a connected unbounded set for which $0 \in V$. Show that $\forall \epsilon > 0$, then $\exists x \in X$ such that $||x||=\epsilon$.

I'm not sure on how to get started. If $V$ is unbounded, then for any $\epsilon > 0$, then there exists a $v \in V$ such that $||v|| > \epsilon$. However, I'm not sure on how to use the connectedness of $V$ to get the result. How would one be able to proceed?
Thanks for the help!


text:
Q: How to debug python in VS Code with virtualenv? Again I'm trying to debug a very simple script in a venv, and the Python debugger just refuses to start working.
The Python extension version is 2019.10.41019 on Windows 10 x64.
The python version is 3.7.1 32-bit.
Debugging without virtual environments works fine. Then I created a venv in C:\TMP\PYENV and added a configuration in launch.json:
{
    "name": "Python: PYENV",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal",
    "pythonPath": "C:\\TMP\\PYENV\\Scripts\\python.exe",
},

and start debugging it. Output in terminal:
c:\TMP\PYENV>C:/TMP/PYENV/Scripts/activate.bat
(PYENV) c:\TMP\PYENV>C:\TMP\PYENV\Scripts\python.exe c:\Users\user\.vscode\extensions\ms-python.python-2019.10.41019\pythonFiles\ptvsd_launcher.py --default --client --host localhost --port 53150 c:\TMP\PYENV\myscript.py

The script starts, all local imports in the venv are found - but all my breakpoints are ignored. The script runs through (and crashes somewhere).
What is missing??
I've searched related questions and most advice to define a config with "python.pythonPath". But this is not valid anymore in the current version. It should be "pythonPath" as in my example above, or the VS Code (or python extension?)  complains about invalid name.

A: It's because you put your source code within the virtual environment which makes the debugger think it isn't your code but third-party code. Simply move the code out and it will be fine. Alternatively you can set "justMyCode": true in your debugger config and it will then trace through all code and not just what the debugger considers your own code.


text:
Q: Write with js-xlsx gives "_fs is undefined" error I'm trying to use https://github.com/SheetJS/js-xlsx to export some array data to a file.
I took an example and put up a jsfiddle here: https://jsfiddle.net/connyake/y8a9nb7r/
Is it even possible to do this without requirejs? If it is, how?
HTML:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2014-11-29/FileSaver.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/xlsx.core.min.js"></script>
<button onclick="arrayToXlsx()">Export</button>

JS:
function arrayToXlsx() {
    /* original data */
    var data = [[1,2,3],[true, false, null, "sheetjs"],["foo","bar","0.3"], ["baz", null, "qux"]];
    var ws_name = "SheetJS";

    /* set up workbook objects -- some of these will not be required in the future */
    var wb = {};
    wb.Sheets = {};
    wb.Props = {};
    wb.SSF = {};
    wb.SheetNames = [];

    /* create worksheet: */
    var ws = {};

    /* the range object is used to keep track of the range of the sheet */
    var range = {s: {c:0, r:0}, e: {c:0, r:0 }};

    /* Iterate through each element in the structure */
    for(var R = 0; R !== data.length; ++R) {
      if(range.e.r < R) range.e.r = R;
      for(var C = 0; C !== data[R].length; ++C) {
        if(range.e.c < C) range.e.c = C;

        /* create cell object: .v is the actual data */
        var cell = { v: data[R][C] };
        if(cell.v === null) continue;

        /* create the correct cell reference */
        var cell_ref = XLSX.utils.encode_cell({c:C,r:R});

        /* determine the cell type */
        if(typeof cell.v === 'number') cell.t = 'n';
        else if(typeof cell.v === 'boolean') cell.t = 'b';
        else cell.t = 's';

        /* add to structure */
        ws[cell_ref] = cell;
      }
    }
    ws['!ref'] = XLSX.utils.encode_range(range);

    /* add worksheet to workbook */
    wb.SheetNames.push(ws_name);
    wb.Sheets[ws_name] = ws;

    /* write file */
    XLSX.writeFile(wb, 'test.xlsx');
};

A: The xlsx library has two functions for writing to files write and writeFile. The writeFile equation implements the node fs module and is therefor intended to be used within the node environment. Alternatively write is implemented using client side javascript and might therefor be of greater use in your circumstance. i.e:

write(wb, {bookType: 'xlsx' , bookSST: false, type: 'binary'});


text:
Q: add a new column to the file based on another file I  have two files file1 and file2 as shown below. file1 has two columns and file2 has one column. I want to add second column to the file2 based on file1. How can I do this with awk?
file1
2WPN  B
2WUS  A
2X83  A
2XFG  A
2XQR  C

file2
2WPN_1
2WPN_2
2WPN_3
2WUS
2X83
2XFG_1
2XFG_2
2XQR

Desired Output
2WPN_1  B
2WPN_2  B
2WPN_3  B
2WUS    A
2X83    A
2XFG_1  A
2XFG_2  A
2XQR    C

your help would be appreciated.

A: awk -v OFS='\t' 'FNR == NR { a[$1] = $2; next } { t = $1; sub(/_.*$/, "", t); print $1, a[t] }' file1 file2

Or
awk 'FNR == NR { a[$1] = $2; next } { t = $1; sub(/_.*$/, "", t); printf "%s\t%s\n", $1, a[t] }' file1 file2

Output:
2WPN_1  B
2WPN_2  B
2WPN_3  B
2WUS    A
2X83    A
2XFG_1  A
2XFG_2  A
2XQR    C

You may pass output to column -t to keep it uniform with spaces and not tabs.


text:
Q: appending a fixed a number of div elements to a main div and the next set to another based on realtime results I am creating a facet based search for my webpage and Im using jquery for the front end part. Each search will return different set of facets. The content varies based on search terms. The number of contents is also nt a steady one. So my facet will look like this one for example.
a set of individual terms wrapped inside a div element. So I the number of divs as u cn see is 7 for this one and I want to display the divs in such a way that only 4 divs are displayed in a single page and the next three in another. So Ive used jquery plugin named bxslider. Bt hw am I gonna break the set of 7 divs in to two pages?? The code that Ive used is
    noOfCol=Math.ceil(count4/8);
    noOfSlides=Math.ceil(noOfCol/4);
    //alert("Total number of slides " +noOfSlides);
    count4=0;
    var num=0;
    var num1=8;

    for(var count5=0;count5<noOfCol;++count5){
        var $newDiv = $('

') ;
        var $newDiv1 =$('

') ;
        $("#test1").append($newDiv);

        for(count4=num; count4<num1; ++count4) {
            if(prsnArray[count4]==undefined) {
            } else {
                $newDiv.append('<input type="checkbox">    ' +prsnArray[count4].term + "  (" + prsnArray[count4].count + ")" +'
');
            }
        }
        num=num+8
        num1=num1+8
    }

}

A: http://jsfiddle.net/bMmLE/. Check out how the if-else statement is used in the for loop.
If the iteration "i" is over 4, then content is put in a different div.
I think this accomplishes what you're looking for if I understand your question correctly. Hope it points you in a good direction.

A: Im a little confused as to what you want, but i created an example here: http://jsfiddle.net/bMmLE/2/
It makes the div's for the slider automatic, from an set amount of max numbers, and adds it up.
count = 15; //random count
countPrDiv = 6; ///number of elements pr div
$parent = $('#sliderDiv'); //parent to add the divs too

for(var i = 0; count > i++;){
    if(i === 1) {
        $('

').appendTo($parent).addClass('max'+countPrDiv);
    } else if (i === countPrDiv) {
        countPrDiv = countPrDiv  + countPrDiv ;
        $('

').appendTo($parent).addClass('max'+countPrDiv);
    }

    $('.max'+countPrDiv).append('
'+i+'
');
}

$('#sliderDiv').bxSlider();


text:
Q: Does Oracle manage timezone correctly for all regions? I have the following query. It returns the current time in different regions. It works fine for most of the regions which are in the table V@timezone_names. But this query returns the wrong result for:

*

*'Asia/Tehran' with +4:30 time zone differences

*'America/Caracas' with -4:30 time zone differences

My query is:
select CAST(FROM_TZ( CAST(current_date AS TIMESTAMP)
                   , sessiontimezone)
             AT TIME ZONE 'America/Caracas' AS DATE)
  from dual;

You can see the current time in different countries-cities here.

A: Oracle issues timezone file patches from time to time to correct bugs and for changes introduced by countries and territories changing the rules for their timezones. Oracle support note 412160.1 shows how you can check which timezone file you have, and how to update. (The check is simple in 10g - SELECT version FROM v$timezone_file).
Under 11g with timezone file version 14, I get -4:30 for Caracas and +4:30 for Tehran, displaying times matching the site you linked to.
Looks like Caracas changed its timezone in late 2007, so I guess you're showing -4:00; and Tehran had DST changes in 2008 (or reintroduced DST, not sure), so I guess you're showing +3:30. It seems reasonable to assume that your current timezone predates those changes; by default 10g will be on v3 or v4.
I'd suggest you update to the latest timezone file (version 18); you'll need to look at that support note to see how to do it for your circumstances, or more specifically note 1448706.1, 'Applying the DSTv18 update for the Oracle Database'. You can get it as patch 13417321. If you still find a problem when using the latest patch then you can raise a service request with Oracle to get it fixed.


text:
Q: How I can add objectclass to an entry in ldap with ldif? I have this schema:
attributetype ( 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1
        NAME 'email2'
        DESC 'email2'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )

objectclass ( 2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2  NAME 'myMember'
    DESC 'mymenber'
    SUP top STRUCTURAL
    MAY ( email2 ) )

And I have this object:
dn: o=myGroup,c=es
o: myGroup
objectClass: top
objectClass: organization

I want to add the objectclass myMember to dn: o=myGroup,c=es. I have created ths ldif:
dn: o=myGroup,c=es
changetype: modify
add: objectclasses
objectclasses: myMember

But when I execute this, get an error:
>> ldapmodify -x -f modify.ldif -D 'cn=root,c=es' -W
Enter LDAP Password:
modifying entry "o=myGroup,c=es"
ldapmodify: Invalid syntax (21)
    additional info: objectclasses: value #0 normalization failed

What am I doing wrong?

A: Change 'objectclasses' to 'objectclass' throughout.

A: @EJP is right on the pure syntax point of view. But on the theorical point of view mymenber should be an AUXILIARY (Not STRUCTURAL) class to be added to object of others class.
objectclass ( 2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2.2  NAME 'myMember'
    DESC 'mymenber'
    SUP top AUXILIARY
    MAY ( email2 ) )


text:
Q: Listing of custom extension in TYPO3 I have a backend module on my website. In this backend module, I need to list all the custom plugins that I am used in the website. I have no idea to list all the custom plugins.

A: Your question is lacking important data, like what TYPO3 Version you are using.
In addition it is unclear if you mean plugins or extension. My guess is that you mean extensions.
In the case you need all extensions that are not "TYPO3 System Extensions" you can do something like this in your Controller I guess:
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$listUtility = $objectManager->get(ListUtility::class);
$allExtensions = $listUtility->getAvailableExtensions();
$customExtensions = [];
foreach ($allExtensions as $key => $f) {
    if (is_dir(Environment::getPublicPath() . '/typo3/sysext/' . $key . '/')) {
        continue;
    }
    $customExtensions[$key] = $f;
    $customExtensions[$key]['isLoaded'] = (int)ExtensionManagementUtility::isLoaded($key);
}
$this->view->assign('extensions', $customExtensions);

If you want to exclude other extensions too you have to adopt the logic, like checking for the $key to and continue in that case.
Note: The answer needs a basic understanding how TYPO3 Development with Extbase work.

A: To list all plugins of your extension (inserted via TYPO3 backen) you can use a simple SQL Query
select from tt_content where CType="list" and list_type="your_plugin "
But you should not use raw queries but rather use the QueryBuilder as it provides additional security and enhances your query with restrictions like deleted.


text:
Q: Can't pickle : it's not the same object as builtins.MemoryError - Python I'm trying to run the code from this link
https://github.com/sdorkenw/CompressedSensing/blob/master/sensing.py
It gives me this error:
Traceback (most recent call last):
  File "/home/kali/Desktop/CompressedSensing/sensing.py", line 319, in <module>
    sense_multiple(img_path, ks, alphas, folder=folder,
  File "/home/kali/Desktop/CompressedSensing/sensing.py", line 295, in sense_multiple
    pool.map(_sense_thread, params)
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
multiprocessing.pool.MaybeEncodingError: Error sending result: '<multiprocessing.pool.ExceptionWithTraceback object at 0x7f28d105bb20>'. Reason: 'PicklingError("Can't pickle <class 'MemoryError'>: it's not the same object as builtins.MemoryError")'

As far as i know this is related to pool, so how can i fix this?


text:
Q: Is there a way to create key based on counts in Spark Note: This question is related to Spark, and not just plain Scala or Python
As it is difficult to explain this, I would show what I want. Lets us say, I have an RDD A with the following value
A = ["word1", "word2", "word3"]

I want to have an RDD with the following value
B = [(1, "word1"), (2, "word2"), (3, "word3")]

That is, it gives a unique number to each entry as a key value. Can we do such thing with Python or Scala?

A: How about using zipWithIndex?

Zips this RDD with its element indices. The ordering is first based on the partition index and then the ordering of items within each partition. So the first item in the first partition gets index 0, and the last item in the last partition receives the largest index. This is similar to Scala's zipWithIndex but it uses Long instead of Int as the index type. This method needs to trigger a spark job when this RDD contains more than one partitions.

Otherwise, zipWithUniqueId seems a good fit as well.
If the order of the index is important, you can always map a swap function on the RDD.

A: Yes, one way is as below:
>>> A = ["word1", "word2", "word3"]
>>> B=[(idx+1,val) for idx,val in enumerate(A)]
>>> B
[(1, 'word1'), (2, 'word2'), (3, 'word3')]


text:
Q: how to make a project that supports plugins I have been asked to do a project where the client can create PHP plugins and add them to the website… same concept as WordPress plugins.
What is the best way to make a software that supports that? I'm not asking for the solution, I'm asking for the concept or structure.

A: First of all, you have to determine how do you want your plugins integrated. If you want something like Wordpress plugins, which are just plain functions most of the times, then it's extremely easy. It's like adding new code to your application.
Well, basically, your application should be able to build a list of plugins available, and to determine which ones are enabled. The list can be built by browsing the files, a config file, or whatever. Enabled plugins can be stored in the database for example.
Then, you just do an interface where the user can enable each available plugin. When enabling it, the web application would write information about it in the plugins database, specifying that it's enabled. Then, the application calls a specific method of the plugin class (really, OOP is mandatory in correct plugin development), like Install(). To avoid exceptions when plugins have no such method, all plugin classes should inherit a base class written in the main web application, which does contain a definition for that method. That method has the sole purpose to perform the initialization of the plugin (create tables to the database, populate statistics, etc).
Also, at each request, your web application should include all the files of the plugins that are specified as enabled. Then use them however you want. Call their methods from templates for example. If you want to write plugins that are transparent to the template developer, then you could do just like in wordpress. There, the plugin at initialization (for example when it's file is included) writes specific data into arrays of actions. It can write what function should be called, with what parameters, and when to be called.
You can even make something like event triggers in your main web application, to enable customization. Before drawing something, call a function called something like do_action("before_output_of_something"), and after output is ended, call the function do_action("after_output_of_something"). The string parameter would be a key in an array of triggers, that points to an array of actions (event handlers). To add event handlers call a function like this add_action("before_output_of_something", $object, "method_name", array("parameters")). do_action method passes the array of actions, and uses call_user_func() PHP function to call event handlers.
There is much more to this topic. All depends on what exactly you want to make.
What I wrote here is just a lousy attempt to express some of the possibilities. What you should do is find a good book, maybe about just this topic.

A: I would solve this by using the event-dispatcher pattern. You define certain points (events) in your main application. Plugins can register for this events and will be executed, when the related event is triggered.

A: There are multiple options. Most common is the hooks concept with simple plugin functions, where you just have to include() a plugin from a central configuration script. Each plugin has to register itself, so usually there is a plugin registration method. But it can also just look like this:
$app_plugin["add_title"][] = "do_whatever";
function do_whatever($request, &$page) {...}

And in your main application you just define a couple of plugin calls, wherever you see the need for it. You would use a wrapper function to invoke all plugins, but basically you look for the hook name and invoke all registered plugins:
foreach ($app_plugin["add_title"] as $func) {
    $output .= $func($_REQUEST, $page);

Each named hook can have a different set of parameters. Typically you would want to get additional content, but sometimes plugins just modify existing variables, or influence the application flow.
The more hooks you have, the more diverse extensions are possible. And it's not necessary to use functions only. Of course this scheme also works with objects (they just need to be instantiated first.)


text:
Q: Equivalent Divisor and Evaluation I've been reading the "Pairing for Beginners" tutorial from Craig Costello and have been asking myself about the example given in section 3.3 (Weil Reciprocity page 44, example 3.3.2). It states that if $supp(D)~\cap~supp((f)) \neq \emptyset$, then one could find an equivalent divisor $D'$ such that one is allowed to evaluate $f(D')$ (i.e. both divisors have disjoint supports).
In this example, if $D = (P)+(R)+(T) - 3(\mathcal{O})$ ($P, S, T$ are on the same line), then $D \sim D'$ where $D' = (P+U)+(S+U)+(T+U)-3(U)$ ($U$ is a random point over $E(\mathcal{F}_q)$ that does not belong to $supp(f)$). Hence, one can compute $f(D')$ thanks to this equivalent $D'$.
Let $e$ be the Weil Pairing function. I know that if $D  \sim D'$ then $e(D, P) = e(D', P)$ (this can be easily proved thanks to Weil Reciprocity theorem). However, I'm not sure to understand the meaning given to this $f(D')$ evaluation.
What is the relationship between  $f(D)$, $f(D')$ and $f(D'+(g))$ where $g$ is a rational function (note that $D$, $D'$ and $D'+(g)$ belong to the same class) ? Does it actually make sense to evaluate these quantities if they are not used for pairing ?


text:
Q: Django querysets - Performing subqueries How to make query to get all components added by a certain user? Also in the resulting object I want to have the system name and project name too. I saw examples demonstrating sub-queries for two tables, but I need this for 3 tables.
Thank you.
class component(models.Model):
    id = models.AutoField(primary_key=True)
    server = models.ForeignKey(server, on_delete="CASCADE")
    name = models.TextField(blank=True)
    comments = models.TextField()
    timestamp = models.DateTimeField(auto_now=True)

class system(models.Model):
    id = models.AutoField(primary_key=True)
    project = models.ForeignKey(project, on_delete="CASCADE")
    name = models.CharField(max_length=255,blank=True)
    comments = models.TextField()
    timestamp = models.DateTimeField(auto_now=True)

class project(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,blank=True)
    comments = models.TextField()
    user = models.ForeignKey(User, on_delete="CASCADE")
    timestamp = models.DateTimeField(auto_now=True)

A: No need to use subqueries here, we can simply perform joins, by looking "through" foreign keys (this is typically denoted with two consecutive underscores __ in Django).
If you want So all the Components that belong to a System that belongs to a Project that belongs to a user, we can query this with:
from django.db.models import F

Component.objects.filter(
    system__project__user=someuser
).annotate(
    system_name=F('system__name'),
    project_name=F('system__project__name')
)
with someuser the user you want to filter with.
The components in this queryset will have extra attributes system_name and project_name that contain the name of the system and the project respectively.


text:
Q: What is the bigquery sql inner join equivalent for rows? I have the following 2 tables:

I would like to create a table where

*

*all rows of table 1 are included

*if the timestamp of any row of table 2 falls in between the timestamp and endTime of any row of table 1, then include the row.

The resultant table would like:

There are columns/fields that are common to both tables, but I haven't included them for brevity. Basically, I am looking for the equivalent of an inner join operation but then instead of adding the rows of table 2 as columns, add them as rows. I have written a sample code whilst experimenting with inner join as below:
WITH table_a AS (
  SELECT 'x' AS event, 1 AS timestamp, 5 AS endtime, 'a' AS field1
  UNION ALL SELECT 'x', 100, 200, 'b'
),
table_b AS (
  SELECT 'y' AS event, 2 AS timestamp, 'm' AS field2
  UNION ALL SELECT 'y', 25, 'n'
  UNION ALL SELECT 'y', 150, 'o'
)

SELECT
  table_a.*,
  table_b.*
FROM table_a JOIN table_b

Any thoughts what bigquery sql functions I can use?

A: Use below
select *, null field2 from table_a  union all
select distinct b.event, b.timestamp, null, cast(null as string), field2
from table_b b
join table_a a
on b.timestamp between a.timestamp and a.endtime

if applied to sample data in your question - output is


text:
Q: Count the same word in different columns in a Pandas data frame I have a data frame that contains different demographic data of the head of the household and the family members. I would like to count the total number of females and males in the whole data frame. The value_counts() only pull the count from one column, how do I count all the columns. Can df['Column_Name'].value_counts() take multiple columns containing the same values?
The columns are:
Applicant Name, Applicant Gender, Household Member 2 Name, Household Member 2 Gender, Household Member 3 Name, Household Member 3 Gender.
The values in the columns of Applicant Gender, Household Member 2 Gender, and Household Member 3 Gender are either Female or Male

A: If I get the idea right, this should work.
males = df[(df['Applicant Gender'] == 'Male') & (df['Household Member 2 Gender'] == 'Male') & (df['Household Member 3 Gender'] == 'Male')].count().sum()

females = df[(df['Applicant Gender'] == 'Female') & (df['Household Member 2 Gender'] == 'Female') & (df['Household Member 3 Gender'] == 'Female')].count().sum()


text:
Q: Modify Gmail (IMAP/SMTP) settings in Outlook I have Outlook configured to access a gmail account.  Recently, it stopped syncing with a server error.  Unfortunately, I see NO WAY to modify (or even view) the SMTP settings.  If you go to account settings and click "Change" on the gmail account, you are presented with this dialog:

Clicking next just says "Account successfully updated!".  Clicking "Reset settings" does what you would expect (nothing, if you have defaults).
What am I missing? How do I view and change the IMAP and SMTP settings?  Server, port, password, etc...

A: There is a separate entry for "Server settings" in the accounts dropdown.

This provides what I want. Not sure how I missed it.

A: Option 1: Repair Account

*

*Go to File > Account Settings > Account Settings.

*Select your account and choose Repair.

*Expand the Advanced options and select "Let me repair my account manually".

*Click Repair.
Options 2: Mail in Control Panel

*

*Open Control Panel > Mail > Show Profiles.

*Select the profile which you want to change.

*Choose Properties > Email Accounts.

*Double Click POP/IMAP account. You will see the previous 'Change Account' dialog.
Options 3: Send/Receive Settings

*

*Click Send/Receive tab > Send/Receive groups > Define Send/Receive groups.

*Click Edit.

*Select the account you want to change and click "Account Properties.."
Check this thread: Can't Access My Email Account Settings


text:
Q: Sorting multidimensional array for scores using temporary variables Hi guys having some trouble sorting a multidimensional array containing the scores for different users in the leaderboard form of a game I am making. I have tried to sort the scores for each user in descending order using temporary variables and then output this with no success. Any help would be much appreciated thanks. I should add that I have only recently started coding and have to do this project as part of my work for school so I am aware that it may not be very efficient and seem very novice.
Here is my method for sorting
( [i, 2] is the score value stored as a string )
private void sortScore(string[,] sort)
{
    bool didSwap;
    do
    {
        didSwap = false;
        for (int i = 0; i < userNumber; i++)
        {
            if (i < (userNumber-1))
            {
                if (Convert.ToInt32(sort[i, 2]) > Convert.ToInt32(sort[i + 1, 2]))
                {
                    string temp = sort[i + 1, 2];
                    sort[i + 1, 2] = sort[i, 2];
                    sort[i, 2] = temp;
                }
            }
        }
    } while (didSwap);
    for (int j = 0; j < userNumber; j++)
    {
        rtbScoreboard.AppendText("Name: " + sort[j, 0] + "\t" + "Score: " + sort[j, 2] + Environment.NewLine);
    }
}

A: You can use LINQ!
var sortedScores = Enumerable.Range(0, sort.GetLength(0)) //number of items
.Select(x => new
{
    Name = sort[x, 0],
    Score = Convert.ToInt32(sort[x, 2])
}) //converting to a meaningful structure
.OrderByDescending(x => x.Score) //sort in descending order by score
.ToList();

//building output, I don't know what is userNumber, It is a global variable
// that might store number of players to show in score board.
for (int j = 0; j < userNumber; j++)
{
    rtbScoreboard.AppendText("Name: " + sortedScores[j].Name + "\t" + "Score: " + sortedScores[j].Score + Environment.NewLine);
}

You should not store data like that. Using a multidimensional array to store names and score is not a good idea. Try defining a class like Player which has Properties for storing data like Name and Score. Then store instances of Players in a list.

A: You fail to set didSwap to true
bool didSwap;
do
{
    didSwap = false;
    for (int i = 0; i < userNumber-1; i++)
    {
        if (Convert.ToInt32(sort[i, 2]) > Convert.ToInt32(sort[i + 1, 2]))
        {
            string temp = sort[i + 1, 2];
            sort[i + 1, 2] = sort[i, 2];
            sort[i, 2] = temp;
            didSwap = true;
        }
    }
}   while (didSwap);


text:
Q: Consulta MySQL desde una version 12.4.1 Buen dia, trataré de explicar mi problema  lo mejor posible:
Esta consulta:
SELECT * FROM cargarol
WHERE (IdOficina = 1100) OR (IdOficina <> 1100 AND IdOficina = 101)

Me trae los registros de ambas oficinas. Lo que quiero es que si selecciono 1100, me traiga todos los registros que tenga la tabla. Por otro lado, si selecciono 101 solo me traiga los registros del mismo. ¿Cómo puedo hacer esto?. He probado con case, consultas anidadas y no me da el resultado esperado.
Por otro lado,  si hago las consultas por separado, es decir, un simple select * from cargarol, me muestra todos los registros y si hago un select * from cargarol where idofcina=101 me da solo sus registros, sin embargo, el problema es que si quiero hacer lo que antes escribí no puedo, es decir, tenerlo en un solo select.
Espero me puedan ayudar. Muchas gracias anticipadas.


text:
Q: OpenGraph API User Object Sometimes Returns Link that 404s In my application I allow users to connect their Facebook accounts via oauth for the purpose of posting via our interface. We support both page accounts and regular accounts that simply manage pages.
We also inspect the result of the opengraph API call to get a valid URL to their profile, or page. The primary endpoint we use is https://graph.facebook.com/me (with oauth credentials). For some page-only accounts, the returned object has a 'link' value that, when entered into a web browser, 404s.
The bad URLs I have seen fall into two distinct cases:
The URL can be of the form 'www.facebook.com/{page_id}' which 404s on some pages, but not others.
The URL can be of the form 'www.facebook.com/profile.php?id={user_id}' which more often than not 404s.
The only URL format I have seen that works for all accounts is www.facebook.com/profile.php?id={page_id}. In the first case, we detect that the 'link' field isn't of the proper form (using profile.php?id=...), and construct a URL with the proper structure, and it works.
My next heuristic I'm considering adding is to see if the URL is of the proper form....but uses the {user_id} as the id argument to profile.php, and just construct the URL using the {page_id}. Obviously, this is getting ridiculous.
So, is there a good way to know if an account will give back a link that is invalid? Is this a bug in the API? What is the most reliable way to, given a User on the open graph API, to get a working link to their profile/page?

A: Using 'www.facebook.com/{page_id}' or 'www.facebook.com/profile.php?id={user_id}' will always work - they are both the same. The only reason you'll see a 404 is if the Page has been unpublished / deleted or if the user has deactivated their account.


text:
Q: Creating .NET runtime envoriment So I am trying to set up .NEt runtime envoriment on my machine, can someone tell me what are all the neccessary software that I need? I know I need to install Ms Visual Studio, what else do I need to set up the run time envoriment?

A: Just to make sure we're talking about the same thing, a runtime is the software necessary to run something written under a particular development framework or system. For example, a user needs the Java runtime installed in order to run software written in Java. Likewise, you need the .NET runtime installed in order to run software written using one of the .NET languages (C#, VB.NET, etc.).
If that's what you need, you do not need Visual Studio. If, however, what you need is a development environment (meaning the software necessary for you to create software), then you need Visual Studio. In that case, the Visual Studio installer will ensure that you have everything necessary to write .NET software. You will not need to install anything else manually unless you want to use third-party components.

A: All you need to run a basic .NET Framework application is the .NET Framework.

*

*Windows Vista came with the .NET Framework 3.0.

*Windows 7 came with the .NET Framework 3.5.

*Windows 8 comes with the .NET Framework 4.5.

You can download the .NET Framework 4.5 (includes all previous .NET frameworks back to 2.0) here: http://www.microsoft.com/en-us/download/details.aspx?id=30653

If you want to develop a simple .NET applicaiton, you will also need Visual Studio, but that's it, nothing more. Visual Studio includes all necessary .NET development components.

A: Depending on the .NET Framwork version you want to target, you need the appropriate Framework installer from Microsoft:
http://www.microsoft.com/net


text:
Q: Error: Cant't use refreshToken. How do I resolve this error Thrown by mongoose?
I started getting this error for no reason when I tried to log in using the google strategy provided by passport. NOTE: It was perfectly working fine, This error popped up very suddenly

Above code is the google login route. and the strategy code is attached below.


text:
Q: How do i use pagenation in my code,my app crashes while scrolling recyclerview? I am trying to show JSON response in my app which shows icons and title in my app,i used recyclerview to list item vertically on the cardview.But my app Crashes while i scroll down ,i google some sollution it says to use pagination.I never use pagination.Help me assap
 class ListSourceViewHolder extends RecyclerView.ViewHolder implements
    View.OnClickListener
    {
    ItemClickListener itemClickListener;
    TextView source_title;
    CircleImageView source_image;
    public ListSourceViewHolder(View itemView) {
        super(itemView);
        source_image=(CircleImageView)itemView.findViewById(R.id.source_image);
        source_title=(TextView) itemView.findViewById(R.id.source_name);
        itemView.setOnClickListener(this);
    }

    public void setItemClickListener(ItemClickListener itemClickListener) {
        this.itemClickListener = itemClickListener;
    }

    @Override
    public void onClick(View v) {
        itemClickListener.onClick(v,getAdapterPosition(),false);
    }
}
     public class ListSourceAdapter
     extendsRecyclerView.Adapter<ListSourceViewHolder> {

    private Context context;
    private WebSite webSite;
    private IconBetterIdeaService mService;

    public ListSourceAdapter(Context context, WebSite webSite) {
        this.context = context;
        this.webSite = webSite;
        mService= Common.getIconService();
    }

    @Override
    public ListSourceViewHolder onCreateViewHolder(ViewGroup parent, int
    viewType) {
        LayoutInflater inflater=LayoutInflater.from(parent.getContext());
        View view=inflater.inflate(R.layout.source_layout,parent,false);
        return new ListSourceViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final ListSourceViewHolder holder, final int
    position) {
     StringBuilder iconBetterAPI=new StringBuilder("https://icons.better-
    idea.org/allicons.json?url=");
        iconBetterAPI.append(webSite.getSources().get(position).getUrl());
        mService.getIconUrl(iconBetterAPI.toString()).enqueue(new
    Callback<IconBetterIdea>() {
            @Override
            public void onResponse(Call<IconBetterIdea> call,
    Response<IconBetterIdea> response) {

    if (response.body().getIcons().size() > 0)
     {
           Picasso.with(context).load(response.body().getIcons().get(0).getUrl()).into(holder.source_image);

                    }
                }
            @Override
            public void onFailure(Call<IconBetterIdea> call, Throwable t) {

            }
        });

    holder.source_title.setText(webSite.getSources().get(position).getName());
        holder.setItemClickListener(new ItemClickListener() {
            @Override
            public void onClick(View view, int position, boolean isLongClick) {
                Intent intent=new Intent(context, ListNews.class);
                intent.putExtra("source",
                webSite.getSources().get(position).getId());
                intent.putExtra("sortBy",

            webSite.getSources().get(position).getSortBysAvailable().get(0));
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);

            }
        });
    }

     @Override
    public int getItemCount() {
        return webSite.getSources().size();
    }
    }

//Here is my mainActivity
package pay4free.in.primenews;

import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.google.gson.Gson;

import dmax.dialog.SpotsDialog;
import io.paperdb.Paper;
import pay4free.in.primenews.Adapter.ListSourceAdapter;
import pay4free.in.primenews.Common.Common;
import pay4free.in.primenews.Interface.NewsService;
import pay4free.in.primenews.Model.WebSite;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class MainActivity extends AppCompatActivity {
RecyclerView listWebsite;
    RecyclerView.LayoutManager layoutManager;
    NewsService mService;
    ListSourceAdapter adapter;
    SpotsDialog Dialog;
    SwipeRefreshLayout swipeRefreshLayout;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Paper.init(this);
        mService= Common.getNewsService();
      swipeRefreshLayout=(SwipeRefreshLayout)findViewById(R.id.swipe);
        swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                loadWebsiteSource(true);
            }
        });
        listWebsite=(RecyclerView)findViewById(R.id.list_source);
        listWebsite.setHasFixedSize(false);
        layoutManager=new LinearLayoutManager(this);
        listWebsite.setLayoutManager(layoutManager);

        Dialog=new SpotsDialog(this);
        loadWebsiteSource(false);

    }

    private void loadWebsiteSource(boolean isRefreshed) {
if(!isRefreshed)
{
    String cache =Paper.book().read("cache");
    if(cache!=null&&!cache.isEmpty())
    {
        WebSite webSite=new Gson().fromJson(cache,WebSite.class);
        adapter=new ListSourceAdapter(getBaseContext(),webSite);
        adapter.notifyDataSetChanged();
        listWebsite.setAdapter(adapter);
    }
    else
    {
        Dialog.show();
        mService.getSources().enqueue(new Callback<WebSite>() {
            @Override
            public void onResponse(Call<WebSite> call, Response<WebSite> response) {
                adapter=new ListSourceAdapter(getBaseContext(),response.body());
                adapter.notifyDataSetChanged();
                listWebsite.setAdapter(adapter);
                Paper.book().write("cache",new Gson().toJson(response.body()));
            }

            @Override
            public void onFailure(Call<WebSite> call, Throwable t) {

            }
        });
    }
}
else
{
    Dialog.show();
    mService.getSources().enqueue(new Callback<WebSite>() {
        @Override
        public void onResponse(Call<WebSite> call, Response<WebSite> response) {
            adapter=new ListSourceAdapter(getBaseContext(),response.body());
            adapter.notifyDataSetChanged();
            listWebsite.setAdapter(adapter);

            Paper.book().write("cache",new Gson().toJson(response.body()));
            swipeRefreshLayout.setRefreshing(false);
        }

        @Override
        public void onFailure(Call<WebSite> call, Throwable t) {

        }
    });
}
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }
}

Help me,my app get crashes when i scroll down to the bottom.

A: You are creating adapter every time.Create adapter only once and update it.
Remove these lines
adapter=new ListSourceAdapter(getBaseContext(),response.body());
adapter.notifyDataSetChanged();
listWebsite.setAdapter(adapter);

Create a method to update the data in your adapter.
adapter.yourMethodToUpdate(response.body());
adapter.notifyDataSetChanged();