text:
Q: New monitor doesn't display text the same as old monitor I've just purchased a new Samsung Syncmaster PX2370 and it doesn't seem to be displaying text the same way as my old Apple monitor. On the Apple monitor text looks a little stronger and more detailed where on the Samsung monitor text looks weaker and less readable (see below screenshot). Can anyone explain this? Are there any ways to fix it?

A: Are you driving the Samsung at its native resolution?
LCDs are particularly bad when displaying images at something other than their native resolution.
The Samsung has a resolution of 1920 x 1080. Make sure your graphics card is set to that.
Source

A: Check your screen resolution, bit depth and color format settings (under advanced).
Their ought to be something in the monitor settings of Windows or your driver Control Panel that causes this.

A: If the differences are visible in screenshots captured via software (as apposed to pictures taken of the screen) then they must be rooted in the OS, driver or application, not the hardware of the monitors.  I would begin by seeing if different driver profiles are activated by switching the monitors.


text:
Q: Change configuration of Webjob using Release Management in Visual Studio Team Services I am using Release management of Visual Studio Team Services to build my deployment pipeline.

The application is a ASP.Net MVC deployed in Azure as Webapp and also contains a WebJob module to process Queue.

To change the configuration when deploying i use Tokenization approach. MSDN link

How can change the configuration of Webjob using use Tokenization approach?

The documentation totally misses the scenario, i tried using powershell but the website didn't work either.

A: It is almost the same as the link you referred to. The "Tokenize" task in the link change the settings in the specified "web.config" file. You just need to add one more "Tokeize" task in the release definition and set the "Source filename" to the "app.config" file of your WebJob project.

redpajama_set_name: RedPajamaStackExchange


text:
Q: ReactJS - proper way to fetch data and send to another component I have a Home component, who fetch data from an API and them send the data to my modal component. In this modal component, I will use this data to fill a form.
The problem is, in my modal I can console.log the object that is coming from my Home component, but my inputs are not getting the data, they are empty.
Its like when my Home component is rendered, even though I didn't click to open my modal,
my Home component is sending the empty object to my Modal component.
I'm fairly new to React, so any tips would be appreciated.
My Home component (did some editing because the code was too big):
export default function Home() {
  const token = useSelector(state => state.auth.token)

  const [community, setCommunity] = useState([])
  const [showModalEditCommunity, setShowModalEditCommunity] = useState(false)

  function handleCloseModalEditCommunity() {
    setShowModalEditCommunity(false)
  }

  function handleShowModalEditCommunity() {
    setShowModalEditCommunity(true)
  }

  // fetching data and then saving the response into my community state
  useEffect(() => {
    const getCommunityInformations = async () => {
      const options = {
        headers: {
          Authorization: token,
        }
      }
      try {
        const result = await axios(
          "https://sandbox.herokuapp.com/community/38", options
        )
        setCommunityProducts(result.data)

      } catch (error) {
        toast.error('Failed to fetch data from the server')
      }
    }
    getCommunityInformations()
  }, [])

  return (
    <Container fluid as="section">
      <Row>
        <Col md={8}>
          <S.InviteSponsorSection>

Your community can do much more!

             <ProfileButton
                backgroundColor="#27b8fe"
                image="/icons/edit.png"
                onClick={handleShowModalEditCommunity}
              />
            // my modal and the data I'm sending
            <ModalEditCommunity
              handleCloseModal={handleCloseModalEditCommunity}
              showModal={showModalEditCommunity}
              community={community}
            />
          </S.InviteSponsorSection>
        </Col>
      </Row>
    </Container>
  )
}

My Modal component
export default function ModalEditCommunity({ handleCloseModal, showModal, community }) {

  // first two console.log gives me an empty array, because I'm in my Home component, but when
  // I click to open the modal, this console.log show the exact object that is coming from my
  // Home component, but all the inputs are empty

  console.log('community', community)

  const [name, setName] = useState(community.name)
  const [description, setDescription] = useState(community.description)
  const [facebookPage, setFacebookPage] = useState(community.facebook)

  return (
   <form onSubmit={handleSubmit(onSubmit)}>
      <TextField
         variant="outlined"
         fullWidth={true}
         name="name"
         type="text"
         value={name}
         onChange={e => setName(e.target.value)}
       />
       <TextField
         fullWidth={true}
         variant="outlined"
         name="description"
         multiline
         rows="2"
         value={description}
         onChange={e => setDescription(e.target.value)}
       />
       <TextField
         variant="outlined"
         fullWidth={true}
         name="facebookPage"
         type="text"
         value={facebookPage}
         onChange={e => setFacebookPage(e.target.value)}
        />
   </form>
  )

A: I couldn't execute your code because of too many changes to try it, but I believe the problem comes from the lifecycle.
Let's analyse the app step by step:

*

*Home loads, states are initialized, XHR call is trigerred, first render is made.
In this first render, ModalEditCommunity is already rendered, but with empty props.

*In ModalEditCommunity, first render is triggered. The component initializes its state with empty values, since the XHR call is not finished yet.

*XHR call returns. The Home component updates its state. This triggers a new render. Structures stays the same, but props change.

*In ModalEditCommunity, the state has already been initialized. Its values are the ones used in the rendering part. So it doesn't change.

How to solve it
Make sure you don't render the Modal unless you have the data. This way, at first render, the state will be initialized correctly.
Something like this:
{showModalEditCommunity && (<ModalEditCommunity
     handleCloseModal={handleCloseModalEditCommunity}
     showModal={showModalEditCommunity}
     community={community}
/>)}


text:
Q: @html.PasswordFor display text Is it possible to have a @html.PasswordFor control that has display text of black dots (discs) that doesn't have any value so doesn't save anything to the database when clicking save?
I want to be able to show the user that there is a password there but if they don't make any changes to it, it will remain the same. Can I do this without having to load the passwords on page load?
Here is an example of what I want to show. (I know it is showing stars but if possible I want to have black discs the same that normally shows in this control). The example below will actually save the value ******* to the database but I don't want this to happen unless they edit the control then all the ****** need to disappear so that they don't get added to the users password.
@Html.PasswordFor(m => m.Password, new { @Value = "********"})

A: Fill it in with a dummy value in your view model. Have a hidden input that is set to a boolean value. Once the password input is changed, changed the hidden input value to true. Then in your controller, inspect the boolean value and if it meets your condition, set the password.


text:
Q: Rails - JSON passing to controller evaluates to nil I'm trying to pass a JSON to a controller as a parameter in my Rails app, but it consistently throws errors saying that the parameter is nil.
The JSON is assembled by user input in a view, and is passed to the controller via a click on the #summary element like so:
var url = $('#summary').attr('href') + '?report={datetime:"2016-06-13 08:38:04",weather_id:"1",location_description:"home",latitude:"12",longitude:"34",accuracy:"56",wildlife:"cat",comments:"test",report_type_id:"1",wetland_feature_id:"1",wetland_number:"101"}';
$('#summary').attr('href', url);

And, after clicking #summary, the view from my console:
Started GET "/users/sign_in?report={datetime:%222016-06-13%2008:38:04%22,weather_id:%221%22,location_description:%22home%22,latitude:%2212%22,longitude:%2234%22,accuracy:%2256%22,wildlife:%22cat%22,comments:%22test%22,report_type_id:%221%22,wetland_feature_id:%221%22,wetland_number:%22101%22}" for ::1 at 2016-06-13 16:58:26 -0400
Processing by Users::SessionsController#new as HTML
Parameters: {"report"=>"{datetime:\"2016-06-13 08:38:04\",weather_id:\"1\",location_description:\"home\",latitude:\"12\",longitude:\"34\",accuracy:\"56\",wildlife:\"cat\",comments:\"test\",report_type_id:\"1\",wetland_feature_id:\"1\",wetland_number:\"101\"}"}

Finally, in the controller, I try to get the JSON back out with
@incomingReport = (params[:report])

but @incomingReport consistently evaluates to nil, for example NoMethodError (undefined method 'each' for nil:NilClass) when I tried to do @incomingReport.each.  I did some other tests as well, such as
if (params[:report]).nil?
    puts "Yep, nil"
end

which, sure enough, printed Yep, nil to my console.
I'm sure that there is something wrong with the way that I'm formatting the param in the first place, but I'm not sure what.  Any help would be much appreciated.
Editing to show more controller code
def create
    self.resource = warden.authenticate!(auth_options)

    incomingReport = params[:report]
    puts incomingReport

    sign_in(resource_name, resource)
    yield resource if block_given?
    respond_with resource, location: after_sign_in_path_for(resource)
end

private
def report_params(params)
    params.permit(:user_id, :report_type_id, :datetime, :weather_id, :location_description, :latitude, :longitude, :accuracy, :comments, :wildlife, :other_weather, :wetland_feature_id, :other_wetland_feature, :wetland_number)
end

A: if you want to access the query params use URI and CGI libraries
url    = 'http://www.foo.com?id=4&empid=6'
uri    = URI.parse(url)
params = CGI.parse(uri.query)
# params is now {"id"=>["4"], "empid"=>["6"]}

id     = params['id'].first
# id is now "4"

That said I think this is a dirty solution to the problem you have but it is what you asked for.
to allow your existing controller to access this param you can change this:
def report_params(params)
  params.permit(:user_id, :report_type_id, :datetime, :weather_id, :location_description, :latitude, :longitude, :accuracy, :comments, :wildlife, :other_weather, :wetland_feature_id, :other_wetland_feature, :wetland_number)
end

to
def report_params(params)
  params.permit(:user_id, :report_type_id, :datetime, :weather_id, :location_description, :latitude, :longitude, :accuracy, :comments, :wildlife, :other_weather, :wetland_feature_id, :other_wetland_feature, :wetland_number, :report)
end


text:
Q: pandas, how to fill a new column with the highest value of previous rows of an other column Problem to solve :

*

*When a column_A of a dataframe is filled with values which are not ordered, I would like to create a new column_B filled by the last highest previous value met in column_A. I tried to use the rolling() method, but it delivers wrong numbers compared to what I expected.

Reproductive example
A dataframe, is filled by not ordered numbers:
# creation of list of non ordered values
list_of_original_values=[100, 98, 102, 107, 94, 95, 96, 92, 150]

# creation of the dataframe
df = (
    pd.DataFrame()
    .assign(original_values = list_of_original_values)
)

# vizualisation of the dataframe
df

    original_values
0   100
1   98
2   102
3   107
4   94
5   95
6   96
7   92
8   150

Next, row after row, we check what was the highest value of the first column in the previous rows, and we fill a new column with the last of highest value from first column, row after row.
Explanation :

*

*first row: the highest value of first column for this row and previous rows, is 100. Then , we put 100 into the second colum.

*second row: the highest value of first column for this row and previous rows, are 100 and 98. The, the highest value is 100. We put 100 in the second column.

*third row: the highest value of first column for this row and previous rows, are 100, 98, 102. The, the highest value is 102. We put 102 in the second column.

*and so on ...

Then it should give :
# expected values should be this list:
list_of_expected_values=[100, 100, 102, 107, 107, 107, 107, 107, 150]

At the end, the expected dataframe should be is one:
# expected dataframe
df = (
    df.assign(expected_values = list_of_expected_values)
)

df
    original_values     expected_values
0   100                 100
1   98                  100
2   102                 102
3   107                 107
4   94                  107
5   95                  107
6   96                  107
7   92                  107
8   150                 150

I've tried to use pandas rolling() method, but the way I used it, goes to a wrong result regarding what was expected :
# trying to use rolling() and max()
df=df.assign(try_1_with_rolling = lambda df: df['original_values'].rolling(2).max())
# dataframe vizualisation :
df
    original_values     expected_values     try_1_with_rolling
0   100                 100                 NaN
1   98                  100                 100.0
2   102                 102                 102.0
3   107                 107                 107.0
4   94                  107                 107.0
5   95                  107                 95.0
6   96                  107                 96.0
7   92                  107                 96.0
8   150                 150                 150.0

the context of this problem: From censors, we receive data, but time is not ordered: there are some batches. We'd like to detect those batches which are rows coming with date lower the the last higher date met before.

A: I believe what you are looking for is cummax
df['expected_values'] = df['original_values'].cummax()


text:
Q: no one answered php imagettftext issue about unicode rendering I am having a html form text input and php script to convert that sinhala language text to an image file using imagettftext(). but some characters are not rendered properly..
I have used the very same unicode font...
this is my php script;
imagefttext($im, 11, 0, 5, 5, $black, 'iskolapotha.ttf', $POST['testinginput']);

please see this link to see the issue
can anyone help me. .!
thanks in advance ! :)

A: GD does not support Complex Text Rendering (for Arabic, Indic etc). If you need this, you will have to use a separate library, such as Pango (example).


text:
Q: Understanding of convergence in probability.
I want to study the convergence in probability when $X=0$, then $P(|X_n-X|>\epsilon)=P(|X_n|>\epsilon).$ The thing i don't understand is why is defined by this:
\begin{equation}
  =\begin{cases}
    P(X_n=1-\frac{1}{n})+P(X_n=1)=\frac{1}{n}, & \text{if $\epsilon<1-\frac{1}{n}$}.\\
    P(X_n=1)=\frac{1}{2n}, & \text{if $1-\frac{1}{n}\leq \epsilon < 1$}.\\
0, &\text{if $\epsilon\geq 1$},
  \end{cases}
\end{equation}
Why in the first one is $P(X_n=1-\frac{1}{n})+P(X_n=1)=\frac{1}{n}$ instead of $P(X_n=1-\frac{1}{n})-P(X_n=0)?$

A: If $\varepsilon < 1 - \frac{1}{n}$, then the event $\{|X_n| > \varepsilon \}$ can be seen as $\{|X_n| = 1-\frac{1}{n} \} \cup \{|X_n| = 1 \}$.
Then $\mathbb{P}(|X_n| > \varepsilon) = \mathbb{P}(|X_n| = 1-\frac{1}{n}) + \mathbb{P}(|X_n| = 1)$ since these events are disjoint.

A: This is because $$1=P(\lvert X_n\rvert >\epsilon)+P(\lvert X_n\rvert<\epsilon)=P(X_n>\epsilon)+P(X_n<\epsilon)=P(X_n>\epsilon)+P(X_n=0)$$ when $\epsilon<1-\frac{1}{n}$.
So, $$P(\lvert X_n\rvert >\epsilon)=1-P(X_n=0)=P(X_n=1-\frac{1}{n})+P(X_n=1)=\frac{1}{n}$$.
I hope this answers your question.


text:
Q: Passing multiple values in a Parameter in Informatica How to pass multiple values to a parameter and use that parameter in IN clause in Informatica for validation.
For ex:
$$DEPT_ID=20,30,40 -- Defining a parameter with multiple parameter values in param file
IN(DEPT_ID,$$DEPT_ID) -- use the same parameter in Router/Filter transformation using IN clause
Just to re-iterate this requirement is to use the parameter using IN clause in transformations, not in the SQ override.
Any pointer will be really helpful.
Thanks in advance!!

A: Assign the parameter as $$DEPT_ID=',20,30,40,50,'... so on, put additional ',' in front and back of the string as I did above.
Now let's say you want to check condition like IF EMP_DEPT_ID IN($$DEPT_ID) in router/Filter transformation then write code as below:
Step 1.In Expression::create and set a variable v_EMP_DEPT_ID=','||EMP_DEPT_ID||','
Step 2.In Router/Filter transformation :: INSTR($$DEPT_ID,v_EMP_DEPT_ID) >0


text:
Q: Compiling C code with -lcrypto but perror() prints "No such file or directory" at runtime I have just noticed this strange error: No such file or directory after compiling C code with -lcrypto and calling perror() at runtime. The code compiles fine and runs with exit code = 0 even when I SH1 hash with the crypto library.
Here is a sample code:
#include <stdio.h>
#include <openssl/sha.h>

int main(){

    perror("Test");

    return 0;
}

Compile command:
gcc -o test test.c -lcrypto
I have also tried to compile OpenSSL to my own location and link from there and I still get the same error (example: -L /usr/local/ssl/ )
I have also tried to look at the cryptlib.c file for any file being opened. (I am not sure if I am looking at the right place)
Please help me understand why is this message and how can I solve it, if possible.
I am using Linux/Fedora

strace ./trace :
execve("./test", ["./test"], 0x7ffed99e5030 /* 46 vars */) = 0
brk(NULL)                               = 0x2366000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffce623a7d0) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=59656, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 59656, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fda59df5000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libcrypto.so.1.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\300\7\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=3096376, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fda59df3000
mmap(NULL, 3071784, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fda59b05000
mmap(0x7fda59b7f000, 1761280, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7a000) = 0x7fda59b7f000
mmap(0x7fda59d2d000, 598016, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x228000) = 0x7fda59d2d000
mmap(0x7fda59dbf000, 196608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2b9000) = 0x7fda59dbf000
mmap(0x7fda59def000, 16168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fda59def000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260|\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0 \0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 48, 848) = 48
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0n<\10z\312\2339T\236K\251,E\37\369"..., 68, 896) = 68
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=3228320, ...}, AT_EMPTY_PATH) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
mmap(NULL, 1892824, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fda59936000
mprotect(0x7fda5995c000, 1679360, PROT_NONE) = 0
mmap(0x7fda5995c000, 1363968, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7fda5995c000
mmap(0x7fda59aa9000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x173000) = 0x7fda59aa9000
mmap(0x7fda59af6000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7fda59af6000
mmap(0x7fda59afc000, 33240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fda59afc000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3605\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=103184, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 102408, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fda5991c000
mprotect(0x7fda5991f000, 86016, PROT_NONE) = 0
mmap(0x7fda5991f000, 57344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fda5991f000
mmap(0x7fda5992d000, 24576, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11000) = 0x7fda5992d000
mmap(0x7fda59934000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7fda59934000
mmap(0x7fda59935000, 8, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fda59935000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\"\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=37288, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 24688, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fda59915000
mmap(0x7fda59917000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fda59917000
mmap(0x7fda59919000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7fda59919000
mmap(0x7fda5991a000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7fda5991a000
mmap(0x7fda5991b000, 112, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fda5991b000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\201\0\0\0\0\0\0"..., 832) = 832
pread64(3, "\4\0\0\0 \0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 48, 792) = 48
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0{\f\332\370x\253O\231\7\2049\330d\257p\245"..., 68, 840) = 68
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=301592, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 131472, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fda598f4000
mprotect(0x7fda598fb000, 81920, PROT_NONE) = 0
mmap(0x7fda598fb000, 61440, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fda598fb000
mmap(0x7fda5990a000, 16384, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7fda5990a000
mmap(0x7fda5990f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a000) = 0x7fda5990f000
mmap(0x7fda59911000, 12688, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fda59911000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fda598f2000
arch_prctl(ARCH_SET_FS, 0x7fda598f3480) = 0
mprotect(0x7fda59af6000, 12288, PROT_READ) = 0
mprotect(0x7fda5990f000, 4096, PROT_READ) = 0
mprotect(0x7fda5991a000, 4096, PROT_READ) = 0
mprotect(0x7fda59934000, 4096, PROT_READ) = 0
mprotect(0x7fda59dbf000, 180224, PROT_READ) = 0
mprotect(0x403000, 4096, PROT_READ)     = 0
mprotect(0x7fda59e34000, 8192, PROT_READ) = 0
munmap(0x7fda59df5000, 59656)           = 0
set_tid_address(0x7fda598f3750)         = 56899
set_robust_list(0x7fda598f3760, 24)     = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7fda598fbbb0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7fda59907a00}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7fda598fbc50, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7fda59907a00}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
openat(AT_FDCWD, "/proc/sys/crypto/fips_enabled", O_RDONLY) = 3
read(3, "0\n", 2)                       = 2
close(3)                                = 0
access("/etc/system-fips", F_OK)        = -1 ENOENT (No such file or directory)
dup(2)                                  = 3
fcntl(3, F_GETFL)                       = 0x80002 (flags O_RDWR|O_CLOEXEC)
brk(NULL)                               = 0x2366000
brk(0x2387000)                          = 0x2387000
newfstatat(3, "", {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}, AT_EMPTY_PATH) = 0
write(3, "Test: No such file or directory\n", 32Test: No such file or directory
) = 32
close(3)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++


text:
Q: How to update Meteor array element inside a document I have a Meteor Mongo document as shown below
{
    "_id" : "zFndWBZTvZPgSKXHP",
    "activityId" : "aRDABihAYFoAW7jbC",
    "activityTitle" : "Test Mongo Document",
    "users" : [
        {
            "id" : "b1@gmail.com",
            "type" : "free"
        },
                {
            "id" : "JqKvymryNaCjjKrAR",
            "type" : "free"
        },
    ],
}

I want to update a specific array element's email with custom generated id using Meteor query something like the below.
for instance, I want to update the document
if  'users.id' == "b1@gmail.com" then update it to users.id = 'SomeIDXXX'
So updated document should looks like below.
{
    "_id" : "zFndWBZTvZPgSKXHP",
    "activityId" : "aRDABihAYFoAW7jbC",
    "activityTitle" : "Test Mongo Document",
    "users" : [
        {
            "id" : "SomeIDXXX",
            "type" : "free"
        },
        {
            "id" : "JqKvymryNaCjjKrAR",
            "type" : "free"
        },

    ],
}

I have tried the below but didnt work.
 Divisions.update(
      { activityId: activityId, "users.id": emailId },
      { $set: { "users": { id: _id } } }
    );

Can someone help me with the relevant Meteor query ? Thanks !

A: Your query is actually almost right except for a small part where we want to identify the element to be updated by its index.
Divisions.update({
"activityId": "aRDABihAYFoAW7jbC",
 "users.id": "b1@gmail.com"
}, {
$set: {"users.$.id": "b2@gmail.com"}
})

A: You might need the arrayFilters option.
Divisions.update(
  { activityId: activityId },
  { $set: { "users.$[elem].id": "SomeIDXXX" } },
  { arrayFilters: [ { "elem.id": "b1@gmail.com" } ], multi: true }
);

https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/

A: You need to use the $push operator instead of $set.
{ $push: { <field1>: <value1>, ... } }


text:
Q: Как передать в объект значения атрибута другого объекта? (DOM) Хороший человек подарил мне хороший скрипт, так как в DOM и JavaScript я не силён.

Dfm (Москва)

Вопрос:
Как применить\переработать его на передачу значения атрибута объекта?
Допустим для атрибута alt?

A: Вопрос закрыт! (Оставлю. Может пригодится кому-то)
document.getElementById(event.target.id).alt

Dreamweaver сам подсказал!


text:
Q: format JSON response with \ I'm trying to format a json response as such:
[
{
    "id": "23029",
    "label": "F:\path\to\file\filename.txt",
    "value": "filename.txt"
},
{
    "id": "23030",
    "label": "F:\path\to\file\filename.txt",
    "value": "filename.txt"
},
{
    "id": "23031",
    "label": "F:\path\to\file\filename.txt",
    "value": "filename.txt"
}

]
but according to JSONLint, the \ is breaking the "structure"?  If I replace the \ with a | it works so I know the \ is the problem.  I'm using the response in jQuery's Autocomplete.
Should I be using SerializeJSON() instead?  If so, do I need to change something in the ajax autocomplete script?
$(function() {
    var cache = {},
        lastXhr;
    $( "#media" ).autocomplete({
        minLength: 2,
        source: function( request, response ) {
            var term = request.term;
            if ( term in cache ) {
                response( cache[ term ] );
                return;
            }

            lastXhr = $.getJSON( "ajax/search.cfm", request, function( data, status, xhr ) {
                cache[ term ] = data;
                if ( xhr === lastXhr ) {
                    response( data );
                }
            });
        }
    });
});

A: The \ is the escape character and needs to be escaped itself if it is part of the content.
So, the JSON string should like this before the client receives it:
[
    {
        "id": "23029",
        "label": "F:\\path\\to\\file\\filename.txt",
        "value": "filename.txt"
    },
    {
        "id": "23030",
        "label": "F:\\path\\to\\file\\filename.txt",
        "value": "filename.txt"
    },
    {
        "id": "23031",
        "label": "F:\\path\\to\\file\\filename.txt",
        "value": "filename.txt"
    }
]

A: have you tried to escape the backslash?
{
"id": "23030",
"label": "F:\\path\\to\\file\\filename.ext",
"value": "filename.txt"
}

A: While other responders have pointed out that you should be escaping the backslashes, if you were to use serializeJSON() it would take care of that escaping for you.


text:
Q: Geolocation not working correctly The following code returns in the console:
Cannot call method 'setCenter' of undefined
this.locateUser = function() {
    if(navigator && navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position) {
                var latitude = position.coords.latitude,
                    longitude = position.coords.longitude;
                var coords = google.maps.LatLng(latitude, longitude);
                self.map.setCenter(coords);
            });
    }

It looks like there is sth wrong with the coords

A: Your code block is incomplete, so I have to guess a lot here: You're accessing self.map.setCenter. The error message says "Cannot call method 'setCenter' of undefined", so while self is defined, self.map isn't. Your code doesn't include a definition of self or self.map, so the issue is likely elsewhere.
Additionally, you shouldn't declare and use self as a variable in your code, since self is never undefined (it refers to window if not declared locally). Use var that = this; instead.

A: Try like this:
 map.setCenter(new GLatLng(latitude, -longitude), 13);


text:
Q: Why are rational numbers $\sigma$-compact? I want to prove that $\mathbb{Q}^\omega$is a product of $\sigma$-compacta, but struggling. Is my reasoning correct?
My thoughts: I would just show that $\mathbb{Q}$ (with the standard topology inherited from $\mathbb{R}$ is $\sigma$-compact, which should be enough to see that $\mathbb{Q}^\omega$ is too.
However, I don´t know how to show that for $\mathbb{Q}$. ProofWiki says:

From Rational Numbers are Countably Infinite, $\mathbb{Q}$ is countable. Hence
the result from definition of Countable Space is $\sigma$-Compact.

Could anybody clarify this? Thank you.

Definition 1:  The space $\mathbb{Q}^\omega$ is defined as a set of all rational sequences endowed with the standard product topology.
Definition 2: A topological space is said to be $\sigma$-compact if it is the union of countably many compact subspaces.

A: Just use the fact that $\Bbb Q=\bigcup_{q\in\Bbb Q}\{q\}$. And also the fact that each singleton is compact.


text:
Q: Bimonads and internal categories Suppose we have a bimonad on a category C, with underlying functor B.  Can we find a bimonad that is also an internal category in [C,C], the category of endofunctors on C?
I have a specific reason for thinking this and it is described in this link
It comes down to finding a bimonad where the endofunctor preserves equalizers.
What if C is SET?  Can you find a bimonad on SET that preserves equalizers?
[Edit]
A bimonad is both a Monad and a comonad.
"There's a relationship between the monad structure and the comonad structure on B, or more exactly a mixed distributive law between them. In the terminology that some people use, this makes  into a "bimonad"."
-a quote I had on previous question


text:
Q: How can i find the current divider in the right resistor valued as "2 * R1"?

simulate this circuit – Schematic created using CircuitLab
My intention here is to find the current in the right resistor valued as "2*R1" using the current-divider formula. I don't know how to interpret the connections between these resistors.

A: Since this is a homework question you just get a hint:

simulate this circuit – Schematic created using CircuitLab
Figure 1. (a) Original schematic. (b) Rearranged schematic.
You should be able to work it out from Figure 1b.


text:
Q: Property 'storeOutputAutomatically' not valid in version 48.0 I am trying to deploy a flow to a sandbox and I am getting the error

Property 'storeOutputAutomatically' not valid in version 48.0

The sourceApiVersion specified in my sfdx-project.json file is 48.0. The <apiVersion> in our package.xml is 47.0. However, this flow has contained the <storeOutputAutomatically> tag for the last month, and has not failed validation for this sandbox. The sandbox has not been refreshed. We have not made changes to the package.xml version or the sourceApiVersion in the sfdx-project.json file in at least a month.
Also, the documentation for the storeOutputAutomatically field on the FlowActionCall metadata type says the field is available in API version 48.0 and later:

What could be causing this sudden validation failure?

A: We figured out the problem -- there was a subflow added to the flow, that had <storeOutputAutomatically>true<storeOutputAutomatically>. Prior to yesterday, the only elements that had the <storeOutputAutomatically> tag were record creates, record lookups and 'show toast' actions. We fixed the problem by checking the 'Manually assign variables' box in the parent flow that calls the subflow.
I guess storeOutputAutomatically is not yet supported for subflows.
Thank you for your quick reply and for looking into this, Mohith.

A: The package.xml version must be kept equal to the api version specified in the sourceApiVersion to make sure everything is on 48.0.
If you are still getting exception then this might be a salesforce bug that needs more investigation.
UPDATE
storeOutputAutomatically is not yet supported for subflows as per investigation.


text:
Q: ldap_bind_s returning LDAP_SUCCESS with wrong credentials I have this little problem. I want to authenticate user against LDAP (Windows Active Directory), everything works OK, but the combination (good user, good password, wrong domain).
LDAP* ldap = ldap_init(L"myserver", 389);
ULONG ldap_version = 3;

ULONG ret = LDAP_SUCCESS;

ret = ldap_set_option(ldap, LDAP_OPT_PROTOCOL_VERSION, (void*)&ldap_version);
ret = ldap_connect(ldap, NULL);

SEC_WINNT_AUTH_IDENTITY ai;
ai.Domain = (unsigned short*)BAD_DOMAIN;
ai.DomainLength = wcslen(BAD_DOMAIN);
ai.User = (unsigned short*)OK_USER;
ai.UserLength = wcslen(OK_USER);
ai.Password = (unsigned short*)OK_PASS;
ai.PasswordLength = wcslen(OK_PASS);
ai.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;

ret = ldap_bind_s(ldap, NULL, (PWCHAR) &ai, LDAP_AUTH_NTLM); // !!! HERE !!!
ret = ldap_unbind_s(ldap);

On the line marke '!!! HERE !!!' I'd expect 0x31 or any other error returned. Instead I get LDAP_SUCCESS :(
Any suggestions? Thx, Milan

A: Are you checking the return values from ldap_init(), ldap_set_option(), and ldap_connect()?
I would try using a SEC_WINNT_AUTH_IDENTITY_EX structure and filling in the version and length.
Otherwise, your code looks right to me.
It could also be falling back to anonymous access, or access as your logged-in user.
Windows can be quite "helpful" in matching domain and username strings. What are you passing for domain? Is it a plausible, but nonexistent domain string? If it violates naming rules, it could be ignored, and the user matched as if you didn't specify a username. In particular, well-known usernames like "Administrator" end up matching just about any local machine or domain.
Have you tried doing a simple query with the bound connection?
There is a weird case where a bind will succeed using an recently expired password, but then causes some operation for a subsequent bind on the same connection to fail arbitrarily. I don't think this is what you're seeing however. If you come across this odd case, I think the solution is buried in here somewhere: http://support.microsoft.com/default.aspx?scid=kb;EN-US;823659

A: Binding is successfull because the couple username/password is valid for the domain you're connected to during the ldap_init call. In this case, the domain supplied in the credentials is simply ignored.
To confirm this statment, you could try using some credentials from a trusted domain of this server. Because the user does not exist in the domain you're connected to, supplying an invalid domain name will result in a binding failure with INVALID_CREDENTIALS.
Hope that helps.


text:
Q: Will a modern processor (like the i7) follow pointers and prefetch their data while iterating over a list of them? I want to learn how to write better code that takes advantage of the CPU's cache.  Working with contiguous memory seems to be the ideal situation.  That being said, I'm curious if there are similar improvements that can be made with non-contiguous memory, but with an array of pointers to follow, like:
struct Position {
    int32_t x,y,z;
}
...
std::vector<Position*> posPointers;
...
updatePosition () {
    for (uint32_t i = 0; i < posPointers.size(); i++) {
        Position& nextPos = *posPointers[i];
        nextPos.x++;
        nextPos.y++;
        nextPos.z++;
    }
}

This is just some rough mock-up code, and for the sake of learning this properly let's just say that all Position structs were created randomly all over the heap.
Can modern, smart, processors such as Intel's i7 look ahead and see that it's going to need X_ptr's data very shortly?  Would the following line of code help?
... // for loop
Position& nextPos1 = *posPointers[i];
Position& nextPos2 = *posPointers[i+1];
Position& nextPos3 = *posPointers[i+2];
Position& nextPos4 = *posPointers[i+3];
... // Work on data here

I had read some presentation slides that seemed to indicate code like this would cause the processor to prefetch some data.  Is that true?  I am aware there are non-standard, platform specific, ways to call prefetching like __builtin_prefetch, but throwing that all over the place just seems like an ugly premature optimization.  I am looking for a way I can subconsciously write cache-efficient code.

A: I know you didn't ask (and probably don't need a sermon on proper treatment of caches, but I thought I'd contribute my two cents anyways. Note that all this only applies in hot code. Remember that premature optimization is the root of all evil.
As has been pointed out in the comments, the best way is to have containers of actual data. Generally speaking, flat data structures are much preferable to "pointer spaghetti", even if you have to duplicate some data and/or pay a price for resizing/moving/defragmenting your data structures.
And as you know, flat data structures (e.g. an array of data) only pay off if you access them linearly and sequentially most of the time.
But this strategy may not always be usable. In lieu of actual linear data, you can use other strategies like employing pool allocators, and iterating over the pools themselves, instead of over the vector holding the pointers. This of course has its own disadvantages and can be a bit more complicated.
I'm sure you know this already, but it bears mentioning again that one of the most effective techniques for getting most out of your cache is having smaller data! In the above code, if you can get away with int16_t instead of int32_t, you should definitely do so. You should pack your many bools and flags and enums into bit-fields, use indexes instead of pointers (specially on 64-bit systems,) use fixed-size hash values in your data structures instead of strings, etc.
Now, about your main question that whether the processor can follow random pointers around and bring the data into cache before they are needed. To a very limited extent, this does happen. As probably you know, modern CPUs employ a lot of tricks to increase their speed (i.e. increase their instruction retire rate.) Tricks like having a store buffer, out-of-order execution, superscalar pipelines, multiple functional units of every kind, branch prediction, etc. Most of the time, these tricks all just help the CPU to keep executing instructions, even if the current instructions have stalled or take too long to finish. For memory loads (which is the slowest thing to do, iff the data is not in the cache,) this means that the CPU should get to the instruction as soon as possible, calculate the address, and request the data from the memory controller. However, the memory controller can have only a very limited number of outstanding requests (usually two these days, but I'm not sure.) This means that even if the CPU did very sophisticated stuff to look ahead into other memory locations (e.g. the elements of your posPointers vector) and deduce that these are the addresses of new data that your code is going to need, it couldn't get very far ahead because the memory controller can have only so many requests pending.
In any case, AFAIK, I don't think that CPUs actually do that yet. Note that this is a hard case, because the addresses of your randomly distributed memory locations are themselves in memory (as opposed to being in a register or calculable from the contents of a register.) And if the CPUs did it, it wouldn't have that much of an effect anyways because of memory interface limitations.
The prefetching technique you mentioned seems valid to me and I've seen it used, but it only yields noticeable effect if your CPU has something to do while waiting for the future data to arrive. Incrementing three integers takes a lot less time than loading 12 bytes from memory (loading one cache line, actually) and therefor it won't mean much for the execution time. But if you had something worthwhile and more heavyweight to overlay on top of the memory prefetches (e.g. calculating a complex function that doesn't require data from memory!) then you could get very nice speedups. You see, the time to go through the above loop is essentially the sum of the time of all the cache misses; and you are getting the coordinate increments and the loop bookkeeping for free. So, you'd have won more if the free stuff were more valuable!

A: Modern processors have hardware prefetching mechanisms: Intel Hardware prefetcher. They infer stride access patterns to memory and prefetch memory locations that are likely to be accessed in the near future.
However in the case of totally random pointer chasing such techniques can not help. The processor does not know that the program in execution is performing pointer chasing, therefore it can not prefetch accordingly. In such cases hardware mechanisms are detrimental for performance as they would prefetch values that are not likely to be used.
The best that you can do is try to organize you data structures in memory in such a way that accesses to contiguous portions of memory are more likely.


text:
Q: XML Schema improperly validating with unique constraint I have searched SO for an answer, found responses, but the solutions don't seem to be working for me.  Below is my xml and my schema.  The idea is quite simple:  no two books can share the same isbn, but when the isbn across  two books is equal, eclipse doesn't throw me an error.
The ns prefix is uk.
<library>
    <book>
        <isbn>
            1
        </isbn>
        <title>
        Bernard Williams:  A Biography
        </title>
    </book>
    <book>
        <isbn>
            1
        </isbn>
        <title>
        Principles of Microbiopsychonomics
        </title>
    </book>
</library>

<xs:element name="root">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="library">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="book" maxOccurs="unbounded">
                            <xs:complexType>
                                <xs:sequence>
                                    <xs:element name="isbn" type="xs:integer"/>
                                    <xs:element name="title" />
                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            <xs:unique name="uniquebook">
                <xs:selector xpath="uk:library/uk:book"/>
                <xs:field xpath="isbn"/>
            </xs:unique>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>

A: You're close.  But you've got two things to clean up here.
First, put your uniqueness constraint on the scope within which you want the uniqueness to be enforced, and write the selector expression to work with that as the context node.  (In the code you show, the uniqueness constraint is in the declaration of the library element, and the selector 'uk:library/uk:book' is not going to select anything.  Either you want the ISBN to be unique within the document, or you want it unique only within a given library.  In the former case, move the declaration to the declaration of uk:root, in the latter drop the first step from the selector path.)
Second, clean up your namespaces story.  You don't show the relevant namespace declarations, so I am guessing that

*

*In the schema document, the prefix uk is bound to the target namespace of the schema.

*In the XML instance, that namespace is the default namespace.

If those aren't the case, you need either to make them the case or to follow some other story about your namespaces and follow it consistently.
Right now, the biggest inconsistency is that in your two XPath expressions you assume that the elements uk:library and uk:book will be namespace-qualified, and that the element isbn will not be namespace-qualified.  The part of your schema you show suffices to show that those cannot both be the case.  Either the schema document specifies elementFormDefault="qualified" on its xs:schema element, in which case you need to add uk: to the field path, or it specifies elementFormDefault="unqualified" (or does not specify the attribute at all), in which case you need to remove the namespace prefixes from the selector path.
If you really want library and book to be namespace-qualified and isbn to be unqualified, you need to use the form attribute on at least one of them.


text:
Q: Rspec tests for current user I am newbie to testing. Can someone help me how to test the current_user in rspec.
Example code:
Easy one:
def index
  @todos = current_user.todos
end

a bit more hard one
  def index
    @events = current_user.participating_events.includes(
           [:events_users, :participants,   :user])
  end

How can I write rspec tests for similar kind of problems.

A: Because it's an integration test, you should strive for actual login so that the spec manages the session created by the controller. You can follow the ideas on this answer, but basically you need to authenticate with a given user. But that you are already doing, so maybe the problem you are having is not clear by the question.
One thing I noticed weird on your tests is that event is checked for some tests, but I can't see where it is defined. It's like you expected it to be set by rspec in some way. If that's the case, then that might be the problem you are having. For this kind of spec, you should load objects from the db to test if they were created, so after filling the form and saving the event, before testing the result, load it from the DB with
event = Event.last

and then probe it for the values stored.
Let me know if this makes sense and if this solves your problem. Otherwise, maybe try to clarify what are you trying to accomplish or post a backtrace of any error you are having.


text:
Q: What is the best way to connect 6S lipo 22000mAh to step down converter? Can I use below step down converters with the battery below?

I will be using multiple step down converter to supply to other boards like (IntelUp_Squaredboard,motordriverboard).These are the links to my step down converter.
Step_Converter_1 , Step_Converter_2 . Let say if my board need 6A,should I buy exactly output 6A converter or 8A output converter?
Thank You All.


text:
Q: Python, create database connectors and have threads to use connectors I have a database that I connect to but queries take 30s to get back a response. I'm making about 50 queries each time I want to generate a report. This will take 25mins to get my report generated and is not ideal. The most I can currently do is use threads to execute my query in batches of 10 with 10 database connections. I'm fairly new to python so I'm having a hard time finding resources for this specific task. I'm using snowflake-connector to create connections to my database. Since the most connections I can use is 10. I know I have to create a class to handle these connections but I can't figure out the logic in Python to know when a connector is ready to be used to then attach it to a thread to execute a query on the connector. I'm not sure how to handle the main thread as it's waiting for connections to finish executing their query. Do I use sleep or wait on the main thread. Should I use a while loop on the main thread to check if the connectors are ready? Should I store these connectors as instances of a class?
If anyone has examples they can share or any resources to help me figure this out would be greatly appreciated. I'm fairly new to threading in general and coming from a Java background, my approach in Python is just using a class but I'm not sure if this approach is "pythonic"


text:
Q: Is it possible to get the function name with reflect like this? Is it possible to get the function name with reflect like this?
I am a new golang programmer,I don't know how to solve it.
The code following:
type A struct {
    Name string
}

func (this *A) Func1(name string) {
    fmt.Println(name)
}

func (this *A) Func2(name string, value string) {
    fmt.Println(name + ": " + value)
}

func main() {
    a := new(A)
    v := reflect.ValueOf(a)

    for i := 0; i < v.NumMethod(); i++ {
        method := v.Method(i)
        if method.IsValid() {
            t := reflect.TypeOf(method.Interface())
            // how to echo the function name of A: Func1,Func2
            fmt.Printf("%s  %d  %d\n", runtime.FuncForPC(method.Pointer()).Name(), t.NumIn(), t.NumOut())
        }
    }
}

A: Thanks machiel.
The answer following:
t := reflect.TypeOf(new(A))
for i := 0; i < t.NumMethod(); i++ {
    method := t.Method(i)
    fmt.Println(method.Name)
}


text:
Q: Can I erase or reformat a Linux RAID drive using Terminal on Mac Or by any other means basically. This is what diskutil list gives me.

A: The dd if=/dev/zero of=/dev/disk4 bs=1024 count=1 suggested by davidgo in the comments will only wipe the first 1024 bytes from the disk.
For a MBR partitioning, that would have been enough to completely wipe the partition table. But the text GUID_partition_scheme indicates this disk uses GPT partitioning.
A GPT partition table can be larger than 1024 bytes. And even if the primary GPT partition table has been totally wiped, there's a backup copy of it at the very end of the disk.
Nevertheless, diskutil eraseDisk should work just fine; choose the options according to what you plan to do with the disk later.


text:
Q: Show that there exists a path of class $C^1$ between $x$ and $y$
Let $H$ be an arc connectedness (a subset of $R^n$) , and both $x$ and $y$ components of $H$
Show that there exists a path of class $C^1$ between $x$ and $y$

I feel it's not true,
if we take for $H$ the graph of a function nowhere differentiable and we have $x '(t)$ somewhere in the middle of your path $t \mapsto (x (t), y (t) )$, then it bugue violently we must have $x'(u) \geq \varepsilon> 0$ on any open interval, so $x$ locally admits a differentiable inverse function, then there is nowhere differentiable on this interval. So you're required to have $x=0$, and suddenly it bugue also because $x$ is necessarily constant.

If I add $H$ is open, does it work ?

I feel the answer is yes, but I cannot prove it.
Thanks

A: When $X$ is an arbitrary topological space, there is no notion of a $C^1$-map
to $H$. Thus, I assume that $H$ is a subset of $R^n$ for some $n$ with the subspace topology. For $H$ open in $R^n$, the Weierstrass approximation theorem shows that you can approximate any continuous path in $H$ by a smooth one (with the same end-points). If $H$ is not required to be open then the answer is negative as we can take $H$ to be a planar Jordan curve of positive Hausdorff measure locally everywhere (say, Koch snowflake). Every subarc of this curve will have infinite length. Thus, there are no smooth nonconstant functions from $[0,1]$ to such $H$.
Edit. Suppose that $f: [0,1]\to R$ is  continuous function and $f_n: [0,1]\to R$
is a approximating sequence. I assume that $f(0)=a\ne b=f(1)$ and will leave you to work out the case of equality. For $a_n=f_n(0), b_n=f_n(1)$ consider affine  functions  $h_n: R\to R$
$$
h_n(a_n)=a, h_n(b_n)=b.
$$
You can write down these functions explicitly and verify that they converge (uniformly on compacts) to the identity function. Therefore, the compositions
$$
g_n=h_n\circ f_n
$$
have fixed values at $0$ and $1$ and converge uniformly to $f$.


text:
Q: Handling date in PHP in the format of DD-MON-YYYY In my project , I have used dates in DD-MON-YYYY format and stored it in the MySql table as data type = "Text"
example: 18-JUN-2013
I have used JavaScript date picker to select dates from the calendar.

Blockquote

Now, I really want to perform is:
1: To find date difference between two dates when retrieved from MySql database using PHP.
2: To Add 359 days to retrieved date and display future date.

Blockquote

Note: Date format must be DD-MON-YYYY.

A: Really you should be storing your dates as proper date types in the database, output formatting can always be controlled.  This would expose all the database tools for searching, comparing and sorting dates correctly.
However, as you don't have this you will need to use PHP's strtotime method to convert your string dates into unix timestamps which can then be used for comparisons and calculations
See the answer to this question for date differences:
How to calculate the difference between two dates using PHP?
For adding time to a date you could do:
$newDate = strtotime('18-JUN-2013 + 359 days');


text:
Q: Tomcat AJP request to normal HTTP I have a company application deployed on Tomcat 8 and another application making request to an Apache server that uses AJP ` protocol to access the application. I am new to AJP. I have created an AWS infrastructure using containers with the mentioned application (as an alternative to the described above). The problem is I want to avoid using Apache and use Amazon's ALB (application load balancer) and so far it's working, except the AJP request. The problem I am having is that when not using Apache, I do not need to use AJP anymore and I want to replace it with HTTPS. Will enabling the HTTPS connector in Tomcat do the trick? The lines in Apache configuration are:
ProxyPass               /pmaddon-a  ajp://*.*.*.*:8009/pmaddon-a
ProxyPassReverse        /pmaddon-a  ajp://*.*.*.*:8009/pmaddon-a

To sum up, if I skip the Apache server and call Tomcat directly with HTTPS (with enabled HTTPS connector of course) will it have the same result as using the AJP connector as I am now?

A: I understand what you want to do is:

*

*Access you application directly using the TOMCAT connector

*Remove the APACHE in front and its AJP communication with TOMCAT

This is possible to do, perhaps you need to adapt that other application (the one that calls apache) to point to the URL that arrives to the TOMCAT connector.
If the question is if you will have the same result:
I understand yes. AJP and HTTP both serve the same content, it's just a different protocol.
You didnt explain if you have HA therefore I did not enter that topic.

A: AJP is very similar to http/https except it is a binary protocol from Apache (Apache Jserv Protocol) but it is better performant since it size is almost 1/5 of the http/https.
It is widely being used with reverse proxy web server where webserver talk to application server using AJB.
You don't need to stick with AJP if you are directly connecting to Tomcat connector


text:
Q: The Crouton library is deprecated

The developer of Crouton suggests switching to Snackbars from the Android Design Support Library. This would be a good time to update the app and the dependencies with it. For those who weren't aware, this library is a dependency of the Stack Overflow Android App.

*

*App Version: 1.0.89

*Device Manufacturer: ZTE

*Device Model: ZTE A2017U

*OS Version: 7.0 (20170128.052618)


text:
Q: ionic2 cordova File Transfer plugin time out error code 3 It seems no matter what I do on iOS my file transfer times out.  I don't have an android device to test on currently but it was working as of yesterday.  I have the file transfer plugin and whitelist installed.
Ionic Framework Version: 2.0.0-beta.8,
ionic CLI Version: 2.0.0-beta.30,
Ionic App Lib Version: 2.0.0-beta.16
Xcode version: Xcode 7.3.1
Here is my code:
upload = (image: string) : void => {
  let ft = new Transfer();
  let filename = image.substr(image.lastIndexOf('/')+1)+'.jpg';
  let options = {
    fileKey: 'file',
    fileName: filename,
    mimeType: 'image/jpeg',
    chunkedMode: false,
    headers: {
        'Content-Type' : undefined
    },
    params: {
        fileName: filename,
        apikey: "mykey"
    }
  };
  ft.upload(image, "https://api.ocr.space/parse/image", options, false)
  .then((result: any) => {
    this.success(result);
  }).catch((error: any) => {
    this.failed(error);
  });
}

It times out everytime and gives this result:
[6311:2681244] -[CDVFileTransfer requestForUploadCommand:fileData:]

[Line 224] fileData length: 68706

[6311:2682532] FileTransferError {
    body = "";
    code = 3;
    "http_status" = 0;
    source = "file:///var/mobile/Containers/Data/Application/372A03D7-653A-45D8-B59A-EA34252E4AF3/tmp/cdv_photo_006.jpg";
    target = "https://api.ocr.space/parse/image";
}

[6311:2682532] File Transfer Error: The request timed out.

A: As for iOS 9 and above, you need to add AppTransportSecurity in XCode before you publish to allow connection with HTTP.
At XCode, add some key in info.plist. The steps I followed are:

*

*Opened my Projects info.plist file

*Added a Key called NSAppTransportSecurity as a Dictionary.

*Added a Subkey called NSAllowsArbitraryLoads as Boolean and set its value to YES. Or change info.plist with code as below:

You need to change yourserver.com with your own URL for file transfer
<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>yourserver.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>

A: It appears to have been an issue with the endpoint.  Here is a copy of the woking upload code for anyone looking.
upload = (image: string) : void => {
let ft = new Transfer();
let options = new FileUploadOptions();

options.fileKey="file";
options.fileName=image.substr(image.lastIndexOf('/')+1)+'.jpg';
options.mimeType="text/plain";

let params = new Object();
params.apikey = "helloworld";
options.params = params;

//ft.onProgress(this.onProgress);
ft.upload(image, "https://apifree2.ocr.space//parse/image", options, false)
.then((result: any) => {
    this.success(result);
}).catch((error: any) => {
    this.failed(error);
});

}
success = (result: any) : void => {
  console.log(result);
}
failed = (err: any) : void => {
  let code = err.code;
  alert("Failed to upload image. Code: " + code);
}


text:
Q: C++ operator overloading: call default function Is it somehow possible to call a default function each time an overloaded operator is called?
E.g., you have a class which contains a value either in meters or yards and you want to check both of them to have equal units before applying the overloaded operator. Right now I'm using a checkCompatibility()-function in every overloaded operator definition, but it would be convenient if that would happen automatically for any overloaded binary operation.

A: There is no such functionality, but Boost.Units is designed to solve problems with unit conversion (at compile time). Your function would take a quantity<length> as parameter, and the library makes sure anything that is passed in is compatible and handles the conversion of units.


text:
Q: void* to Object^ in C++/CLI I am working on wrapping a large number of .h and .lib files from native C++ to Managed C++ for eventual use as a referenced .dll in C#.
Some of the native C++ functions have a return type of void*.  I am not sure how to handle this when I pass back the value to my calling code. For instance: if a C# app calls my dll wrapper, what do I return from the native call:
void* start(ThreadFunc,void *, unsigned *);

I am currently attempting to box the return in a generic System::Object^ with no luck.  This is the call in the wrapper:
m_NativeThread->start(cb,
        GCHandle::ToIntPtr(GCHandle::Alloc(o)).ToPointer(),
        static_cast<unsigned int*>(GCHandle::ToIntPtr(GCHandle::Alloc(u)).ToPointer())));

Can anyone offer a solution?

A: If your managed code needs to see the data in the void*:

You can't cast a void* to unmanaged
  memory to a managed object reference.
  To turn this into managed memory,
  you'd have to use Marshal.Copy() or
  Marshal.PtrToStructure(). That will of
  course only work if you know the type
  of the data that the void* points to.
  source

If your managed code doesn't need to see the data in the void*:

Store it in an IntPtr if your
  managed code doesn't need to see what
  it is and just passes it back into the
  unmanaged code later on.
  source

A: Can you make it an IntPtr? What do you expect the client to do with the void*?


text:
Q: How to check invokelater is done In the code below I want to do something after invokeLater is done. 1) I can not use invokeAndWait due to setModel being called by dispatcher. 2) I can not change the value of a final variable inside thread! then how can I wait for involeLater to be done first?
 boolean isDone=false;
 SwingUtilities.invokeLater(new Runnable(){public void run(){
    setModel(new DefaultTableModel(oRecordTable, sIP_TABLE_COL_NAMES_LIST));
    isDone = true; // CAN NOT BE CHANGED HERE, AS HAS TO BE FINAL
 }});
 while (!idDone){
 //wait
 }
 // do something here after the invokeLater is done

A: You could do that using a CountDownLatch. BUT this will be exactly the same as using invokeAndWait(), blocking the current Thread, so it does not make any sense.
correct:
SwingUtilities.invokeLater(new Runnable(){public void run(){
    setModel(new DefaultTableModel(oRecordTable, sIP_TABLE_COL_NAMES_LIST));
    isDone = true; // CAN NOT BE CHANGED HERE, AS HAS TO BE FINAL

    // do something here after the invokeLater is done <=====

 }});

CountDownLatch (useless, see above)
final CountDownLatch latch = new CountDownLatch(1);

SwingUtilities.invokeLater(new Runnable(){public void run(){
    setModel(new DefaultTableModel(oRecordTable, sIP_TABLE_COL_NAMES_LIST));
    isDone = true; // CAN NOT BE CHANGED HERE, AS HAS TO BE FINAL

    latch.countDown();

 }});

latch.await(); // could use invokeAndWait as well if blocking thread here ..


text:
Q: How to setup web.config database ConnectionString for Publishing DotNetNuke from WebMatrix The article here
:: http://www.microsoft.com/web/post/how-to-publish-a-web-application-using-webmatrix
states that to publish via FTP I must "enter the connection string for the destination database" and gives examples.  It is not clear to me if I have to replace the current web.config string, or if I'm adding one.  I also don't understand if I have to mark one as a destination database.
Here is what I have thus far.  When I visit website it says "under construction".  It would be helpful to know how to get it out of that state, and also turn log error on.
<!-- this is the local connection -->
<add name="SiteSqlServer" connectionString="Data Source=.\SQLExpress;Integrated  Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;" providerName="System.Data.SqlClient" />
<!-- this is the destination db -->
<add name="myConnectionStrings" connectionString="Server=205.xxx.xxx.xxx;Database=mydbname;uid=mydbusername;pwd=mydbpasswd;" providerName="System.Data.SqlClient" />

</connectionStrings>
<appSettings>
<!-- Connection String for SQL Server 2005/2008 Express - kept for backwards compatability - legacy modules   -->
<add key="SiteSqlServer" value="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;" />
.
.
.
</appSettings>

A: I work on WebMatrix and found your post so I thought I'd provide some answers:
I'm guessing the reason you see "Under Construction" is some applications include some post-site creation configuration as part of their install. For DotNetNuke specifically it looks like you'll want to visit:
http://localhost:port/Install/InstallWizard.aspx
but you can always click the "Run" button from the ribbon after installing any app to start the configuration process if required.
As for setuping but your site publishing you shouldn't ever need to edit the web.config file. In Bakery application shown in the tutorial uses a file-based database so we're able to easily deploy the database through both Web Deploy and FTP using a simple file copy. DotNetNuke on the otherhand uses a full SQL database so we're not able to publish or download the database via FTP. There is no need to enter any additional connection strings to your app locally but you will be responsible for changing the database connection string in the web.config on the server once FTP publishing is done (as well as other settings that may have changed like the site url).
Since Web Deploy is more than just a file copying protocol if you choose Web Deploy as your publishing method we're able to actually sync your local and remote databases. You'll need to enter the connection string for the remote database server on the Publish Settings dialog along with your other connection information and you can use the Validate button to test those settings.
To view your error log you can go to the Site workspace in WebMatrix and then click on Requests in the left-hand navigation. Make sure the Capture Requests toggle in the ribbon is turned on. Additional options to tweak what is logged are also available in the ribbon.
Hope that helps,
Andrew


text:
Q: A central division algebra is not its commutator In looking at old qualifying exam questions, I've come upon a question that has me stumped.

Let $A$ be a central division algebra (of finite dimension) over a field $k$. Let $[A,A]$ be the $k$-subspace of $A$ spanned by the elements $ab-ba$ with $a, b \in A$. Show that $[A,A] \neq A$.

If $\text{char } k \nmid [A:k]$, there is a very pleasant argument at hand: fix a basis of $A$ and define $\text{tr}(r)$ to be the trace of the matrix associated to the vector space endomorphism $a \mapsto ra$. It's easily seen that $\text{tr}(ab-ba) = 0$; but by our assumption on the dimension, $\text{tr}(1) \neq 0$, so that $[A,A] \neq A$. This argument fails spectacularly in general. I'd like to salvage it, but I'm not convinced that's possible.
I would appreciate hints - if you give a full answer, I would appreciate it if you put it in spoiler boxes.

A: I googled the question verbatim and the first result had a solution to the problem. As it turns out, one should perhaps look at more than just StackExchange when hunting for solutions. Here's a slightly expanded version of the proof (under Problem 2 here near the start of the document):
Let $\bar k$ be the algebraic closure of $k$. Then $\bar k$ is trivially a simple division algebra over $k$. Consider $B = A \otimes_k \bar k$; there is a theorem (see, for instance, Lorenz and Levy, Algebra II, ch 29 theorem 7) that, if $A$ and $B$ are simple $k$-algebras, and at least one is central, then $A \otimes_k B$ is a simple $k$-algebra. In particular, this means that (because $A$ is central) $B$ is a simple $k$-algebra, thus a simple $\bar k$-algebra. In addition, because $A$ is finite-dimensional over $k$, so is $B$ over $\bar k$.
It is not hard to see that the only division algebra over an algebraically closed field is the field itself; so by the Artin-Wedderburn theorem $B \cong M_n(\bar k)$ for some $n$. Then $[A,A] \otimes_k \bar k = [B,B]$, and because in $M_n(\bar k),$ $[B,B]$ consists of the traceless matrices, $[B, B] \neq B$; so $[A, A] \neq A$.


text:
Q: Gitlab CI copy file to runner host My Gitlab CI generate some files from unittest resul and i need move this files to gilab runner host...
Theare are some way to copy files to my gitlab ci to another git runner?

A: All files are processed and generated in the gitlab-runner host.
Gitlab runner copies your repo and works with it on the destination host.
Job Artifacts generated are stored on gitlab and stored between executions. You can accces them from the gitlab-runner as another part of your repository.
For example:
artifact_download:
  stage: test
  script:
    - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/jobs/42/artifacts"'

Here are the docs that explain how to access them from the yml


text:
Q: Replacing multiple items in column with 0 if a statement is true filename                      ID            Ended On          Sync   Total   ToDo
2016_05_03_10_28_32_xxxx     xxxx    Tue May 3 10:29:57 2016    8     8        0

This is a line from a spreadsheet in excel in the project I am working on. How would I replace all instances of xxxx in ID column with 0 in the spreadsheet if ToDo=0. I need to do this for every row.
EDIT:
This file has about 30k lines. How do I write a formula or VBA for: If F2 = 0, to replace all appearances of the text value(B2) in column B with 0. Which then repeats for each row.
Letters represent columns(row 1)
    A                         B           C        D    E    F

2016_05_13_23_53_28_xxxx    xxxx     Fri May 13    5    8    3
2016_05_14_05_33_42_xxxx    xxxx     Sat May 14    8    8    0
2016_05_14_07_23_22_yyyy    yyyy     Sat May 14    8    8    0
2016_05_14_07_23_22_yyyy    yyyy     Sat May 14    2    8    6

A: In cell B2 put this and fill down:
=IF(F2<>0,RIGHT(A2,4),"0000")

A: Jim, Besides the formula quoted above, this code in VBA will also take care of replacing your data with zeroes:
Sub Replace()
Dim i as long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row

For i = 2 To lastrow
    If Cells(i, 2) = "xxxx" And Cells(i, 6) = 0 Then
       Cells(i, 2) = 0
    End If
Next
End Sub

A: you could use Autofilter()
Sub main()
    With Worksheets("Zeros") '<-- change "Zeros" to your actual worksheet name
        With .Range("F1", .Cells(.Rows.Count, 1).End(xlUp)) '<--| get range in columns "A:F" down to last non empty row in column "A"
            .AutoFilter Field:=6, Criteria1:=0 '<--| filter rows by column "F" (the 6th one) on value 0
            If Application.WorksheetFunction.Subtotal(103, .Cells) > 1 Then .Offset(, 1).Resize(, 1).SpecialCells(xlCellTypeVisible) = 0 '<-- if any rows filtered other than headers one then change their column "B" value to zero
        End With
        .AutoFilterMode = False '<-- remove dropdowns
    End With
End Sub

which should be much faster then looping through cells


text:
Q: Linked Image Syntax for Mediawiki I tried to add a linked image to a wiki page without luck. The HTML syntax for the linked image is below:

What's the right syntax for linked image in MediaWiki?
I am using [[File:Fielname.jpg|frame|||||link=External Link|alt=ALT|Caption]]
But I need to add CSS class to both A and IMG tag and it seems I cannot.
Thank you.

A: Create a template once Template:MyReusedImage with your image in right size, title etc.
Then reuse the template on the pages {{MyReusedImage}}


text:
Q: Position of vehicles relative to lead vehicle I have a set of vehicles (think railway) that are in a (semi)fixed formation. I know the lead vehicle and I know the GPS coordinates of the lead vehicle at any given time. Sometimes, I can rely on the on board systems on the vehicle to report the other vehicles in the set, along with the order of the vehicle. This information is not always available though, depending on the type of vehicle.
I have already got a pretty good method of determining which vehicles are travelling together. What I need to solve is in what order are they travelling, starting with the lead vehicle and working backwards.
I have limited spatial data to work with, but what I do have is vehicle number, timestamp, latitude and longitude. The data is stored in MySQL, the coordinates are stored both separate and as a Point(long, lat) for spatial indexing.
I think I'm getting close, around 80% accuracy, based on a small sample. What I am basically doing is measuring the distance from the known lead vehicle at any given timestamp to the coordinates from the other vehicles using ST_Distance_Sphere. It's pretty good, but not quite there yet.
Has anyone done anything similar before? Or does anyone have any good ideas how I can tackle this in a better way? If possible, I'd prefer to use the GIS functions in MySQL, but this isn't a prerequisite.
Here is the map of the combined GPS points for three vehicles:

This is a simple diagram of the real life situation, with vehicle 1 being accurate, 2 and 3 being known but the positions unknown:

Update 1: Clarification
I have GPS coordinates and timestamps for all vehicles. What I need is the order in which the vehicles are travelling relative to the lead vehicle.
The SQL I already have gives me the definitive lead vehicle (based on some other data) and the other vehicles that are travelling with the lead. What it doesn't give me is the ordering of the vehicles (except the lead, or position 1).


text:
Q: How can I automate forwarding an e-mail in outlook to an e-mail address that is in the original e-mail's body? I receive numerous e-mails each morning containing info that I need to forward to relevant parties. These are time sensitive information, hence the need for automating this process.
Some additional info:

*

*Sender of original email is always the same

*Recipients of forwarded emails will always be different. Relevant emails are
stated in the original email's body

*I will also need to edit the subject of the e-mail to include more text after
the original e-mail's subject title.

For example:
Original e-mail
<from: xxx@123.com>
Subject: Stackoverflow Sample Test

Main body:
Please forward this e-mail to: yyy@123.com , zzz@123.com
Please add this into subject title: DONE

Forwarded E-mail
<To: yyy@123.com ; zzz@123.com>
Subject: FW: Stackoverflow Sample Test DONE

Thanks for any help in advance!

A: The code below needs references.  Native VBA is limited; it knows nothing about MailItems or Worksheets or Documents or Tables or any other object used by an Office product.
Within the Outlook VBA Editor, click "Tools" then "References".  A long list of libraries will be displayed with a few at the top ticked.  These ticked libraries will include "Microsoft Library nn.0 Object Library".  The value for "nn" will depend on the version of Outlook you use.  It is this library that tells VBA about Folders and MailItems and all the other Outlook objects.
The code below needs references to "Microsoft Scripting Runtime" and "Microsoft ActiveX Data Objects n.n Library".  On my system, "n.n" is "6.1".  If these libraries are not ticked, scroll down the list until you find them and tick them.  Next time you click References, these libraries will be at the top of the list.
You say the emails you need to process, all have the same format. You say the data you need is held as a table.  Do you mean an Html table or a text table with non-break-spaces to align columns? Tables can look the same but be formatted in very different ways. The code below is the routine I use when I need to investigate the exact format of one or two emails.  The answer I referenced above includes the routine I use if I want to investigate lots of emails.
To use the routine below, Insert a new module without Outlook and copy the code below to it.  Select one or two of the emails you wish to process and then run InvestigateEmails(). It will create a file on your desktop named "InvestigateEmails.txt" that will contain a few properties of the selected emails.  In particular, it will contain the text and Html bodies. The control characters CR, LF and TB will have been replaced by strings but otherwise these bodies will be as they look to a VBA macro. You cannot extract the destination email addresses from the available body or bodies without knowing how they look to a VBA macro.
I said this is the routine I use to investigate one or two emails.  This is not the entire truth. My routine outputs many more properties but I have deleted all but those I thought would be useful to you. I can add more properties if I have missed something you need.
Option Explicit
Public Sub InvestigateEmails()

  ' Outputs properties of selected emails to a file.

  ' ???????  No record of when originally coded
  ' 22Oct16  Output to desktop file rather than Immediate Window.

  ' Technique for locating desktop from answer by Kyle:
  ' http://stackoverflow.com/a/17551579/973283
  ' Needs reference to "Microsoft Scripting Runtime"

  Dim Exp As Explorer
  Dim FileBody As String
  Dim Fso As FileSystemObject
  Dim ItemCrnt As MailItem
  Dim Path As String

  Path = CreateObject("WScript.Shell").specialfolders("Desktop")

  Set Exp = Outlook.Application.ActiveExplorer

  If Exp.Selection.Count = 0 Then
    Call MsgBox("Pleaase select one or more emails then try again", vbOKOnly)
    Exit Sub
  Else
    FileBody = ""
    For Each ItemCrnt In Exp.Selection
      With ItemCrnt
        FileBody = FileBody & "From (Sender): " & .Sender & vbLf
        FileBody = FileBody & "From (Sender name): " & .SenderName & vbLf
        FileBody = FileBody & "From (Sender email address): " & _
                              .SenderEmailAddress & vbLf
        FileBody = FileBody & "Subject: " & CStr(.Subject) & vbLf
        Call OutLongText(FileBody, "Text: ", Replace(Replace(Replace(.Body, vbLf, _
                         "{lf}" & vbLf), vbCr, "{cr}"), vbTab, "{tb}"))
        Call OutLongText(FileBody, "Html: ", Replace(Replace(Replace(.HtmlBody, vbLf, _
                         "{lf}" & vbLf), vbCr, "{cr}"), vbTab, "{tb}"))
        FileBody = FileBody & "--------------------------" & vbLf
      End With
    Next
  End If

  Call PutTextFileUtf8NoBOM(Path & "\InvestigateEmails.txt", FileBody)

End Sub
Public Sub OutLongText(ByRef FileBody As String, ByVal Head As String, _
                       ByVal Text As String)

  Dim PosEnd As Long
  Dim LenOut As Long
  Dim PosStart As Long

  If Text <> "" Then
    PosStart = 1
    Do While PosStart <= Len(Text)
      PosEnd = InStr(PosStart, Text, vbLf)
      If PosEnd = 0 Or PosEnd > PosStart + 100 Then
        ' No LF in remainder of text or next 100 characters
        PosEnd = PosStart + 99
        LenOut = 100
      Else
        ' Output upto LF.  Restart output after LF
        LenOut = PosEnd - PosStart
        PosEnd = PosEnd
      End If
      If PosStart = 1 Then
        FileBody = FileBody & Head
      Else
        FileBody = FileBody & Space(Len(Head))
      End If
      FileBody = FileBody & Mid$(Text, PosStart, LenOut) & vbLf
      PosStart = PosEnd + 1
    Loop
  End If

End Sub
Public Sub PutTextFileUtf8NoBOM(ByVal PathFileName As String, ByVal FileBody As String)

  ' Outputs FileBody as a text file named PathFileName using
  ' UTF-8 encoding without leading BOM

  ' Needs reference to "Microsoft ActiveX Data Objects n.n Library"
  ' Addition to original code says version 2.5. Tested with version 6.1.

  '  1Nov16  Copied from http://stackoverflow.com/a/4461250/973283
  '          but replaced literals with parameters.
  ' 15Aug17  Discovered routine was adding an LF to the end of the file.
  '          Added code to discard that LF.
  ' 11Oct17  Posted to StackOverflow
  '  9Aug18  Comment from rellampec suggested removal of adWriteLine from
  '          WriteTest statement would avoid adding LF.
  ' 30Sep18  Amended routine to remove adWriteLine from WriteTest statement
  '          and code to remove LF from file. Successfully tested new version.

  ' References: http://stackoverflow.com/a/4461250/973283
  '             https://www.w3schools.com/asp/ado_ref_stream.asp

  Dim BinaryStream As Object
  Dim UTFStream As Object

  Set UTFStream = CreateObject("adodb.stream")

  UTFStream.Type = adTypeText
  UTFStream.Mode = adModeReadWrite
  UTFStream.Charset = "UTF-8"
  UTFStream.Open
  UTFStream.WriteText FileBody

  UTFStream.Position = 3 'skip BOM

  Set BinaryStream = CreateObject("adodb.stream")
  BinaryStream.Type = adTypeBinary
  BinaryStream.Mode = adModeReadWrite
  BinaryStream.Open

  UTFStream.CopyTo BinaryStream

  UTFStream.Flush
  UTFStream.Close
  Set UTFStream = Nothing

  BinaryStream.SaveToFile PathFileName, adSaveCreateOverWrite
  BinaryStream.Flush
  BinaryStream.Close
  Set BinaryStream = Nothing

End Sub


text:
Q: Determinant of reduced row echelon If reduced row echelon has row of zeros, then $\det(A) = 0$. I know this is True but regarding proving this, I was thinking of using cofactor expansion with respect to that row (but I am not sure how to do this) OR any other suggested method. I got this intuitively in my head but a math proof would help.

A: If we have an $n \times n$ matrix $A = (a_{ij})$, then the Laplace expansion formula for the determinant says that
$$
\det A = \sum_{i=1}^n a_{ij} C_{ij}
$$
where $C_{ij}$ is the $ij$th cofactor. There's  a specific formula for $C_{ij}$ in terms of a power of $(-1)$ and the determinant of the matrix you get by deleting the $i$th row and $j$th column of $A$. But that doesn't matter for this question. We know that we have a row of all zero's. So there is a $j$ for which $a_{ij}$ are all zero. (Maybe you need to take the tranpose, but the idea is the same.) So when we do the above expansion, each term is zero.

A: Suppose you have a square matrix $A$. A row operation on $A$ is the same as multiplying on the left by an elementary row matrix $C$ ($C$ is the identity matrix after applying the same row operation on it, these are always invertible). Hence if $B$ is the row reduced version of $A$, we have that $$A = CB $$ where $C$ is a sequence $C=C_1^{-1}C_2^{-1}\cdots C_n^{-1}$ of inverses of these elementary row matrices. Therefore $$\det(A)=\det(C)\det(B) = 0$$ since $B$ has a row of zeros and so it's determinant is zero.


text:
Q: IIS UrlRewrite RewriteMap with HTTP Host condition How can I use two different RewriteMaps based on the HTTP-Host to achieve something like the following?
www.myfoo.com/test should be rewritten to /foo/test.aspx
and
www.mybar.com/test should be rewritten to /bar/test.aspx
So far I've found http://forums.iis.net/t/1177509.aspx/1 and adapted it to my needs:
<rule name="Rewrite rule1 for rewritemapFoo">
 <match url=".*"/>
 <conditions>
   <add input="{HTTP_HOST}" pattern="^www\.myfoo\.com$" />
   <add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true"/>
   <add input="{rewritemapFoo:{REQUEST_URI}}" pattern="(.+)"/>
 </conditions>
  <action type="Rewrite" url="{C:1}" appendQueryString="false"/>
</rule>

<rule name="Rewrite rule1 for rewritemapBar">
 <match url=".*"/>
 <conditions>
   <add input="{HTTP_HOST}" pattern="^www\.mybar\.com$" />
   <add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true"/>
   <add input="{rewritemapBar:{REQUEST_URI}}" pattern="(.+)"/>
 </conditions>
  <action type="Rewrite" url="{C:1}" appendQueryString="false"/>
</rule>

...

 <rewriteMap name="rewritemapFoo">
   <add key="/test" value="/foo/test.aspx"/>
 </rewriteMap>
 <rewriteMap name="rewritemapBar">
   <add key="/test" value="/bar/test.aspx"/>
 </rewriteMap>

Unfortunately, I'll only get a 404 response upon calling www.myfoo.com/test and www.mybar.com/test. Can anyone point out, what I'm missing?

A: @Jono: Yes. This is the code thats work with conditions and {HTTP_HOST}
<rule name="Rewrite rule1 for ABC">
  <match url=".*"/>
  <conditions>
    <add input="{HTTP_HOST}" pattern="^www\.abc\.de$"/>
    <add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true"/>
    <add input="{ABC:{REQUEST_URI}}" pattern="(.+)"/>
  </conditions>
  <action type="Rewrite" url="{C:1}" appendQueryString="false"/>
</rule>
<rule name="Rewrite rule2 for ABC">
  <match url=".*"/>
  <conditions>
    <add input="{HTTP_HOST}" pattern="^abc\.de$"/>
    <add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true"/>
    <add input="{ABC:{REQUEST_URI}}" pattern="(.+)"/>
  </conditions>
  <action type="Rewrite" url="{C:1}" appendQueryString="false"/>
</rule>
<rule name="Rewrite rule1 for XYZ">
  <match url=".*"/>
  <conditions>
    <add input="{HTTP_HOST}" pattern="^www\.xyz\.de$"/>
    <add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true"/>
    <add input="{XYZ:{REQUEST_URI}}" pattern="(.+)"/>
  </conditions>
  <action type="Rewrite" url="{C:1}" appendQueryString="false"/>
</rule>
<rule name="Rewrite rule2 for XYZ">
  <match url=".*"/>
  <conditions>
    <add input="{HTTP_HOST}" pattern="^xyz\.de$"/>
    <add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true"/>
    <add input="{XYZ:{REQUEST_URI}}" pattern="(.+)"/>
  </conditions>
  <action type="Rewrite" url="{C:1}" appendQueryString="false"/>
</rule>

<rewriteMap name="ABC">
  <add key="/" value="/aa/start.aspx"/>
  <add key="/foo" value="/aa/foo.aspx"/>
</rewriteMap>
<rewriteMap name="XYZ">
  <add key="/" value="/bb/start.aspx"/>
  <add key="/foo" value="/bb/foo.aspx"/>
</rewriteMap>

A: You can use Conditions for this. In conditions you have access to server variables which contains a key 'HTTP_HOST' with the value for host name.


text:
Q: customize price of the product I have a gift card application where minimum price of any gift card is already set. eg: 5$
But I want to give an option to the user so that they can add more money to their card eg: 50$. So I will charge them for 50$ now. How to add an input field so that user can add the amount from product page.

A: In order to do so, you should add a custom option as a text field and create an observer that will change the price accordingly.
How to create a custom price using an observer:
stackoverflow.com/questions/22638328/magento-add-product-to-cart-with-custom-price-using-observer

A: simply To add text box you have to create product custom option,,,from catalog>manage product
For reference Click here


text:
Q: Facebooker2 how save a new register? I am using facebooker2 (Rails 2.3. and RESTFUlL Authentication) for facebook connect functionality. In my controller I use this action:
  def create_facebook_user
    if current_facebook_user
      @user = User.find_by_fb_user_id(current_facebook_user.id.to_i)
    end
    if @user.blank?
      @facebook_user = current_facebook_user.fetch

      @user = User.new :login => @facebook_user.email, :email => @facebook_user.email, :name => @facebook_user.name
      @user.fb_user_id = @facebook_user.id.to_i
      @user.state = "active"

      if @user.save(:validate=> false)
        @user.profile = Profile.create(:benefactor_id => nil, :benefactor_invites => Setting.find_by_identifier("benefactor_invites").value.to_i)
        redirect_to :controller => "profiles", :action => "show", :id => @user.profile.id
      else
        render "new"
      end
    elsif @user.fb_user_id.nil?
      @user.update_attribute :fb_user_id, current_facebook_user.id
      redirect_to :controller => "dashboard", :url => "index"
    else
      redirect_to :controller => "dashboard", :url => "index"
    end

My problem is then assign state to user. When User use the save method @user.save(:validate => false) its don´t "jump" the validator. Also I modify a module of RESTFul Authentication "ByPassword" the method password_required but save method return false.
I post my code
Controller

    class UsersController < ApplicationController
      skip_before_filter :verify_authenticity_token, :only => :create

      before_filter :find_user,
                    :only => [:profile,
                              :destroy,
                              :edit_password, :update_password,
                              :edit_email, :update_email]

      layout 'application'
      def create_facebook_user
        if current_facebook_user
          @user = User.find_by_fb_user_id(current_facebook_user.id.to_i)
        end
        if @user.blank?
          @facebook_user = current_facebook_user.fetch

          @user = User.new :login => @facebook_user.email, :email => @facebook_user.email, :name => @facebook_user.name
          @user.fb_user_id = @facebook_user.id.to_i
          @user.state = "active"

          if @user.save(:validate=> false)
            @user.profile = Profile.create(:benefactor_id => nil, :benefactor_invites => Setting.find_by_identifier("benefactor_invites").value.to_i)
            redirect_to :controller => "profiles", :action => "show", :id => @user.profile.id
          else
            render "new"
          end
        elsif @user.fb_user_id.nil?
          @user.update_attribute :fb_user_id, current_facebook_user.id
          redirect_to :controller => "dashboard", :url => "index"
        else
          redirect_to :controller => "dashboard", :url => "index"
        end
      end

end

View (important Fragment)

        o ingresa con Facebook Connect
        <%= fb_login_and_redirect("/users/create_facebook_user") %>
        <%#= fb_login_and_redirect('/users/link_user_accounts', :perms => 'email,user_birthday') %>
        <%#= fb_login_button("window.location = '/users/link_user_accounts'") %>

USer model
require 'digest/sha1'

class User < ActiveRecord::Base
  include Authentication
  include Authentication::ByPassword
  include Authentication::ByCookieToken
  include Authorization::AasmRoles

...
end

ByPassword module
module Authentication
  module ByPassword

    # Stuff directives into including module
    def self.included(recipient)
      recipient.extend(ModelClassMethods)
      recipient.class_eval do
        include ModelInstanceMethods

        # Virtual attribute for the unencrypted password
        attr_accessor :password
        validates_presence_of :password, :message => :"user.password.blank", :if => :password_required?
        validates_presence_of :password_confirmation, :message => :"user.password_confirmation.blank", :if => :password_required?
        validates_confirmation_of :password, :message => :"user.password.confirmation", :if => :password_required?
        validates_length_of :password, :within => 5..40, :message => :"user.password.too_short", :if => :password_required?
        before_save :encrypt_password

      end
    end

    # #included directives

    #
    # Class Methods
    #
    module ModelClassMethods
      # This provides a modest increased defense against a dictionary attack if
      # your db were ever compromised, but will invalidate existing passwords.
      # See the README and the file config/initializers/site_keys.rb
      #
      # It may not be obvious, but if you set REST_AUTH_SITE_KEY to nil and
      # REST_AUTH_DIGEST_STRETCHES to 1 you'll have backwards compatibility with
      # older versions of restful-authentication.
      def password_digest(password, salt)
        digest = REST_AUTH_SITE_KEY
        REST_AUTH_DIGEST_STRETCHES.times do
          digest = secure_digest(digest, salt, password, REST_AUTH_SITE_KEY)
        end
        digest
      end
    end # class methods

    #
    # Instance Methods
    #
    module ModelInstanceMethods

      # Encrypts the password with the user salt
      def encrypt(password)
        self.class.password_digest(password, salt)
      end

      def authenticated?(password)
        crypted_password == encrypt(password)
      end

      # before filter
      def encrypt_password
        return if password.blank?
        self.salt = self.class.make_token if new_record?
        self.crypted_password = encrypt(password)
      end

      def password_required?
        if fb_user_id.blank?
          crypted_password.blank? || !password.blank?
        else
          return false
        end
      end

      def has_fb_user_id?
        fb_user_id.nil?
      end
    end # instance methods
  end
end

A: First I use save_with_validations(false) method of ActiveRecord and then I use normal save method


text:
Q: x and o in tic tac toe keeps alternating in my tic tac toe game the  x and o's keep alternating no matter where i click on my cell boxes. i tried typing return at the end of the function and it doesnt stop. i know it has something to do with the turn += 1, at the bottom but dont know how to come about it. really appreciate some advice.

let playerOne = 'x';
let playerTwo = 'o';
let turn = 0;
let lastClicked;

const gameBoard = document.querySelector('.gameBoard');

for (i = 0; i < 9; i++) {
  const gameBox = document.createElement('div');
  gameBox.classList.add('gridCellItem');
  gameBox.id = 'cell' + i;
  gameBox.addEventListener('click', clickGameBox);
  gameBoard.appendChild(gameBox);
}

function clickGameBox(event) {

  if (turn === 0) {
    event.target.innerText = playerOne;
    lastClicked = playerOne;
  } else {
    if (lastClicked === playerOne) {
      event.target.innerText = playerTwo;
      lastClicked = playerTwo;

    } else {
      event.target.innerText = playerOne;
      lastClicked = playerOne;

    }
  }
  turn += 1;

}


text:
Q: How to deploy a parachute? I have finished Assassin's Creed: Brotherhood (on the PS3) and all of the Leonardo's War Machines. He gave me parachutes. I bought a large bag but I can't figure out which button to press in order to deploy a parachute.

A: On the PS3, the key to deploy the parachute - and subsequently cut it - is the Square button: □.
On the Xbox 360, the button to open the parachute is X, while B cuts it.
You need to be jumping off an edge to successfully open the parachute.


text:
Q: Python TextBlob Package - Determines POS tag for '%' symbol but do not print it as a word I was banging my head with the python's TextBlob package that

*

*identifies sentences from paragraphs

*identifies words from sentences

*determines POS(Part of Speech) tags for those words, etc...

Everything was going well until I found out a possible issue, if I am not wrong. It is explained below with sample code snippet.
from textblob import TextBlob
sample = '''This is greater than that by 5%.''' #Sample Sentence
blob = TextBlob(sample)                         #Passing it to TextBlob package.
Words = blob.words                              #Splitting the Sentence into words.
Tags = blob.tags                                #Determining POS tag for each words in the sentence

print(Tags)
[('This', 'DT'), ('is', 'VBZ'), ('greater', 'JJR'), ('than', 'IN'), ('that', 'DT'), ('by', 'IN'), ('5', 'CD'), ('%', 'NN')]

print(Words)
['This', 'is', 'greater', 'than', 'that', 'by', '5']

As seen above, blob.tags function is treating '%' symbol as a separate word and determines POS tag as well.
Whereas blob.words function is not even printing '%' symbol either alone or together with its previous word.
I am creating a data frame with the output of both the functions. So it is not getting created due to length mismatch issue.
Here are my questions.
Is this possible issue in TextBlob package by any chance ?
And is there any way to identify '%' in the Words list ?

A: Stripping off punctuation at tokenization seems to be a conscious decision by the TextBlob devs: https://github.com/sloria/TextBlob/blob/dev/textblob/blob.py#L624
They rely on NLTK's tokenizators, which take an include_punct parameter, but I don't see a way to pass include_punct=True through TextBlob down to NLTK tokenizer.
When faced with a similar issue I've replaced interesting punctuation with a non-dictionary text constant that aims to represent it, ie: replace '%' with 'PUNCTPERCENT' before tokenizing. This way, the information that there was a percent symbol doesn't get lost.
EDIT: I stand corrected, on TextBlob initialization you can set a tokenizer, through the tokenizer argument of its __init__ method https://github.com/sloria/TextBlob/blob/dev/textblob/blob.py#L328.
So you could easily pass TextBlob a tokenizer that respects punctuation.
respectful_tokenizer = YourCustomTokenizerRepectsPunctuation()
blob = TextBlob('some text with %', tokenizer=repectful_tokenizer)

EDIT2:  I ran into this while looking at TextBlob's source: https://github.com/sloria/TextBlob/blob/dev/textblob/blob.py#L372 Notice the docstring of the words method, it says you should access the tokens property instead of the words property if you want to include punctuation.

A: Finally I have found out that NLTK is identifying the symbols properly. The code snippet for the same is given below for reference :
from nltk import word_tokenize
from nltk import pos_tag
Words = word_tokenize(sample)
Tags = pos_tag(Words)

print(Words)
['This', 'is', 'better', 'than', 'that', 'by', '5', '%']

print(Tags)
[('This', 'DT'), ('is', 'VBZ'), ('better', 'JJR'), ('than', 'IN'), ('that', 'DT'), ('by', 'IN'), ('5', 'CD'), ('%', 'NN')]