text:
Q: How to know max buffer storage size (using OpenGL) on a specific device? I did some researches on the topic responding to the question : How to know the maximum size (in bytes) a buffer (XXX Buffer Object) can contains depending the device (GPU) where the application is executed ?
For example about the vertices storage I use a Vertex Buffer Object (VBO) and the only way to know if I can allocate a certain size is to check if the function glGetError() returns the error GL_OUT_OF_MEMORY. So, if this exception occurs I will need to store the rest of my data within an other VBO (It's apparently the same thing concerning Index Buffer Objects (IBO)).
Now, to store my matrices I use Texture Buffer Object (TBO) and for my Materials and Lights parameters I use Uniform Buffer Objects (UBO).
About TBO, it exists a way to know the maximum size : the defined value GL_MAX_TEXTURE_BUFFER_SIZE (the texture (or here matrix data) can only access up to GL_MAX_TEXTURE_BUFFER_SIZE texels).
So, to know the max storage size in bytes, do I have to apply the equation ?
TBO(maxByteSize) = GL_MAX_TEXTURE_BUFFER_SIZE * sizeof(glm::vec4) (I believe a texel is defined on a 32 bytes array -> glm::vec4). Is that right ?
My device is the following:
GeForce GTX 780M (I have laptop)
Here's the values of the deferent macros respectively for TBO max size in texels, TBO max size converted in bytes and the sames for UBO and SSBO:
std::cout << "TBO(texels): " << GL_MAX_TEXTURE_BUFFER_SIZE << std::endl;
std::cout << "TBO(bytes): " << GL_MAX_TEXTURE_BUFFER_SIZE * sizeof(glm::vec4)<< std::endl;
std::cout << "UBO: " << GL_MAX_UNIFORM_BLOCK_SIZE << std::endl;
std::cout << "SSBO: " << GL_MAX_SHADER_STORAGE_BLOCK_SIZE << std::endl;

The output:
TBO(texels): 35 883 texels
TBO(bytes): 574 128 bytes (0.5 MByte)
UBO: 35 376 bytes (0.03 MByte)
SSBO: 37 086 bytes (0.03 MByte)

However I refered to the following website :
http://rastergrid.com/blog/2010/01/uniform-buffers-vs-texture-buffers/

The author says the max size of a UBO is AT LEAST 64 KBytes (65 536 Bytes) and for a TBO the value is AT LEAST 128 MBytes (134 217 728 Bytes!).
I also refered to the following website (concerning SSBO max storage size):
https://www.opengl.org/wiki/Shader_Storage_Buffer_Object

The author says the maximum size for a SSBO is AT LEAST 16 MBytes (16 777 216 Bytes).
So, What is wrong with the information I logged above ?
Is these macros don't contains the max size values in bytes ?

A: You should do like this:
GLint size;
glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &size);
std::cout << "GL_MAX_SHADER_STORAGE_BLOCK_SIZE is " << size << " bytes." << endl;

Output in my computer is:
GL_MAX_SHADER_STORAGE_BLOCK_SIZE is 2147483647 bytes.


text:
Q: Should one avoid repeating aggregate functions by using subqueries and aliases? this query shorter:
    SELECT  main.num_msgs, main.num_grps, main.rnk
FROM (
SELECT
        user_id,
        COUNT(distinct group_id) AS num_grps,
        COUNT(*)                 AS num_msgs,
    RANK() OVER(ORDER BY COUNT(*)DESC, COUNT(distinct group_id) DESC, user_id DESC) rnk
FROM messages
    WHERE message_date > date_trunc('week', now())
    GROUP BY user_id
) AS main
WHERE main.user_id = %s

gives me exactly the same results of this one longer:
SELECT  main.num_msgs, main.num_grps, main.rnk
FROM (
SELECT
    user_id,
    num_grps,
    num_msgs,
    RANK() OVER(ORDER BY num_msgs DESC, num_grps DESC, user_id DESC) rnk
FROM (
    SELECT
        user_id,
        COUNT(distinct group_id) AS num_grps,
        COUNT(*)                 AS num_msgs
    FROM messages
    WHERE message_date > date_trunc('week', now())
    GROUP BY user_id
    ) AS sub
) AS main
WHERE main.user_id = %s

The second one is longer because it uses another sub-query and in this way it can avoid to repeat the aggregate functions in PARTITION BY using aliases, while the first one is shorter and does not have the sub-query but repeats the aggregate functions because it can't uses aliases.
Which way is to prefer?

A: It seems that both queries are equivalent, except of the lack of DESC:
RANK() OVER(ORDER BY COUNT(*) DESC, ...

in the first one. This is probably an oversight.
The Postgres optimizer should generate the same plan for both queries, so use the shorter one. In case you are in doubt execute EXPLAIN ANALYSE for the queries and compare generated plans.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Google Drive API call to insert Public Share permissions on Fusiontables causes Internal Error I have been trying to use the Google Drive API to make a Fusiontable publicly readable, and have not been able to get it to work.  I am able to use the OAuth 2.0 Playground to insert public share permissions for other Google Drive documents, but for Fusiontables I get an HTTP 500 error, "Internal Error".  Note that I have tried including every scope available under "Drive API v2" and "Fusion Tables API v1".
I'm aware that Google is no longer developing and supporting Fusiontables, but I'm wondering if anyone has found a workaround that allows them to get around this problem?  I haven't tried legacy/deprecated versions of the API either.
Here's are the actual API request format and responses from OAuth Playground for a Fusiontable permissions insert (HTTP 500), then a Doc permissions insert (HTTP 200).  The only difference between requests is the fusiontable_id or document_id in the Request URI:
Request:
POST /drive/v2/files/<fusiontable_id or document_id>/permissions HTTP/1.1
Host: www.googleapis.com
Content-length: 33
Content-type: application/json
Authorization: Bearer <access_token>

{"role":"reader","type":"anyone"}

Fusiontable Response:
HTTP/1.1 500 Internal Server Error
Content-length: 180
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Expires: Tue, 04 Nov 2014 23:51:58 GMT
Vary: Origin,Referer,X-Origin
Server: GSE
Cache-control: private, max-age=0
Date: Tue, 04 Nov 2014 23:51:58 GMT
X-frame-options: SAMEORIGIN
Content-type: application/json; charset=UTF-8
{
  "error": {
    "code": 500,
    "message": "Internal Error",
    "errors": [
      {
        "domain": "global",
        "message": "Internal Error",
        "reason": "internalError"
      }
    ]
  }
}

Doc response:
HTTP/1.1 200 OK
Content-length: 281
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Vary: Origin,Referer,X-Origin
Server: GSE
Etag: "M4l5RvCt2StP2jOGfgyJPGdTZTc/dgFZz37LrQjIXplUkmnh3VtemzQ"
Pragma: no-cache
Cache-control: no-cache, no-store, max-age=0, must-revalidate
Date: Wed, 05 Nov 2014 15:35:56 GMT
X-frame-options: SAMEORIGIN
Content-type: application/json; charset=UTF-8
{
  "kind": "drive#permission",
  "etag": "\"M4l5RvCt2StP2jOGfgyJPGdTZTc/dgFZz37LrQjIXplUkmnh3VtemzQ\"",
  "role": "reader",
  "type": "anyone",
  "id": "anyone",
  "selfLink": "https://www.googleapis.com/drive/v2/files/<document_id>/permissions/anyone"
}

A: This appears to be due to a bug in the Drive API. I've located the internal error and have raised the issue with the engineering team. At this time there are no known workarounds.

A: I have a good news!
I've received an email from googletables-feedback. They says that it should be working now.
My code on Google Client JS API works fine
var setAccess = function setAccessF() {
    gapi.client.request({
        path : '/drive/v2/files/{fileID}/permissions',
        method : 'post',
        body : {
            'value' : 'anyone',
            'type' : 'anyone',
            'role' : 'reader'
        }
    }).then(opt_onFulfilled, opt_onRejected);
}

function opt_onRejected(e) {
    console.log(e)
}

function opt_onFulfilled(e) {
    console.log(e)
}

A: If you'd be OK with a temporary workaround, inserting Fusion Table public share permission still works with older XML-based GData API. You can check it out here, though beware of the red banner at the top of the page saying 'The deprecation period for Version 3 of the Google Documents List API is nearly at an end. On April 20, 2015, we will discontinue service for this API.'
So if you need to workaround the problem now, that would keep you going till April and then let's hope the Drive API bug gets fixed before that...

A: Personally, the document I was attempting to add the permissions to had become invalid. This might also be an issue for someone else.


text:
Q: COUNT function? How do i assigned the correct number of students to a position available
Eg...
TABLE NAME : JOB_DETAILS
COMPANY: ABC
NO_OF_VACANCY : 3
ASSIGNED : 3
jobscope : IT

query ran to match the number of students to fill up the number of students assigned is HALF correct :
UPDATE job_details,student_details SET assigned=no_of_vacancy WHERE student_details.jobscope = job_details.jobscope AND student_details.jobscope = 'IT';");

TABLE NAME : student_details
name : A1
Jobscope : IT

name : A2
jobscope : IT

"SELECT COUNT(*) FROM student_details WHERE jobscope1 ='IT';

The problem is i want to insert the CORRECT number of student name into another matching table in the database to show .
The company and student name beside
eg . Company ABC - A1
     Company ABc - A3
How do i create a query to count the number of student who chose it and Update the job_details table to count the correct number of students to assign to the company abc.
The query1 is wrong as the results show vacancy 3 and assigned is 3.
i want it to show vacancy 3 and assigned is 2 since the number of students who chose IT is only 2.


text:
Q: connecting mysql through command prompt I have query regarding connecting mysql to comand prompt.
I did:
open cmd prompt
telnet localhost com 3306
 I RECEIVED REPLY as---

some instructions mentioning
telnet [-a][-e escape char][-f log file][-1 user][-t term][host [port]]
-a     attempt automatic logon. same as -1 option except uses the currently logged on  user's name.

-e   Escape char to enter telnet client prompt.

and some more...
but is it right?? or i am lost???
kindly help.

A: do not telnet to your mysql database.
Instead use the mysql command, a UI like db visualizer (they have a pay version and a free version), or the free ui that comes with maria db (a drop in replacement for mysql).
more more info on the mysql command, try running mysql --help or find it in the mysql reference manual
Edit: more info added here.
Telnet is not a "command prompt", it is a communication protocol (check out telnet protocol on wikipedia) and a program (that uses the communication protocol to communicate).  You can not connect to mySql with telnet because mySql does not use the telnet protocol for communication.
I have only accessed mySql for jdbc, so I'm not sure how to solve your problem.  I know there is a c api interface for mySql as well.  Sections "20 Connectors and APIs," and "15 Replication" in the mysql reference might be helpful.


text:
Q: Material ui v5 cant customize theme using typescript I'm trying to add custom color to the theme but i can't access the colors from the pallet via theme.pallete this is my theme section:
    import { createTheme } from "@mui/material/styles";

    type BackgroundType = {
        background?: string;
        onBackground?: string;
        surface?: string;
        onSurfaceHigh?: string;
        onSurfaceLow?: string;
    };
    type Gradient = {
        main?: string;
        gradientRtl?: string[];
        gradientLtr?: string[];
        gradientDarkRtl?: string[];
        gradientDarkLtr?: string[];
        onGradientLight?: string;
        onGradientDark?: string;
    };
    type meta = {
        inpute?: string;
        inputeActive?: string;
        outlineButton?: string;
        outlineButtonText?: string;
        line?: string;
    };

    declare module "@mui/material/styles" {
        export interface PaletteOptions {
            Gradient: Gradient;
            Accent: PaletteOptions["primary"];
            Background: BackgroundType;
            Meta: meta;
        }
        export interface Palette {
            Gradient: Gradient;
            Accent: PaletteOptions["primary"];
            Background: BackgroundType;
            Meta: meta;
        }

        export interface SimplePaletteColorOptions {
            onLight?: string;
            onDark?: string;
            containerLight?: string;
            containerDark?: string;
            onContainerLight?: string;
            onContainerDark?: string;
            ButtonLight?: string;
            ButtonDark?: string;
            onButtonLight?: string;
            onButtonDark?: string;
        }

    const theme = createTheme(
        {
        direction: "rtl",
        typography: {
            fontFamily: [
                "dana",
                "dana-number",
                "Open Sans",
                "Roboto",
                "Arial",
                "-apple-system",
                "BlinkMacSystemFont",
                '"Segoe UI"',
                '"Helvetica Neue"',
                "sans-serif",
                '"Apple Color Emoji"',
                '"Segoe UI Emoji"',
                '"Segoe UI Symbol"',
            ].join(","),
        },
        palette:{
Gradient: {
        main: "#4FC3F7",
        gradientLtr: ["#4FC3F7", "#51ABF4"],
        gradientRtl: ["#4FC3F7", "#51ABF4"],
        onGradientLight: "#FFFFFF",
        onGradientDark: "#000000",
        gradientDarkRtl: ["#4FC3F7", "#51ABF4"],
        gradientDarkLtr: ["#51ABF4", "#4FC3F7"],
    },
    primary: {
        main: "#51ABF4",
        light: "#51ABF4",
        dark: "#51ABF4",
        onLight: "#FFFFFF",
        onDark: "#102231",
        containerLight: "#DCEEFD",
        onContainerLight: "#204462",
        containerDark: "#316792",
        onContainerDark: "#B9DDFB",
    },

    secondary: {
        main: "#4FC3F7",
        light: "#4FC3F7",
        onLight: "#FFFFFF",
        containerLight: "#DCF3FD",
        onContainerLight: "#204E63",
        dark: "#4FC3F7",
        onDark: "#102731",
        containerDark: "#2F7594",
        onContainerDark: "#B9E7FC",
    },
    Accent: {
        main: "#9980FF",
        light: "#9980FF",
        onLight: "#FFFFFF",
        containerLight: "#EBE6FF",
        onContainerLight: "#3D3366",
        ButtonLight: "#AD99FF",
        onButtonLight: "#FFFFFF",
        dark: "#AD99FF",
        onDark: "#1F1A33",
        containerDark: "#5C4D99",
        onContainerDark: "#D6CCFF",
    },
    error: {
        main: "#DC3545",
        light: "#DC3545",
        onLight: "#FFFFFF",
        contrastText: "#FFFFFF",
        containerLight: "#F2B5BB",
        onContainerLight: "#58161D",
        ButtonLight: "#E3606D",
        onButtonLight: "#FFFFFF",
        dark: "#E3606D",
        onDark: "#2C0B0E",
        containerDark: "#2C0B0E",
        onContainerDark: "#F1AFB6",
    },
    warning: {
        main: "#EFA82D",
        light: "#EFA82D",
        onLight: "#FFFFFF",
        contrastText: "#FFFFFF",
        containerLight: "#F9E1B6",
        onContainerLight: "#604312",
        dark: "#F2B957",
        onDark: "#302209",
        containerDark: "#8F651B",
        onContainerDark: "#F9DCAB",
    },
    success: {
        main: "#28AB46",
        light: "#28AB46",
        onLight: "#FFFFFF",
        contrastText: "#FFFFFF",
        containerLight: "#ACEBBB",
        onContainerLight: "#08220E",
        dark: "#53BC6B",
        onDark: "#08220E",
        containerDark: "#18672A",
        onContainerDark: "#A9DDB5",
    },
    Background: {
        background: "#F5F8FC",
        onBackground: "#61666B",
        surface: "#FFFFFF",
        onSurfaceHigh: "#4E5256",
        onSurfaceLow: "#818589",
    },
    Meta: {
  inpute:"#A0A3A6",
  inputeActive:"#61666B",
  outlineButton:"#A0A3A6",
  outlineButtonText:"#61666B",
  line:"#DFE0E1"
},

    });

    export default theme;

    }

I declared a module on @mui/material/styles but it seems that it is not working cuz when I m trying to access to for example accent palette option I get the there is no option error even I can't access it from autocomplete from my vs code. I'm just doing what docs say am I doing something wrong?

A: I found the solution but its a little bit strange after i declared palette as an object and pass it to a theme instead of writing inside theme directly it recognized
const MyPalete={
    Gradient: {
        main: "#4FC3F7",
        gradientLtr: ["#4FC3F7", "#51ABF4"],
        gradientRtl: ["#4FC3F7", "#51ABF4"],
        onGradientLight: "#FFFFFF",
        onGradientDark: "#000000",
        gradientDarkRtl: ["#4FC3F7", "#51ABF4"],
        gradientDarkLtr: ["#51ABF4", "#4FC3F7"],
    },
    primary: {
        main: "#51ABF4",
        light: "#51ABF4",
        dark: "#51ABF4",
        onLight: "#FFFFFF",
        onDark: "#102231",
        containerLight: "#DCEEFD",
        onContainerLight: "#204462",
        containerDark: "#316792",
        onContainerDark: "#B9DDFB",
    },

    secondary: {
        main: "#4FC3F7",
        light: "#4FC3F7",
        onLight: "#FFFFFF",
        containerLight: "#DCF3FD",
        onContainerLight: "#204E63",
        dark: "#4FC3F7",
        onDark: "#102731",
        containerDark: "#2F7594",
        onContainerDark: "#B9E7FC",
    },
    Accent: {
        main: "#9980FF",
        light: "#9980FF",
        onLight: "#FFFFFF",
        containerLight: "#EBE6FF",
        onContainerLight: "#3D3366",
        ButtonLight: "#AD99FF",
        onButtonLight: "#FFFFFF",
        dark: "#AD99FF",
        onDark: "#1F1A33",
        containerDark: "#5C4D99",
        onContainerDark: "#D6CCFF",
    },
    error: {
        main: "#DC3545",
        light: "#DC3545",
        onLight: "#FFFFFF",
        contrastText: "#FFFFFF",
        containerLight: "#F2B5BB",
        onContainerLight: "#58161D",
        ButtonLight: "#E3606D",
        onButtonLight: "#FFFFFF",
        dark: "#E3606D",
        onDark: "#2C0B0E",
        containerDark: "#2C0B0E",
        onContainerDark: "#F1AFB6",
    },
    warning: {
        main: "#EFA82D",
        light: "#EFA82D",
        onLight: "#FFFFFF",
        contrastText: "#FFFFFF",
        containerLight: "#F9E1B6",
        onContainerLight: "#604312",
        dark: "#F2B957",
        onDark: "#302209",
        containerDark: "#8F651B",
        onContainerDark: "#F9DCAB",
    },
    success: {
        main: "#28AB46",
        light: "#28AB46",
        onLight: "#FFFFFF",
        contrastText: "#FFFFFF",
        containerLight: "#ACEBBB",
        onContainerLight: "#08220E",
        dark: "#53BC6B",
        onDark: "#08220E",
        containerDark: "#18672A",
        onContainerDark: "#A9DDB5",
    },
    Background: {
        background: "#F5F8FC",
        onBackground: "#61666B",
        surface: "#FFFFFF",
        onSurfaceHigh: "#4E5256",
        onSurfaceLow: "#818589",
    },
    Meta: {
  inpute:"#A0A3A6",
  inputeActive:"#61666B",
  outlineButton:"#A0A3A6",
  outlineButtonText:"#61666B",
  line:"#DFE0E1"
},
};

const theme = createTheme(
    {
    direction: "rtl",
    typography: {
        fontFamily: [
            "dana",
            "dana-number",
            "Open Sans",
            "Roboto",
            "Arial",
            "-apple-system",
            "BlinkMacSystemFont",
            '"Segoe UI"',
            '"Helvetica Neue"',
            "sans-serif",
            '"Apple Color Emoji"',
            '"Segoe UI Emoji"',
            '"Segoe UI Symbol"',
        ].join(","),
    },
    palette:MyPalete

});

export default theme;

but I don't know what is differs on writing directly and taking a palette to an object and passing


text:
Q: Extracting the URL file name in CGI bash script I have two CGI files:
script1.sh:
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo ""
echo ""
echo "<form action="/cgi-bin/gene-to-structure/NM_002014-
NP_002005.1/script5.sh" method="GET">"
echo "
<input type="checkbox" name="residue" value="V---M">

"
echo "
<input type="checkbox" name="residue" value="K---N">

"
echo "<input type="submit" value="Submit">"
echo "</form>"
echo ""
echo ""

In the above script on clicking the "submit" button I am taken to "script5.sh" CGI script. I want to retrieve the "file name" (script1.sh) of the file from which after clicking the "submit" button I came to "script5.sh". Can you please let me know how it can be done?
So, I want to do this in "script5.sh":
Script5.sh
#!/bin/bash
echo "Content-type: text/html"
echo ""

echo "The file name of the file is "script1.sh"".

Thank you so much!


text:
Q: Como sincronizar Javascript y una aplicación de Windows en C# Tengo una plataforma creada en visual C#, y en ella se guarda la información de varios pacientes y está accede a diversos hardware. Debido a que se está implementando esta misma plataforma pero versión web y se necesita controlar los equipos, hay un problema. La plataforma está en un servidor remoto y la detección de hardware está hecha con C#.
La pregunta sería, cómo hacer que la plataforma web abriera o se sincronizara con la aplicación de C# y pudieran enviarse datos entre ellas.
Sé que se puede porque lo vi en la página de Dell, ellos te hacen descargar un software y al instalarlo en tu máquina la plataforma web de Dell accede a toda la configuración de tu equipo y te da un reporte del software y hardware, en la misma pestaña sin abrir una nueva ni nada parecido.


text:
Q: How access uploaded file in spring framework I am new to Spring framework in spring site There is tutorial at https://spring.io/guides/gs/uploading-files/ that upload file to the root folder "upload-dir" (this folder is beside src root folder)
questions:

*

*How can I access and show image in browser (or access it in thymeleaf by th:src="@{}" syntax) -
by browsing to localhost:8080/files/first.jpg because of controller it give me download link.

*should I always upload file to folder that beside src folder for example I want to upload file to "src/main/resources/static/file" is it possible?

A: When accessing files in your code, Spring will (by default) assume that the src/main/resources is the parent directory. If you are planning on accessing the files that are uploaded, then I would use src/main/resources (or a subdirectory of this location) as the upload path. This way, you can simply access them in Thymeleaf as such:
Location: src/main/resources/picture.jpg
Thymeleaf: th:src="@{picture.jpg}"

Or if the file exists in a subdirectory:
Location: src/main/resources/somedir/picture.jpg
Thymeleaf: th:src="@{somedir/picture.jpg}"

If you are storing the file(s) elsewhere, then you can also access them using various prefixes like classpath or file, i.e.:
classpath:com/myapp/config.xml

See more about Resources in Spring here:
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html
Hope this helps!


text:
Q: RAM Supported by Samsung SENS R530 What is the maxmium RAM supported by Samsung SENS R530 Laptop?
The Current Configuration is as follows:

*

*OS: Win7 Ultimate 32 bit

*System Model: R530

*Processor: Pentium(R) Dual-core CPU T4300 @2.10GHz (2 CPUs) ~2.1GHZ

*Memory: 2048MB RAM

A: While i'm growing less fond of it, SIW should tell you - the portable version is only downloadable if you don't have adblocking on.
Hardware - memory - maximum memory capacity should tell you what you need

A: I've always found the Crucial Memory Advisor to be an excellent tool to tell you exactly what you can expect to fit in a machine.
For the R530 it shows 8GB as the maximum you can fit. http://www.crucial.com/uk/store/listparts.aspx?model=R530&Cat=RAM
This is simply by selecting your model on their list, they also have an actual system scanner that can get a more precise match on your machine.


text:
Q: How to mount a specific hadoop folder via NFS gateway I am trying to setup a NFS Gateway for my hadoop cluster following steps mentioned in this nice guide. I have followed steps here. I am able to mount the / using command mentioned in the doc:
mount -t nfs -o vers=3,proto=tcp,nolock $server:/ $mount_point

But I want to mount a folder present in my HDFS like this:
mount -t nfs -o vers=3,proto=tcp,nolock $server:/$dir $mount_point

But this gives following error from mount command:

mount.nfs: mounting 10.33.37.220:/dir failed, reason given by server:
No such file or directory

and in NFS gateway, following log appears:

18/04/05 15:14:43 INFO mount.RpcProgramMountd: Path /dir is not shared.

I have also trying adding following line in /etc/exports
saurabh@0001:~$ cat /etc/exports
/whatsappData 10.0.0.0/24(rw,sync)

How can this be done.

A: From Hadoop docs, I found there is one config Export point: nfs.export.point
This can specify the NFS export point of HDFS. Exactly one export point is supported. Full path is required when configuring the export point. By default, the export point is the root directory /.
So setting following solved my issue:
<property>
  <name>nfs.export.point</name>
  <value>/dir</value>
</property>


text:
Q: Using DynamicMap() and ignore null source value I'm using Mapper.DynamicMap() inside a generic method and would like to, without using .CreateMap(), ignore some any source values that are null. Is this even possible?

A: If you want all source properties with null values to be ignored you could use:
Mapper.CreateMap<SourceType, DestinationType>()
                    .ForAllMembers(opt => opt.Condition(srs => !srs.IsSourceValueNull));

Otherwise, you can do something similar for each member. This will get quit tedious if there are a large number of properties.

A: I solved it with DataMember property in destination type [DataMember(EmitDefaultValue = false)] add this in the destination DTO


text:
Q: Was Trevor a real person? In The Good Place, we meet the character of Trevor, played by Adam Scott, supposedly coming to the Good Place as a representative of the Bad Place. However,

 it is revealed that the main characters of the show were actually in the Bad Place the whole time, and everyone else who was supposedly in the Good Place were actually just acting.

However, we see the character of Trevor in a video in the Medium Place, so he couldn't have just been acting. What was his place in the Bad Place hierarchy of Season 2?

A: Trevor is definitely a demon
This was already fairly clear as of the time that the other answers were written, but it was confirmed later on. In the third season of the show,

Trevor shows up seeking to disrupt the group and prevent them from showing the Judge that they can achieve personal growth.

He is explicitly identified by Michael as a particularly malicious demon.

A: Warning: too many spoilers to hide behind a tag.

Trevor must be a demon.
The Good Place where our heroes reside is a fake Good Place and is actually a Bad Place, run by demons. The Janet is a Good Janet, stolen from an actual Good Place, but all the others are demons (and a Bad Janet).
Since Trevor participates in this, he must be a demon, either from Michael's cast of demons for his Good Place, or one from another neighbourhood in the Bad Place. Note that the animosity between Michael and him might still be genuine; Michael seems to have a predilection for more sophisticated ways of torture (hence the whole Good Place set-up) while Trevor seems to like banality and rudeness.

The Medium Place doesn't seem to be reset when the Good Place is reset, since when Eleanor and Chidi visit it during attempt #802, Mindy St. Claire tells her she has been there 15 times before.
So it is likely that the Medium Place is not a part of Michael's experiment, even though he might be using it.
That means that the orientation video for Mindy St. Claire must be real, too. It shows the interaction between Bea from the Good Place (which might make her an angel), and Trevor from the Bad Place, a demon.

A: Caution: answer involves spoilers for The Good Place
It is most likely he is a real demon.
Nothing is contradictory if Trevor is a demon. Whereas the other demons are pretending to be good humans in the Good Place to make the main characters torment each other, Trevor's role is to 'pretend' to have come to the (fake) Good Place to return the (fake) real Eleanor Shellstrop (really a demon.)
The Medium Place video would show him (previously) in his real role as a demon interacting with a real Good Place representative in setting up the Medium Place.
That said we have only Michael's word at this stage that the Medium Place is in fact real. While he states that it was necessary to include a certain amount of truth in his deceits, it is impossible to be certain that he is being truthful.


text:
Q: Spreadsheet formula to sum values from last 3 months I can't find any formula which matches what I 'm lokking for and mine doesnt work...
I have data like this :
date         | value
12/12/2020       0
10/11/2020       1

And I need to show in 1 cell the sum of Value column where the Date is from the last three month.
I've tried with this :
=SUM.IF(G3:G;MONTH(A3)>=MONTH(TODAY())-3;A3:A)

But it gives 0 ...

A: Your use of SUMIF is incorrect due to the ff reasons:

*

*First parameter should be the range of the data to be used as comparison on the Second parameter.

*You cannot include a standalone condition in the second parameter since the comparison should be between the first parameter and another value which you will specify in the second parameter.

*Third parameter should be the range of the value you wanted to sum up. In this case, I think you should use G3:G.

With this, please refer to the formula below to solve your problems. I used EDATE to calculate the date 3 months before. You can opt not to do it the exact same way.
=SUMIF(A3:A, ">="&EDATE(TODAY(),-3), G3:G)

I tried this on your data set and it is working perfectly.


text:
Q: Preloading strategy slow down when using with Angular universal app (SSR)
*

*I am using lazy loading for modules. But when the user navigates to the lazy loaded module route, it takes a couple of seconds to load the module.

*So I use a custom preloading strategy with 20 second time delay. When I serve the application using "ng serve". Everything works fine. My website loads fast, lazy loaded module loads after 20 seconds, and there is no delay when the user navigates to the lazy loaded module route.

*BUT When I serve the application using angular universal command "npm run dev:ssr", everything goes bad. Nothing loads until 20 seconds. My app takes more than 20 seconds to load every time. The amount of delay I put to delay preload, is applied to the initial load.

app-routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import {CustomPreloadingStrategyService} from './core/services/custom-preloading-strategy.service';
const routes: Routes = [
  {
    path: 'quick-links',
    data: {preload: true, delay: 20000},
    loadChildren: () => import('./modules/quick-links/quick-links.module').then(m => m.QuickLinksModule)
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes, {
    initialNavigation: 'enabled',
    scrollPositionRestoration: 'enabled',
    preloadingStrategy: CustomPreloadingStrategyService
})],
  exports: [RouterModule]
})
export class AppRoutingModule { }

custom-preloading-strategy.service.ts
import { Injectable } from '@angular/core';
import { Observable, of, timer  } from 'rxjs';
import { map } from 'rxjs/operators'
import { PreloadingStrategy, Route } from '@angular/router';
@Injectable({
  providedIn: 'root'
})
export class CustomPreloadingStrategyService implements PreloadingStrategy {
  preload(route: Route, loadMe: () => Observable<any>): Observable<any> {
    if (route.data && route.data['preload']) {
      var delay:number=route.data['delay']
      console.log('preload called on '+route.path+' delay is '+delay);
      return timer(delay).pipe(
      map( _ => {
        console.log("Loading now "+ route.path);
        return loadMe() ;
      }));
    } else {
      console.log('no preload for the path '+ route.path);
      return of(null);
    }
  }
}

A: Yesss.
I found the reason for the slow loading.

*

*The code written in "custom-preloading-strategy.service.ts" is executed on the server as well every time I reload the browser tab. This code should only be executed on the browser.

*So, I put a new condition, and now code in "custom-preloading-strategy.service.ts only executes on the server.

custom-preloading-strategy.service.ts
import { Injectable, Inject, PLATFORM_ID } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
import { Observable, of, timer  } from 'rxjs';
import { map } from 'rxjs/operators'
import { PreloadingStrategy, Route } from '@angular/router';
@Injectable({
  providedIn: 'root'
})
export class CustomPreloadingStrategyService implements PreloadingStrategy {
  constructor(
    @Inject(PLATFORM_ID) private platformId: any
  ){}
  preload(route: Route, loadMe: () => Observable<any>): Observable<any> {
    // Add a new check here
    if (isPlatformBrowser(this.platformId) && route.data && route.data['preload']) {
      var delay:number=route.data['delay']
      console.log('preload called on '+route.path+' delay is '+delay);
      return timer(delay).pipe(
        map( _ => {
        console.log("Loading now "+ route.path);
        return loadMe() ;
      }));
    } else {
      console.log('no preload for the path '+ route.path);
      return of(null);
    }
  }
}


text:
Q: I am planning to build a giant management system in Flex 4.0, and I need some advice I am planning to build a giant management system in Flex 4.0, and I just wanted to know what are some pros and cons of using 4.0 (or 4.2) over 3.5? Lighter components? Faster pipelines? What are some things I can look forward to when using Flex 4.0?

A: The biggest change when using Flex 4 (and above) is the introduction of the Spark Architecture.  Spark offers a brand new component set which makes it easier to design and skin components.  The spark architecture also offers integration with other Adobe tools such as Flash Catalyst.
Adobe has clearly stated that Spark is the future of Flex Development.  The MX architecture is not supported in mobile optimized components, for example.
If I were to start a new project today, I would try to focus it on the Flex 4 / Spark architecture as much as possible.  If any of the Spark components fail you, you can still use the MX Components in the Flex 4 project.
Although it hasn't happened yet, I can forsee a future where the MX component set becomes deprecated.

A: With Adobe always go with the latest and greatest because legacy products won't be support for long.  As others have mentioned the new Spark Components are much better and super helpful when coding UI.  Sliders and other UI components are a breeze, but there is nothing lightweight about AIR or Flex.
I see no cons of Using Flex 4, but just like the Adobe Flash Player the newer the better.  There are constant security fixes and over all improvements.  Not to mention Adobe is fixing and optimizing the Flash Player which will encourage any users to upgrade to the latest and greatest.
The only reason why I would pic one version of Flex over another is if you want to use some 3rd party plug-in that is only supported by another version.  Otherwise, use the newest version.


text:
Q: How do I get an UIImageView to tell me when its animation stops? I have a UIImageView that is displaying a series of pictures as an animation.  This part of the project works well.
I want to display a label when the animation ends. Is there an event that the Imageview will trigger when it's animation ends?

A: Set the duration the animation will go using setAnimationDuration:
At the same time you configure performSelector:withObject:withDelay with the same delay as the duration the animation will go on
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0]; //the animation will last for 1.0s
//some animation code here
[UIView commitAnimations];
[self performSelector:@selector(someMethodToDisplayLabel) withObject:nil afterDelay:1.0];
    //someMethodToDisplayLabel will be called after 1.0s

A: Doesn't look like there is an event/delegate for this. My first instinct would be to calculate the length of the animation yourself, and then set up an NSTimer so that when the animation ends, NSTimer fires displaying whatever you want to display next.


text:
Q: Evaluate a piece of ex source code If I have a multiline piece of vimscript e.g., in the clipboard,
how can I evaluate it?
Is there a way to do it other than by saving it and sourcing the saved file?

A: Suppose you have a file like this:
hello
world
foo
bar
1,4s/^/#/

You're on the last line, in NORMAL mode:

*

*type yy to copy

*type :@"Enter to run

The result is:
#hello
#world
#foo
#bar
1,4s/^/#/

You can even copy multi-line vim script to any register, then evaluate them.

A: I have these two mappings in my vimrc:
" Source
vnoremap <leader>so y:execute @@<cr>:echo 'selection Sourced .'<cr>
nnoremap <leader>so ^vg_y:execute @@<cr>:echo 'line Sourced.'<cr>

which allow you press <leader>so to source (execute) visual selection or current line (in normal mode)
https://github.com/sk1418/myConf/blob/master/common/.vimrc#L155


text:
Q:  height extends on internet explorer 8 and below The  height of my homepage extends to about 200% on earlier IE. The website is http://www.graetz-ran.co.il/.

A: After

 get rid of


text:
Q: The Not Equal Tilde in bash Like presented in the title,
What's the opposite of "=~" operator?
I really googled for that and I fund just the following solution: [[ ! $str1 =~ $str2 ]]
Is there any operator that verify the opposite of "=~" operator?
Thanks.

A: Answer is There is no such Operator in bash Which does !~ as its there in perl, if you do not want to use already known ( [[ ! $str1 =~ $str2 ]] ) for the purpose then you shall have to use grep or perl . Something like:
x="I like negation"
y="like"

if [[ $(perl -ne "!/$y/ && print" <(echo $x)) == "$x" ]]; then
echo "Contains"
else
echo "Doesn't contain"

But I don't find any reason to miss !~ in bash as [[ ! $str1 =~ $str2 ]] solves the purpose pretty well. May be that the reason its not there in bash.
Consider the first comment on this Answer from DevSolar, It holds when you will go with grep or perl, which again makes [[ ! $str1 =~ $str2 ]] the best out of available.

A: There is no opposing operator in bash up to version 4.3 (current at the time of this post).
[[ ! str1 =~ str2 ]] is the way to go.
For such questions, you should use man instead of your favourite search engine. The man page of the tool involved -- bash, in this case -- is authoritative, the 'web is hearsay (unless, of course, it led you to the man page ;-) ).


text:
Q: How can I add a fade-in animation for Nextjs/Image when it loads? I'm using next/image, which works great, except the actual image loading in is super jarring and there's no animation or fade in. Is there a way to accomplish this? I've tried a ton of things and none of them work.
Here's my code:
<Image
  src={source}
  alt=""
  layout="responsive"
  width={750}
  height={height}
  className="bg-gray-400"
  loading="eager"
/>

According to the docs I can use the className prop, but those are loaded immediately and I can't figure out any way to apply a class after it's loaded.
I also tried onLoad, and according to this ticket, it isn't supported:
https://github.com/vercel/next.js/issues/20368

A: NextJS now supports placeholder. You can fill the blurDataURL property with the base64 string of the image which you can easily get using the lib plaiceholder on getServerSideProps or getStaticProps. Then to make the transition smoothly you can add transition: 0.3s;
Quick sample:
export const UserInfo: React.FC<TUserInfo> = ({ profile }) => {
  return (
    <div className="w-24 h-24 rounded-full overflow-hidden">
      <Image
        src={profile.image}
        placeholder="blur"
        blurDataURL={profile.blurDataURL}
        width="100%"
        height="100%"
      />
    </div>
  );
};

export async function getServerSideProps(props: any) {
  const { username } = props.query;

  const userProfileByName = `${BASE_URL}/account/user_profile_by_user_name?user_name=${username}`;
  const profileResponse = await (await fetch(userProfileByName)).json();
  const profile = profileResponse?.result?.data[0];

  const { base64 } = await getPlaiceholder(profile.profile_image);

  return {
    props: {
      profile: {
        ...profile,
        blurDataURL: base64,
      },
    },
  };
}

index.css
img {
  transition: 0.3s;
}

======== EDIT ==========
If you have the image in the public folder for ex, you don't need to do the above steps, just statically import the asset and add the placeholder type. NextJS will do the rest. Also, make sure to make good use of the size property to load the correct image size for the viewport and use the priority prop for above-the-fold assets. Example:
import NextImage from 'next/image'
import imgSrc from '/public/imgs/awesome-img.png'

return (
  ...
  <NextImage
    src={imgSrc}
    placeholder='blur'
    priority
    layout="fill"
    sizes="(min-width: 1200px) 33vw, (min-width: 768px) 50vw, 100vw"
  />
)

A: I wanted to achieve the same thing and tried to use the onLoad event, therefore. The Image component of nextJs accepts this as prop, so this was my result:
const animationVariants = {
    visible: { opacity: 1 },
    hidden: { opacity: 0 },
}

const FadeInImage = props => {
    const [loaded, setLoaded] = useState(false);
    const animationControls = useAnimation();
    useEffect(
        () => {
            if(loaded){
                animationControls.start("visible");
            }
        },
        [loaded]
    );
    return(
        <motion.div
            initial={"hidden"}
            animate={animationControls}
            variants={animationVariants}
            transition={{ ease: "easeOut", duration: 1 }}
        >
            <Image
                {...p}
                onLoad={() => setLoaded(true)}
            />
        </motion.div>
    );
}

However, the Image does not always fade-in, the onLoad event seems to be triggered too early if the image is not cached already. I suspect this is a bug that will be fixed in future nextJS releases. If someone else finds a solution, please keep me updated!
The solution above however works often, and since onLoad gets triggered every time, it does not break anything.
Edit: This solution uses framer-motion for the animation. This could also be replaced by any other animation library or native CSS transitions

A: You could try use next-placeholder to achieve this sort of effect

A: Yes, its possible to capture the event where the actual image loads. I found an answer to this on Reddit and wanted to repost it here for others like me searching for an anwser.
"To get onLoad to work in the NextJS image component you need make sure it's not the 1x1 px they use as placeholder that is the target.

const [imageIsLoaded, setImageIsLoaded] = useState(false)
<Image
    width={100}
    height={100}
    src={'some/src.jpg'}
    onLoad={event => {
        const target = event.target;

        // next/image use an 1x1 px git as placeholder. We only want the onLoad event on the actual image
        if (target.src.indexOf('data:image/gif;base64') < 0) {
            setImageIsLoaded(true)
        }
    }}
/>

From there you can just use the imageIsLoaded boolean to do some fadein with something like the Framer Motion library.
Source: https://www.reddit.com/r/nextjs/comments/lwx0j0/fade_in_when_loading_nextimage/


text:
Q: Code coverage while debugging in Visual Studio 2010 Is there a way to enable code coverage while debugging a asp.net site (+assemblies)?
I know how to do this for Unit Tests, but not if I'm just debugging.
What I'm actually trying to do is checking which parts of the code a certain mobile app uses. So I would like to debug my localhost asp.net site while using the mobile app.

A: I think you could achieve your goal with the profiler that comes with Visual Studio 2010. You would have all the code called during a debug session.


text:
Q: Visual Studio for Mac, Xamarin iOS Publishing Failed popup I am trying to publish a Xamarin iOS app from Visual Studio for Mac.  (ver. 17.0.2).   Xcode ver. 13.4.1 . I have the app set up correctly (I think) in App Store Connect.  The app is just for iPhone and iPad.
I am getting the following results.  It is a picture in VS for Mac so I cannot copy and paste the text into an xml file.

Can anyone tell me what the issue is with my Publish and how to fix it?

A: You can try to increase the CFBundleVersion(build number) in your Info.plist like below and try to publish again.
    <key>CFBundleVersion</key>
    <string>2.0</string>

A: The error looks like an authentication error.
Did you try the same credentials you are using to push your app in https://appleid.apple.com/ ?
If they are still valid, you might just need to sign out and back into XCode / Visual studio for Mac with you valid apple identifier.
(Edited - Added my comment to this answer as it had additional value)
If the credentials works, try uploading the same package using Apple's Transporter application (apps.apple.com/ca/app/transporter/id1450874784?mt=12). It accomplishes the same thing, however the error messages are clearer and more verbose. Hopefully this will help pinpoint the real issue


text:
Q: How to change directories on console application I am creating a simple explorer program for an assignment on c# and have the directory set to c:\\Windows
How you would be able to change the directory from the default windows to something else in the console.

A: You can set Environment.CurrentDirectory property for your directory path.

Gets or sets the fully qualified path of the current working
  directory.

public static void Main(string[] args)
{
    Environment.CurrentDirectory = "C:\\Windows";
}

A: Try setting Environment.CurrentDirectory to the value you want.
In your case:
Environment.CurrentDirectory = "C:\\Windows";

A: Directory.SetCurrentDirectory(@"c:\program files\");


text:
Q: How can I confirm that an Outlook email chain which was forwarded to me is genuine? In this scenario, all the email activity was done with Outlook clients and MS Exchange.
I got an mail from B that includes a forwarded chain which suggests that B was authorised by C to take an action. B wants me to trust this chain as proof he was acting on something with approval. However, I am sceptical and C is adamant that he never sent B the mail that has been forwarded.
In C's email account there is no trace of a request from B, no trace of a reply from C, and no trace of any deletion. While that is not proof, there is no reason whatsoever why C needs to conceal this. I suspect that B has copied a previous approval request email for a similar event, but edited the date and time it was sent to C, hoping to cover this latest event. I fear he has also created a fake reply from C and then forwarded this all to me as "proof".
Can the email headers show that the alleged "ask-reply" chain did not really happen at the time and date that B has tried to represent? Is there any other technical indicator that will show the real provenance of B's forwarded email chain?

A: Email headers doesn't contain information about preceding mails,  so you can't prove anything.
In the future the best way is to change the process: B should always copy C when refers to his approval,  or even better: C should send his approval directly to you (keeping B in copy)

A: Unfortunately, if the email was simply forwarded, there is now way from the email itself that you can verify the chain. The headers (File -> Properties -> Internet Headers) only apply to that email.
If the email was forwarded as an attachment, then you could inspect the headers of each individual email.
You need a system outside of the email client itself to verify the chain. Best would be an email archiving solution (such as Barracuda) that records all email in a read-only format.
Failing that, you should ask the Exchange administrators. You don't specify the version of Exchange used, so here are two options

*

*MS Exchange 2010: Within the Exchange Management Console there is an option for Toolbox. In the toolbox is a tool called Tracking Log Explorer. You can use this tool to search for messages at a finer granularity, and without selecting specific mailboxes, but based on email addresses, etc. as stated by HostBits.

*MS Exchange Online: Use the Get-MessageTrackingLog PowerShell command as documented here & here.


text:
Q: With jQuery, how can I .toggle() an element from a selected position to a final position and size? I would like to let a user click a button, and have a DIV open from the center of that button and grow to fill most of the page. Here's a visual:

The final position and size I'm going for is this:
<style>
.pageframe {
    width: 95%;
    min-height: 96%;
    left: 2%;
    top: 2%;
}
</style>

I will also need to have the reverse happen: When the user clicks a "close" button, the DIV evenly shrinks back into the center of the button and disappears.
I suspect this is really simple, but I'm new to jQuery. Thanks!

A: Take a look my example, and try tweak it abit.
JS
$( "#here" ).click(function() {
  $(".child" ).toggleClass( "sink" );
});

CSS
.parent{
  padding:5px;
  background:orange;
  height:100vh;
  position:relative;
}

#here {
  position:relative;
  z-index:1000;
}

.child{
  position:absolute;
  top:50%;
  left:50%;
  bottom:50%;
  right:50%;
  background:purple;
  transition: all 0.5s ease-out;
  transform:translate(-50%,-50%) scale(0);
}

.sink{
  top:5px;
  left:5px;
  bottom:5px;
  right:5px;
  width: inherit;
  height: inherit;
  transform:translate(0%,0%) scale(1);
}

DEMO


text:
Q: LaTeX multiple URLs within the same href command I am trying to embed two URLs in the same clickable text; so after a person clicks on the text, he/she is directed to two webpages (I don't really care if this happens in two windows or two tabs). A command like:
\href{https://projecteuler.net/about;https://en.wikipedia.org/wiki/Project_Euler}{Project Euler}

Is this possible?

A: That is an interesting quest.  It is a good question with HTML alone, not to mention Latex.
Doing this with Javascript for the browser is standard fare. See this post for the simplest case by JS onclick method, or this post, or this post (for the same or other methods).

Click to open Google and Yahoo

Javascript is supported by the
hyperref package, according to the long list of accepted methods in the hyperref docs. So it may be possible to do even exactly as shown, with onclick="..." in \href{} (untested). For a demonstration of far more involved JS see this post (with insdljs package). For a possible non-JS approach using 'nested actions' via hyperref's option nextactionraw see this post.
In short, it should be quite possible to use Javascript with hyperref and then you're golden.

There is also an old trick of how to do it with HTML, see first answer in a link above
Click Here

If this still works perhaps it is possible to slip it to hyperref, which may then just do it, without JS. (See an answer in one of the links above for how to define the css class if this is of interest.)


text:
Q: KnockoutJs Updating Counters post Filter I have a number of filters:
FilterMessageTime = Filter on message time
FilterCommentTime = Filter on comment time
FilterCommentStatus = Filter on comment status
FilterExcludeWithoutComments = Filter messages without comments

And with these said filters (and their various combinations), I would like to keep a constant count of the messages filteredMessagesTimeCount and comments filteredCommentsTimeCount.
I have the following view:

                Message Time:
                <select class="Filters" id="FilterMessageTime" title='Message Time' data-max-options="1"
                        data-bind="
                        options: FilterMessageTime,
                        optionsText : 'name',
                        optionsValue: 'name',
                        value: selectedFilterMessageTime
                        "></select>

 0">

                    Comment Time:
                    <select class="Filters" id="FilterCommentTime" title='Comment Time' data-max-options="1"
                            data-bind="
                        options: FilterCommentTime,
                        optionsText : 'name',
                        optionsValue : 'name',
                        value: selectedFilterCommentTime
                        "></select>

                    Comment Status:
                    <select class="Filters" id="FilterCommentStatus" title='Status' data-max-options="1"
                            data-bind="
                        options: FilterCommentStatus,
                        optionsText : 'name',
                        optionsValue : 'name',
                        value: selectedFilterCommentStatus"></select>

                    Only show messages with comments:
                    <select class="Filters" id="FilterExcludeWithoutComments" title='Only show messages with comments' data-max-options="1"
                            data-bind="
                        options: FilterExcludeWithoutComments,
                        optionsText : 'name',
                        optionsValue : 'name',
                        value: selectedFilterExcludeWithoutComments"></select>

                    /*Message...*/

                            /*Comments...*/

                Total  message

                Total  messages

                No messages

                in the .

                Total  comment

                Total  comments

                No comments

                in the .

Accompanied by the following JS:
    self.FilterMessageTime = [
    { name: 'Any',        include: /./, exclude: null },
    { name: 'Last Hour',  include: /minutes?|hour/i,  exclude: /hours|days?|weeks?|months?/i},
    { name: 'Last Day',   include: /minutes?|hours?|day/i,   exclude: /days|weeks?|months?/i},
    { name: 'Last Week', include: /minutes?|hours?|days?|week/i, exclude: /and|weeks?|months?/i },
    { name: 'Last Month', include: /minutes?|hours?|days?|weeks?|month/i, exclude: /months/i}
];
self.FilterCommentTime = [
    { name: 'Any',       include: /./, exclude: null },
    { name: 'Last Hour', include: /minutes?|hour/i, exclude: /hours|days?|weeks?|months?/i },
    { name: 'Last Day',  include: /minutes?|hours?|day/i, exclude: /days|weeks?|months?/i },
    { name: 'Last Week', include: /minutes?|hours?|days?|week/i, exclude: /and|weeks?|months?/i },
    { name: 'Last Month',include: /minutes?|hours?|days?|weeks?|month/i, exclude: /months/i }
];
self.FilterCommentStatus = [
    { id: 4, name: 'Any' },
    { id: 2, name: 'Read' },
    { id: 3, name: 'Unread' }
];
self.FilterExcludeWithoutComments = [
    { id: 1, name: 'No' },
    { id: 2, name: 'Yes' },
];

self.selectedFilterMessageTime = ko.observable(self.FilterMessageTime[0]);
self.selectedFilterMessageTimeOption = ko.computed(function () {
    return ko.utils.arrayFirst(self.FilterMessageTime, function (item) {
        return item.name === self.selectedFilterMessageTime();
    });
});
self.selectedFilterCommentTime = ko.observable(self.FilterCommentTime[0]);
self.selectedFilterCommentTimeOption = ko.computed(function () {
    return ko.utils.arrayFirst(self.FilterCommentTime, function (item) {
        return item.name === self.selectedFilterCommentTime();
    });
});
self.selectedFilterCommentStatus = ko.observable(self.FilterCommentStatus[0]);
self.selectedFilterExcludeWithoutComments = ko.observable(self.FilterCommentStatus[0]);

    self.filteredMessagesTimeCount = ko.observable('0');
self.filteredCommentsTimeCount = ko.observable('0');
ko.bindingHandlers.updateCounters = {
    update: function (element, valueAccessor) {
        ko.utils.unwrapObservable(valueAccessor());
        self.updateMCCounters();
    }
}

self.updateMCCounters = function () {
    //Messages count
    self.filteredMessagesTimeCount($('.messageSection:visible').length);
    //Comments count
    self.filteredCommentsTimeCount($('.commentHolder:visible').length);
}

self.filteredMessagesTime = ko.pureComputed(function () {
    return self.filterMessageTime(self.selectedFilterMessageTimeOption());
});
self.filterMessageTime = function (filter) {
    var filterToReturn = ko.utils.arrayFilter(self.allMessages(), function (message) {
        var d = message.MessageDate;
        return filter.include && filter.include.test(d) &&
               !(filter.exclude && filter.exclude.test(d));
    });

    return filterToReturn;
};

self.filteredCommentsTime = function (MessageComments) {
    return self.filterCommentTime(self.selectedFilterCommentTimeOption(), MessageComments);
};
self.filterCommentTime = function (filter, MessageComments) {
    var filterToReturn = ko.utils.arrayFilter(MessageComments(), function (comment) {
        var d = comment.CommentDate;
           return filter.include && filter.include.test(d) &&
                   !(filter.exclude && filter.exclude.test(d));
    });

    return filterToReturn;
};

self.filterCommentStatus = function (CommentReadAgent) {
    if (self.selectedFilterCommentStatus() == null) {

        return true;
    }
    else if (self.selectedFilterCommentStatus() == 'Any') {
        $('.publishComment').fadeIn("slow");
        $('.commentHolder').fadeIn("slow")

        return true;
    }
    else if (self.selectedFilterCommentStatus()) {
        if (self.selectedFilterCommentStatus() == 'Read') {
            if (CommentReadAgent() == true) {
                $('.publishComment').fadeIn("slow");
                $('.commentHolder').fadeIn("slow");

                return true;
            }
            else

                return false;
        }
        else if (self.selectedFilterCommentStatus() == 'Unread') {
            if (CommentReadAgent() == false) {
                $('.publishComment').fadeIn("slow");
                $('.commentHolder').fadeIn("slow");

                return true;
            }
            else

                return false;
        }
    }
    return false;
};

self.showAllComments = function (MessageComments) {
    if (self.selectedFilterExcludeWithoutComments() == 'Yes') {
        if (self.filteredCommentsTime(MessageComments).length > 0) {
            return true;
        }
        else {
            return false;
        }
    }
    else {
        return true;
    }
};

Now, everything on the filtering and displaying side of things works great. Also when I apply either the FilterMessageTime or FilterCommentTime filters I receive a correct message and comment count.
The problem is:
When I apply the FilterExcludeWithoutComments filter, I receive an inconsistent result. I attempt to explain... the messages filteredMessagesTimeCount and comments filteredCommentsTimeCount counters will display the previously selected result fine but the current is wrong. This means if I have 4 messages and 2 comments showing,  filteredMessagesTimeCount will show 6 (I made this up) and filteredCommentsTimeCount will show 4 (I made this up)...during the NEXT filter iteration i.e. I toggle the filter again, I will then get the correct result for the previous selection i.e. filteredMessagesTimeCount = 4 and filteredCommentsTimeCount = 2.
Due to my counter being a 'dumb' CSS element counter, the state of execution is terribly important...so what I believe is happeneing is that the counter is firing before the elements have changed (been hidden).
How would I get the counter to fire after the elements have been hidden? is this completely the wrong way of doing things?
On the latter, I know I can use a pureComputed to return the filteredMessagesTimeCount, i.e.:
    self.filteredMessagesCount = ko.pureComputed(function () {
    return self.filteredMessages().length;
    });

Can I do something similar for the other three filters?
If you have made it this far I thank you, and any feedback is welcome.
:)
**Update, example of my .js setup
//Model
function Message(data) {
     var self = this;
     data = data || {};
     self.MessageComments = ko.observableArray([]);
     if (data.MessageComments) {
        var mappedComments = $.map(data.MessageComments, function (item) {     return new Comment(item); });
        self.MessageComments(mappedComments);
      }}

function viewModel() {
     var self = this;
     //As per my original post, the JS 'section'
     //goes here with the addition of how my messages are loaded updated below
self.loadMessages = function () {
    var token = $("input[name='__RequestVerificationToken']").val();
    var headers = {};
    headers['__RequestVerificationToken'] = token;
    return $.ajax({
        url: messageUrl,
        dataType: "json",
        contentType: "application/json",
        cache: false,
        type: 'GET',
        headers: headers,
        async: false,
        })
        .done(function (data) {
            var mappedMessages = $.map(data, function (dataItem) {
                return new Message(dataItem);
            });
            self.messages(mappedMessages);
        })
        .fail(function () {
            self.error('unable to load messages');
        });
}}

Update
function Message(data, commentFilterTimeDelegate) {
var self = this;
data = data || {};
self.MessageComments = ko.observableArray([]);

self.filteredCommentsTime = ko.computed(function () {
    var filter = commentFilterTimeDelegate;
    var filterToReturn = ko.utils.arrayFilter(self.MessageComments(), function (comment) {
        var d = comment.CommentDate;
        return filter.include && filter.include.test(d) &&
                !(filter.exclude && filter.exclude.test(d));
    });
    return filterToReturn;
});
if (data.MessageComments) {
    var mappedComments = $.map(data.MessageComments, function (item) { return new Comment(item); });
    self.MessageComments(mappedComments);
}}

//ViewModel Snippet
            .done(function (data) {
            var mappedMessages = $.map(data, function (dataItem) {
                //return new Message(dataItem);
                return new Message(dataItem, self.selectedFilterCommentTime());
            });
            self.messages(mappedMessages);
        })

Update
Razor

                    Comment Time:
                    <select class="Filters" id="FilterCommentTime" title='Comment Time' data-max-options="1"
                            data-bind="
                        options: FilterCommentTime,
                        optionsText : 'name',
                        optionsValue : 'name',
                        value: selectedFilterCommentTime
                        "></select>

...

JS
function Message(data, commentFilterTimeDelegate) {
...
    self.FilterCommentTime = [
    { name: 'Any', include: /./, exclude: null },
    { name: 'Last Hour', include: /minutes?|hour/i, exclude: /hours|days?|weeks?|months?/i },
    { name: 'Last Day', include: /minutes?|hours?|day/i, exclude: /days|weeks?|months?/i },
    { name: 'Last Week', include: /minutes?|hours?|days?|week/i, exclude: /and|weeks?|months?/i },
    { name: 'Last Month', include: /minutes?|hours?|days?|weeks?|month/i, exclude: /months/i }
];

self.filteredCommentsTime = ko.computed(function () {
    var test = commentFilterTimeDelegate();
    var filter = ko.utils.arrayFirst(self.FilterCommentTime, function (item) {
        return item.name === commentFilterTimeDelegate().name;
    });

    var filterToReturn = ko.utils.arrayFilter(self.MessageComments(), function (comment) {
        var d = comment.CommentDate;
        return filter.include && filter.include.test(d) &&
                !(filter.exclude && filter.exclude.test(d));
    });
    return filterToReturn;
});
}

function viewModel() {
...
    self.FilterCommentTime = [
    { name: 'Any', include: /./, exclude: null },
    { name: 'Last Hour', include: /minutes?|hour/i, exclude: /hours|days?|weeks?|months?/i },
    { name: 'Last Day', include: /minutes?|hours?|day/i, exclude: /days|weeks?|months?/i },
    { name: 'Last Week', include: /minutes?|hours?|days?|week/i, exclude: /and|weeks?|months?/i },
    { name: 'Last Month', include: /minutes?|hours?|days?|weeks?|month/i, exclude: /months/i }
];
self.selectedFilterCommentTime = ko.observable(self.FilterCommentTime[0]);
...
            .done(function (data) {
            var mappedMessages = $.map(data, function (dataItem) {
                //return new Message(dataItem);
                return new Message(dataItem, self.selectedFilterCommentTime);
            });
            self.messages(mappedMessages);
        })
...
}

A: The filtering of the comments belongs at the message level... the problem is getting the filters down that far so you can use them properly without using global variables or something awful.
For that kind of thing, I usually pass 'delegates' into my object that point to observables at the root level viewModel... This is good OO practice because the nested Message object should know nothing about the container it's held in (resist using global variables here... always tempting with JS).
Once you've got that setup, the count of messages is easy (happens right at the root). The count of total comments is the aggregate counts of all your messages.filteredMessageComments which can be done in a computed at the root by iteration.
Here's a simplified example using only text boxes (i.e. no options/dropdowns) but the same approach should apply.
** FIDDLE: **
http://jsfiddle.net/brettwgreen/mh1qax40/
** HTML: **
Name Filter: <input type="text" data-bind="value: MessageNameFilter">
Comment Filter: <input type="text" data-bind="value: MessageCommentFilter">

Message Count:

Comment Count:

JS:
var MessagesData = [
    {
    MessageName: 'Message One',
    MessageComments: [
        {Comment: 'Comment One'},
        {Comment: 'Comment Two'},
        {Comment: 'Comment Three'}
        ]
    },
    {
    MessageName: 'Message Two',
    MessageComments: [
        {Comment: 'Comment One'},
        {Comment: 'Comment Two'},
        {Comment: 'Comment Three'}
        ]
    },
    {
    MessageName: 'Message Three',
    MessageComments: [
        {Comment: 'Comment One'},
        {Comment: 'Comment Two'},
        {Comment: 'Comment Three'}
        ]
    }];

var MessageComment = function(msgComment) {
    var self = this;
    self.Comment = ko.observable(msgComment.Comment);
};

var Message = function(msg, commentFilter) {
    var self = this;
    self.MessageName = ko.observable(msg.MessageName);
    self.MessageComments = ko.observableArray();
    $.each(msg.MessageComments, function(i, m) {
        self.MessageComments.push(new MessageComment(m));
    });
    self.FilteredMessageComments = ko.computed(function() {
        var results = [];
        $.each(self.MessageComments(), function(i, mc){
            // using the injected comment filter function (an observable)
            // filter the comments accordingly
            if (mc.Comment().indexOf(commentFilter()) !== -1){
                results.push(mc);
            }
        });
        return results;
    });
};

var vm = function(messages) {
    var self = this;
    self.MessageNameFilter = ko.observable('');
    self.MessageCommentFilter = ko.observable('');
    self.Messages = ko.observableArray();
    $.each(messages, function(i, m) {
        // inject the comment filter so we can filter comments
        // inside the messages object
        self.Messages.push(new Message(m, self.MessageCommentFilter));
    });
    self.FilteredMessages = ko.computed(function() {
        var results = [];
        $.each(self.Messages(), function(i, m){
            if (m.MessageName().indexOf(self.MessageNameFilter()) !== -1){
                results.push(m);
            }
        });
        return results;
    });
    // This is easy, just count your filtered messages:
    self.FilteredMessageCount = ko.computed(function() {
        return self.FilteredMessages().length;
    });
    // For this one, iterate over the filtered messages and count
    // the filtered comments
    self.FilteredCommentCount = ko.computed(function() {
        var val = 0;
        $.each(self.FilteredMessages(), function(i, m){
            val += m.FilteredMessageComments().length;
        });
        return val;
    });

};

var vm = new vm(MessagesData);
ko.applyBindings(vm);


text:
Q: Remove from array without using index number
Possible Duplicate:
Remove item from array by value | JavaScript

How can I remove dog from the below array using Javascript. I do not want to use index
if I can avoid it but rather the word dog instead.
["cat","dog","snake"]

A: Given an array:
var arr = ["cat", "dog", "snake"];

Find its index using the indexOf function:
var idx = arr.indexOf("dog");

Remove the element from the array by splicing it:
if (idx != -1) arr.splice(idx, 1);

The resulting array will be ["cat", "snake"].
Note that if you did delete arr[idx]; instead of splicing it, arr would be ["cat", undefined, "snake"], which might not be what you want.
Source


text:
Q: Ms Access Combine Two Rows into one like this I need with MS Access Combine two rows with the same id and same date into one row like this if TimeCome > 12:01 PM
Multi Row Picture

to be
One Row Picture

Thanks

A: You can use:
Select
    ID, DateCome, UserName, Min(TimeCom) As TimeCome, Max(TimeCom) As TimeLeave
From
    YourTable
Group By
    ID, DateCome, UserName


text:
Q: Connect multiple inputs type number I need to make something like this. 6 input fields type number.
Every label has min and max. The thing is if I put red 0 - 50 then yellow can not be from 49-70 it needs to automatically increase or decrease depending on the numbers around it so it always goes one after another? I am using React.
Is there some widgets for that or a way to connect multiple number inputs?

A: If you want to support keyboard input, you will have to update the ranges in the onBlur handler on the number inputs and change the input values in onChange. Here is an example with a custom InputNumber component which hides this onBlur/onChange detail:

class InputNumber extends React.Component {
  state = {
    value: this.props.value
  }

  onChange = e => {
    this.setState({ value: +e.target.value });
  };

  onBlur = e => {
    this.props.onChange(this.state.value);
  };

  componentWillReceiveProps(nextProps) {
    if (nextProps.value !== this.state.value) {
      this.setState({ value: nextProps.value });
    }
  }

  render() {
    return <input
      type='number'
      {...this.props}
      value={this.state.value}
      onChange={this.onChange}
      onBlur={this.onBlur}
    />;
  }
}

class Demo extends React.Component {
  state = {
    ranges: [[1, 50], [51, 70], [71, 100]]
  };

  render() {
    const { rangeRed, rangeYellow, rangeGreen } = this.state;
    const controls = [
      this.range('Red Scoring Range', 'red', 0),
      this.range('Yellow Scoring Range', 'yellow', 1),
      this.range('Green Scoring Range', 'green', 2)
    ];
    return
{controls}
;
  }

  range(label, color, idx) {
    const { ranges } = this.state;
    return (

        {label}

          <InputNumber
            value={ranges[idx][0]}
            onChange={this.onChange(idx, true)}
            min={ranges[idx-1 < 0 ? 0 : idx-1][0] + 2}
            max={ranges[idx][1] - 1}
            disabled={idx === 0} />

        to

          <InputNumber
            value={ranges[idx][1]}
            onChange={this.onChange(idx, false)}
            min={ranges[idx][0] + 1}
            max={ranges[(idx+1) % ranges.length][1]-2}
            disabled={idx === ranges.length-1} />

    );
  }

  onChange = (idx, isMin) => v => {
    const ranges = [...this.state.ranges];
    const min = isMin ? ranges[idx-1 < 0 ? 0 : idx-1][0] + 2 : ranges[idx][0] + 1;
    const max = isMin ? ranges[idx][1] - 1 : ranges[(idx+1) % ranges.length][1]-2;
    v = Math.min(Math.max(min, v), max);
    if (!isMin && idx < ranges.length-1) {
      ranges[idx][1] = v;
      ranges[idx+1][0] = v+1;
    } else if (isMin && idx > 0) {
      ranges[idx][0] = v;
      ranges[idx-1][1] = v-1;
    }
    this.setState({ ranges });
  }
}

ReactDOM.render(<Demo />, document.getElementById('app'));
:root {
  --bullet-size: 15px;
}

* {
  color: #555;
}

.bullet {
  display: inline-block;
  height: var(--bullet-size);
  width: var(--bullet-size);
  border-radius: var(--bullet-size);
}

.red { background: red; }
.yellow { background: yellow; }
.green { background: green; }

td { padding: 5px; }

input {
  width: 50px;
  padding: 5px;
  border: solid 1px #ccc;
  border-radius: 3px;
}

If you want instantaneous range updates and do not care about keyboard input, then update the ranges directly in the onChange handler:

class Demo extends React.Component {
  state = {
    ranges: [0, 50, 70, 100]
  };

  render() {
    const { rangeRed, rangeYellow, rangeGreen } = this.state;
    const controls = [
      this.range('Red Scoring Range', 'red', 0),
      this.range('Yellow Scoring Range', 'yellow', 1),
      this.range('Green Scoring Range', 'green', 2)
    ];
    return
{controls}
;
  }

  range(label, color, idx) {
    const { ranges } = this.state;
    return (

        {label}

          <input
            type='number'
            value={ranges[idx] + 1}
            onChange={this.onChange(idx, true)}
            max={ranges[idx+1] - 1}
            disabled={idx === 0} />

        to

          <input
            type='number'
            value={ranges[idx+1]}
            onChange={this.onChange(idx+1, false)}
            min={ranges[idx] + 1}
            disabled={idx+1 === ranges.length-1} />

    );
  }

  onChange = (idx, isMin) => e => {
    const ranges = [...this.state.ranges];
    const value = isMin ? +e.target.value - 1 : +e.target.value;
    if (isMin && value > ranges[idx - 1] + 1 && value < ranges[idx + 1] + 1)
      ranges[idx] = value;
    if (!isMin && value < ranges[idx + 1] - 1 && value > ranges[idx - 1] + 1)
      ranges[idx] = value;
    this.setState({ ranges });
  };
}

ReactDOM.render(<Demo />, document.getElementById('app'));
:root {
  --bullet-size: 15px;
}

* {
  color: #555;
}

.bullet {
  display: inline-block;
  height: var(--bullet-size);
  width: var(--bullet-size);
  border-radius: var(--bullet-size);
}

.red { background: red; }
.yellow { background: yellow; }
.green { background: green; }

td { padding: 5px; }

input {
  width: 50px;
  padding: 5px;
  border: none;
  border:solid 1px #ccc;
  border-radius: 3px;
}

A: You can dinamically set the values of your input in the state and trigger an event to change these attribute depending on wich label change.
After you set the min and max by the previous or next input value
For exemple :
class YouClass extends React.Component {

  constructor(props){
     super(props)
    this.state = {
     redMaxValue: 50,
     yellowMinValue: 51,
     yellowMaxValue: 70,
     greenMinValue: 71,
   }
 }

 onChangeMaxRed = e =>{
    this.setState({redMaxValue : e.target.value});

    if(e.target.value >= this.state.yellowMinValue){
      this.setState({yellowMinValue: e.target.value +1});
    }
 }

render(){

 return(){

   <input type="number" value="0" disabled />
   <input type="number" value={this.state.redMaxValue} min="1" max={this.state.yellowMinValue} onChange={this.onChangeMaxRed} />

  <input type="number" value={this.state.yellowMinValue} min={this.state.yellowMaxValue -1} max={yellowMaxValue -1} />
  <input type="number" value={this.state.yellowMaxValue}" min={this.state.yellowMinValue + 1}  max={redMinValue}/>

   <input type="number" value={this.state.greenMinValue} min={this.state.yellowMaxValue} max={99} />
    <input type="number" value="100" disabled />

 }

}

}

I didn't write all of the onChange function, i think you get the thing.
A simpler version is without min and max attributes and just values.


text:
Q: Simple file read with Scala does not work Using Scala 2.10.2------------
I am a Java engineer, and started to learn Scala from yesterday, but I got stuck now, this simply code does not work for me, but when I use java to write it, it works fine:
    package lesson4

    import scala.io.Source
    import scala.reflect.io.File

    object Test {
        def main(args: Array[String]): Unit = {
        var filePath = Source.getClass().getResource("/lesson4/test.txt")
        var file = Source.fromFile(filePath.getFile())
        var lines = file.getLines
        lines.foreach(println)
  }
}

The file is in the right path:

But the code just does not work:
Exception in thread "main" java.io.FileNotFoundException: /Users/wenjiezhang/Desktop/source_files/git_hub%20workspace/Learning%20Scala/ScalaLearning/bin/lesson4/test.txt (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:146)
    at scala.io.Source$.fromFile(Source.scala:90)
    at scala.io.Source$.fromFile(Source.scala:75)
    at scala.io.Source$.fromFile(Source.scala:53)
    at lesson4.Test$.main(Test.scala:20)
    at lesson4.Test.main(Test.scala)

A: As you can see from the error log, the path you're providing is being converted to a URL (for example SPACE becomes %20).  You should use the fromURL method Source.fromURL(Source.getClass().getResource("/lesson4/test.txt"))
scala.io.Source docs

A: You have spaces in your path converted to encoded from the URL.


text:
Q: Is there a tool for previewing both LaTeX and MetaPost files? I'm trying to find a tool for Windows that I can use to preview .tex and .mp files as they are saved. Does such a tool exist? I have TeXworks installed which has a handy build button (this displays the result in another window), but I'd rather use Emacs. Also, TeXworks does not compile .mp files.
Perhaps there's a more elegant way to preview files, other than the approach I'm thinking of.

A: Solution is to use pdflatex and Sumatra PDF, since this viewer auto-reloads the file.


text:
Q: php extension >> bug To write a PHP extension, I use >> in it but unexpectedly it goes wrong.
code:
printf("%08x ", (W[16]));
printf("%08x ", (W[16]) >> 17);
printf("%08x ", 2425545216 >> 17);

result:
9092e200 40c04849 00004849

note:
W[16]=0x9092e200 = 2425545216, In c ,the code works right. But in php extension ,>> dosen't padding 0 to the left.
php_version: PHP: 7.1.7
thank you for your help.

A: In C, the result of bitwise right shift operation on a signed integer is implementation-defined. See answers to this question, for instance.
The value 0x9092e200 can be interpreted as unsigned integer 2425545216 as well as signed integer -1869422080. For example, the following code outputs -1869422080 2425545216:
int x = 0x9092e200;
printf("%d %d",  x, (unsigned)x);

So if you want to fill the vacant bits with zeroes, cast W[16] to unsigned, e.g.:
printf("%08x ",  ((unsigned int)W[16]) >> 17);


text:
Q: lambda python dynamodb write gets timeout error I have been trying to work through my first tutorial on lambda dynamodb connections and am running into a timeout error.
In the lambda console I have the following code:
from __future__ import print_function
import json
import boto3

print('Loading function')

def lambda_handler(event, context):

    dynamodb = boto3.resource('dynamodb', region_name='us-east-1', endpoint_url="http://localhost:8000")
    print('Dynamodb loaded')
    pages_table = dynamodb.Table('Pages')
    print('Pages table referenced')

    for item in event:
        print('Item: {}'.format(item))
        response = pages_table.put_item( Item=item)
        print('Response: {}'.format(response))

    return "hi"

I have created the Pages table via the dynamodb console.
When I test run the lambda function from the lambda console, I get:
START RequestId: 4008f77f-3b3e-11e7-ad79-0713f3bd7f4e Version: $LATEST
Dynamodb loaded
Pages table referenced
Item: {'UID': 1, 'id': 1, 'label': 'Original', 'snippet': 'Style', 'type': 'item', '$$hashKey': 'object:4'}
END RequestId: 4008f77f-3b3e-11e7-ad79-0713f3bd7f4e
REPORT RequestId: 4008f77f-3b3e-11e7-ad79-0713f3bd7f4e  Duration: 3002.30 ms
Billed Duration: 3000 ms    Memory Size: 128 MB Max Memory Used: 36 MB
2017-05-17T20:20:24.159Z 4008f77f-3b3e-11e7-ad79-0713f3bd7f4e Task timed out after 3.00 seconds

My debugging print statements indicate that the very first pages_table.put_item() is where the timeout happens since there is no subsequent print of the response. (I have a few elements in my Item array for testing)
When I check my dynamodb table there is no data in the table, even days later.
I think I have accurately followed all the steps in the AWS documentation for creating a dynamodb accessible via lambda (IAM permissions, dynamodb table keys, etc), but have been stumped when searching for other instances of similar experiences with timeouts. The closest things I can find references VPC configuration, but that doesn't seem to make sense for me with this essentially default setup from the tutorials since the tutorials didn't mention VPC setup. Also, when I dug into the VPC console the settings there appeared to be default.
What am I missing?

A: The endpoint URL for DynamoDB seems to be incorrect:
endpoint_url="http://localhost:8000"

This is used only for local testing of DynamoDB. From Lambda function, the endpoint for us-east-1 needs to be:
endpoint_url="https://dynamodb.us-east-1.amazonaws.com"

As per the AWS Regions and Endpoints document.


text:
Q: insert hindi data into database in particular font(devlys) I want to insert data into MySQL table which is in Hindi. My data is in excel which has font devlys 10.of I copy and paste it in query it does not show up. But if I copy some hindi text from Google translator it takes. I Have tried to use CSV for that particular font but after import it doesn't show Hindi rather shows special characters.
For database ,table and other thing I have checked the things are set properly for utf 8 collation which works well.
If I insert data from translator it shows in Hindi . So question is how to show devlys 10 Hindi font data.?
here is my code...

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Demo - Import Excel file data in mysql database using PHP, Upload Excel file data in database</title>
<meta name="description" content="This tutorial will learn how to import excel sheet data in mysql database using php. Here, first upload an excel sheet into your server and then click to import it into database. All column of excel sheet will store into your corrosponding database table."/>
<meta name="keywords" content="import excel file data in mysql, upload ecxel file in mysql, upload data, code to import excel data in mysql database, php, Mysql, Ajax, Jquery, Javascript, download, upload, upload excel file,mysql"/>

     <?php

      define ("DB_HOST", "localhost"); // set database host
     define ("DB_USER", "root"); // set database user
     define ("DB_PASS",""); // set database password
     define ("DB_NAME","uor"); // set database name

     $link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make b
     connection.");
     $db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database");

     $databasetable = "data";

     set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');
     include 'PHPExcel/IOFactory.php';

     // This is the file path to be uploaded.
      $inputFileName = 'discussdesk.xlsx';

       try {
       $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
      } catch(Exception $e) {
        die('Error loading file
       "'.pathinfo($inputFileName,PATHINFO_BASENAME).'":
      '.$e->getMessage());
      }

     $allDataInSheet = $objPHPExcel->getActiveSheet()-
    >toArray(null,true,true,true);
     $arrayCount = count($allDataInSheet);  // Here get total count of row in
      that
      Excel sheet

     for($i=1;$i<=$arrayCount;$i++){
     $name = trim($allDataInSheet[$i]["A"]);
     $email = trim($allDataInSheet[$i]["B"]);
     //$hname = mb_detect_encoding($email);

     if($name) {
         mysql_set_charset('utf8');
     $insertTable= mysql_query("insert into data (name, email)
    values('".$name."',
    '".$email."')");

    $msg = 'Record has been added.
Go
    Back to tutorial
';
    } else {
    $msg = 'Record already exist.
Go
     Back to tutorial
';
    }
    }
    echo "
".$msg."
";

    ?>

A: What I think is Excel fonts or any other font can not be stored in db.
You only can store data only


text:
Q: Ubuntu 22.04.1 bypassing browser download settings The Ubuntu 22.04.1 update appears to be bypassing my browser download settings. I'm using Firefox 103.0.2 and have set a specific folder on an external drive under "Save files to".
Since the update all my downloads go to the Downloads folder on my C-drive instead. I have deleted the Downloads folders from Home and from Files, and when I tried downloading a file a Downloads folder was automatically created in Home and the download went into that.
When I tick "Always ask you where to save files" that function works fine; when I untick it and leave the location of my preferred save location it reverts to sending the files to the Downloads folder.


text:
Q: Java MVC - how to change view - JPanel I am creating to learn MVC in Java. I read that Java app with few JFrames is bad idea and better solution is to use JPanel. JDialog also does not solve the problem, because then I have too many of them. I have the MainFrame with a few buttons and my question is - how to change JPanels on the Frame after click on one these buttons?
I know how to change view if the View is Frame...
//ActionListener in the MainController
public void actionPerformed(ActionEvent e) {

                    TheView theView2 = new TheView(); //TheView extends JFrame
                    TheModel theModel2 = new TheModel();
                    TheController theController = new TheController(theView2,theModel2);
                    theView.setVisible(false);
                    theView2.setVisible(true);
     }

..but I have no idea, how to change only panels on the one frame?
I know, that i have to add the listener to the button in the View and then in Controller add the rest of code (like above), but what do I need to change the view in the Controller? And should I do it in MainController or in the MainFrameController?
Below is how to this app should work:

*

*At the beginning is showing up the MainFrame with visible Panel1.

*User click Button1.

*Othe same MainFrame is showing Panel2.

And so on with Panel3, 4...
Thanks for help.
EDIT: Yes, I know CardLayout and TabbedPane and I can use them, but I don't know how to apply this solution in MVC. "I just need answer how specifically should look like this piece of code with the change of the JPanel." And where should it be. In the MainController? In the MainFrameController?

A: What you could use is CardLayout or JTabbedPane. The linked tutorials should get you started.

A:
I just need answer how specifically should look like this piece of code with the change of the JPanel. I wrote that I can use CardLayout WITHOUT MVC, but I have no idea how to do it in MVC... How to apply it to the MainFrame?

Your controller and model code shouldn't care what form the view takes, whether it extends JFrame, JPanel, or (probably best) neither. Presumably in your control's actionPerformed method above, the view, model and controller have already been created and appropriately "connected". In this actionPerformed method, all you'd do would be to send a command to the model to change its state. In other words, the controller would call a method on the model that would initiate a state change. I usually have the view then respond by listening for changes to the model.
This has not yet been fully "wired", but I imagine that sample code could look something like the code below. Note that I prefer to use anonymous inner class listeners that are part of the view and that themselves call Controller methods:
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.*;
import javax.swing.event.SwingPropertyChangeSupport;

public class SimpleMVC {
    private static void createAndShowGui() {
        SmvcView view = new SmvcView();
        SmvcModel model = new SmvcModel();
        new SmvcController(view, model);

        view.setVisible(true);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> createAndShowGui());
    }
}

@SuppressWarnings("serial")
class SmvcView {
    private JPanel mainPanel = new JPanel();
    private CardLayout cardLayout = new CardLayout();
    private JPanel cardPanel = new JPanel(cardLayout);
    private ModelListener modelListener = new ModelListener();
    private SmvcController controller;
    private DefaultComboBoxModel<SmvcState> comboModel = new DefaultComboBoxModel<>(
            SmvcState.values());
    private JComboBox<SmvcState> stateCombo = new JComboBox<>(comboModel);

    public SmvcView() {
        stateCombo.setRenderer(new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(JList<?> list, Object value, int index,
                    boolean isSelected, boolean cellHasFocus) {
                DefaultListCellRenderer renderer = (DefaultListCellRenderer) super
                        .getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                SmvcState state = (SmvcState) value;
                if (state != null) {
                    value = state.getText();
                    renderer = (DefaultListCellRenderer) super.getListCellRendererComponent(list,
                            value, index, isSelected, cellHasFocus);
                }
                return renderer;
            }
        });
        stateCombo.addActionListener(evt -> {
            SmvcState state = (SmvcState) stateCombo.getSelectedItem();
            controller.setModelState(state);
        });
        JPanel comboPanel = new JPanel();
        comboPanel.add(stateCombo);

        cardPanel.add(new IntroPanel(), SmvcState.INTRO.toString());
        cardPanel.add(new MainPanel(), SmvcState.MAIN.toString());
        cardPanel.add(new MenuPanel(), SmvcState.MENU.toString());

        mainPanel.setLayout(new BorderLayout());
        mainPanel.add(cardPanel, BorderLayout.CENTER);
        mainPanel.add(comboPanel, BorderLayout.PAGE_END);

    }

    public PropertyChangeListener getModelListener() {
        return modelListener;
    }

    public void setController(SmvcController controller) {
        this.controller = controller;
    }

    public void setVisible(boolean b) {
        JFrame frame = new JFrame("Simple MVC");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(mainPanel);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }

    private class ModelListener implements PropertyChangeListener {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (SmvcModel.STATE.equals(evt.getPropertyName())) {
                SmvcState state = (SmvcState) evt.getNewValue();

                cardLayout.show(cardPanel, state.toString());
            }
        }
    }

    private class IntroPanel extends JPanel {
        public IntroPanel() {
            setPreferredSize(new Dimension(400, 300));
            setLayout(new GridBagLayout());
            add(new JLabel(SmvcState.INTRO.toString()), SwingConstants.CENTER);
            setBorder(BorderFactory.createTitledBorder(SmvcState.INTRO.toString()));
        }
    }

    private class MainPanel extends JPanel {
        public MainPanel() {
            setPreferredSize(new Dimension(400, 300));
            setLayout(new GridBagLayout());
            add(new JLabel(SmvcState.MAIN.toString()), SwingConstants.CENTER);
            setBorder(BorderFactory.createTitledBorder(SmvcState.MAIN.toString()));
        }
    }

    private class MenuPanel extends JPanel {
        public MenuPanel() {
            setPreferredSize(new Dimension(400, 300));
            setLayout(new GridBagLayout());
            add(new JLabel(SmvcState.MENU.toString()), SwingConstants.CENTER);
            setBorder(BorderFactory.createTitledBorder(SmvcState.MENU.toString()));
        }
    }

}

class SmvcController {

    private SmvcView view;
    private SmvcModel model;

    public SmvcController(SmvcView view, SmvcModel model) {
        this.view = view;
        this.model = model;
        view.setController(this);

        model.addPropertyChangeListener(view.getModelListener());
    }

    public void setModelState(SmvcState state) {
        model.setState(state);
    }

    public SmvcView getView() {
        return view;
    }

    public SmvcModel getModel() {
        return model;
    }

}

class SmvcModel {
    public static final String STATE = "state";
    private SwingPropertyChangeSupport support = new SwingPropertyChangeSupport(this);
    private SmvcState state = SmvcState.INTRO;

    public void addPropertyChangeListener(PropertyChangeListener modelListener) {
        support.addPropertyChangeListener(modelListener);
    }

    public SmvcState getState() {
        return state;
    }

    // notify listeners whenever state is changed
    public void setState(SmvcState state) {
        SmvcState oldValue = this.state;
        SmvcState newValue = state;
        this.state = state;
        support.firePropertyChange(STATE, oldValue, newValue);
    }

}

enum SmvcState {
    INTRO("Intro"), MENU("Menu"), MAIN("Main");
    private String text;

    private SmvcState(String text) {
        this.text = text;
    }

    public String getText() {
        return text;
    }
}


text:
Q: What are the efficient query for mongodb if value exist on array then don't update and return the error that id already exist I have an entry stored on my collection like this:
{
    "_id" : ObjectId("5d416c595f19962ff0680dbc"),
    "data" : {
        "a" : 6,
        "b" : [
            "5c35f04c4e92b8337885d9a6"
        ]
    },
    "image" : "123.jpg",
    "hyperlinks" : "google.com",
    "expirydate" : ISODate("2019-08-27T06:10:35.074Z"),
    "createdate" : ISODate("2019-07-31T10:24:25.311Z"),
    "lastmodified" : ISODate("2019-07-31T10:24:25.311Z"),
    "__v" : 0
},
{
    "_id" : ObjectId("5d416c595f19962ff0680dbd"),
    "data" : {
        "a" : 90,
        "b" : [
            "5c35f04c4e92b8337885d9a7"
        ]
    },
    "image" : "456.jpg",
    "hyperlinks" : "google.com",
    "expirydate" : ISODate("2019-08-27T06:10:35.074Z"),
    "createdate" : ISODate("2019-07-31T10:24:25.311Z"),
    "lastmodified" : ISODate("2019-07-31T10:24:25.311Z"),
    "__v" : 0
}

I have to write the query for push userid on b array which is under data object and increment the a counter which is also under data object.
For that, I wrote the Code i.e
db.collection.updateOne({_id: ObjectId("5d416c595f19962ff0680dbd")},
 {$inc: {'data.a': 1}, $push: {'data.b': '124sdff54f5s4fg5'}}
)

I also want to check that if that id exist on array then return the response that following id exist, so for that I wrote extra query which will check and if id exist then return the error response that following id exist,
My question is that any single query will do this? Like I don't want to write Two Queries for single task.
Any help is really appreciated for that

A: You can use the operator $addToSet to check if the element already exits in the array.
db.collection.updateOne({_id: ObjectId("5d416c595f19962ff0680dbd")},
 {$inc: {'data.a': 1}, $addToSet: {'data.b': '124sdff54f5s4fg5'}}
)

A: You can add one more check in the update query on "data.b". Following would be the query:
db.collection.updateOne(
    {
        _id: ObjectId("5d416c595f19962ff0680dbd"),
        "data.b":{
            $ne: "124sdff54f5s4fg5"
        }
    },
    {
        $inc: {'data.a': 1},
        $push: {'data.b': '124sdff54f5s4fg5'}
    }
)

For duplicate entry, you would get the following response:
{ "acknowledged" : true, "matchedCount" : 0, "modifiedCount" : 0 }

If matched count is 0, you can show the error that the id already exists.


text:
Q: Scrapy request not passing to callback when 301? I'm trying to update a database full of links to external websites, for some reason, it's skipping the callback when the request headers/website/w/e is moved/301 flag
def start_requests(self):

    #... database stuff

    for x in xrange(0, numrows):
        row = cur.fetchone()

        item = exampleItem()

        item['real_id'] = row[0]
        item['product_id'] = row[1]
        url = "http://www.example.com/a/-" + item['real_id'] + ".htm"
        log.msg("item %d request URL is %s" % (item['product_id'], url), log.INFO) # shows right
        request = scrapy.Request(url, callback=self.parse_url)
        request.meta['item'] = item
        yield request

def parse_url(self, response):
    item = response.meta['item']
    item['real_url'] = response.url
    log.msg("item %d new URL is %s" % (item['product_id'], item['real_url']), log.INFO) #doesnt even show the items that have redirected.

Scrapy version is 0.24, what can I do?
Interesting fact: It only happens with some of the broken links, even if they are from the same website with the exact same urls, etc.

A: Had to pass the dont_filter=True parameter to the Response callback function


text:
Q: How to get all sheets by openById while stand-alone I am trying to make a stand-alone script to action for another spreadsheet. It's working for the first sheet only, but it's not working for all sheets.
function doSomething(){
    var ssID = "123abc";
    var ss = SpreadsheetApp.openById(ssID);

    //var sheet = ss.getActiveSpreadsheet().getSheets(); I also
    //   tried it, but it gave an error.
    var sheet = ss.getActiveSheet();

    var range = sheet.getRangeList(['A3:A','D3:D']);
    range.setFontFamily("Arial");
    // The rest. Do something
}

I need an example to work all sheets and need work all except individual sheets.

A: If you want to loop through all the sheets and set the font for the range it can be done this way:
function doSomething(){
  var ssID = "123abc";
  var ss = SpreadsheetApp.openById(ssID);
  var sheets = ss.getSheets();
  var sheets_to_skip = ['aaa', 'bbb']; // names of the sheets you want to skip

  sheets.forEach(sheet => {
    if (!sheets_to_skip.includes(sheet.getName())) {
      var range = sheet.getRangeList(['A3:A','D3:D']);
      range.setFontFamily("Arial");
    }
  })
}


text:
Q: Unknown item label in R rules <- apriori(Day.4,parameter = list(minlen=2, supp=0.005, conf=0.8), appearance = list(rhs=c("Status=D", "Status=G"), default="lhs"), control = list(verbose=F))
rules.sorted <- sort(rules, by="lift")
inspect(rules.sorted)

I am trying to run this code, and it shows an error.

Error in asMethod(object) :    Status=D is an unknown item label,
  Status=G is an unknown item label.

What seems to be the problem? I am kind of new to R as well.
So any detailed help would be appreciated!

A: The error message says that the items Status=D and Status=G do not exist in your data. Create a transaction set first using
 trans <- as(Day.4, "transactions")
 summary(trans)
 itemLabels(trans)

Once you have the actual item names then you can use trans in the call for apriori.