text:
Q: How to install Azure module in IBM Data Science Experience I'm trying to import Azure data into DSx. I get an error when I try to import the module. When I use the command "from azure.storage.blob import BlobService" in DSx, it tells me that there's no module with that name. Do I have to do some further setup in DSx to access this module?

A: Please install the azure package by running following command in your notebook:-
!pip install azure
then run this to import your library
from azure.storage.blob import BlobService
Please also refer to this article for different ways of installing libraries:-
http://datascience.ibm.com/docs/content/analyze-data/importing-libraries.html
Thanks,
Charles.


text:
Q: Install Lubuntu to Flash Drive How can I make a persistent install of Lubuntu on my flash drive, so I can boot from my flash drive and save changes and files?

A: Running from USB is well supported by the standard Ubuntu setup, and there are a number of tutorials out there including this one.
In case that link vanishes, the procedure is as follows:

*

*Download and burn to CD the right Ubuntu ISO

*Boot from that CD

*Plug in the target USB drive

*Run the startup disk creator (found under system/administration in the menus

*Select the target drive and CD if they are not correctly selected automatically and choose how much space to reserve for changes

*Click "make startup disk" and wait for it to finish

*Shutdown Ubuntu and reboot from the newly populated USB drive, and give it a test

Installed to a USB drive that way, anything you save goes into the block of space reserved for such changes - this includes saving documents, installing new programs & updating existing ones, and changing settings - so the changes are available next time you boot using that USB drive. Not changes will be made to your existing drives unless you explicitly mount them using the new installation.
This should work equally well whether you are using a flash-based USB stick or an external drive connected via USB as long as your machine supports booting from such media.

A: I use this approach. It is quite useful, particularly when moving between different version of linux.
I have three usb hard drives, mainly for data storage, but I also use them for linux. I reserve about 50GB at the front of each drive. 45GB for the install and 5GB for the swap.
The Ubuntu installation to external drive since 9.04 has become simple. The only thing you have to be careful with is where linux puts GRUB. You'll want it on the external drive.
To make sure this happens, you have to select that drive in the last step of the pre-install questions. On this last screen there is an advanced button, click it and select the external drive from the list.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to ignore an html element in vuejs How to prevent Vue.js from running code within the < code > tags produced by markdown? It's a Laravel 5.5 + Vue.js 2.x project with 'andreasindal/laravel-markdown' package for markdown. The code that's Vue is trying to run is actually a Laravel Blade directive and it seems that Blade itself doesn't try to process it (since I'm getting a Vue error regarding this in the console).
{{ session('notificationType') }}

I tired modifying the Parsedown.php class (which is used by 'andreasindal/laravel-markdown') to replace all the '{' with the HTML ASCII characters. The replacement did work, but Vue still processed those.

A: If you do not want Vuejs to evaluate anything inside an HTML element you can use the v-pre directive as:
<code v-pre> {{ name }} </code>

In the above example vue will ignore everything inside the tags so, the name variable won't be evaluated and everything will be rendered as is.
* more on v-pre


text:
Q: free() crashes, but only if more than a certain size of memory is allocated I have a strange problem freeing allocated memory in my mpi program:
Here is a code sample that produces the error for me:
void *out, *in;
int cnt = 2501; //if cnt<=2500: works perfectly. cnt>2500: crashes at free!

if((out = malloc(cnt * sizeof(double))) == NULL)
    MPI_Abort(MPI_COMM_WORLD, MPI_ERR_OP);
if((in = malloc(cnt * sizeof(double))) == NULL)
    MPI_Abort(MPI_COMM_WORLD, MPI_ERR_OP);

//Test data generation
//usage of MPI_Send and MPI_Reduce_local
//doing a lot of memcpy, assigning pointer synonyms to in and out, changing data to in and out

free(in);    //crashes here with "munmap_chunk(): invalid pointer"
free(out);   //and here (if above line is commented out) with "double free or corruption (!prev)"

I ran it using valgrind:
 mpirun -np 2 valgrind  --leak-check=full --show-reachable=yes  ./foo

and got the following:
==6248== Warning: ignored attempt to set SIGRT32 handler in sigaction();
==6248==          the SIGRT32 signal is used internally by Valgrind
cr_libinit.c:183 cri_init: sigaction() failed: Invalid argument

==6248== HEAP SUMMARY:
==6248==     in use at exit: 0 bytes in 0 blocks
==6248==   total heap usage: 1 allocs, 1 frees, 25 bytes allocated
==6248==
==6248== All heap blocks were freed -- no leaks are possible
==6248==
=====================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   EXIT CODE: 134

Any ideas about how to track this error down? Note that it only appears if cnt>2500!

A: If you're using GNU glibc, you can set the environment variable MALLOC_CHECK_ to 2 before running your program, to enable extra checking on memory-allocation calls—details here.

A: The message you had above,

Warning: ignored attempt to set SIGRT32 handler in sigaction(); the
  SIGRT32 signal is used internally by Valgrind cr_libinit.c:XXX
  cri_init: sigaction() failed: Invalid argument

has to do with the MPI's (mine is mpich-3.1.4-9) use of the BLCR checkpointing libraries (mine is blcr-0.8.5)
When I had no support for BLCR (run "mpiexec -info" and look at the "Checkpointing libraries available" line) Valgrind was working perfectly during my test phase.
When I recompiled my MPI for BLCR support (for Checkpointing experiments) Valgrind got heart-attack. He stopped working totally.
The bug (as the programmers say,) is very bad, because obviously the two programs use the same signalling for their interrupts to your running program, and simply they cannot do so. (In our case the BLCR for MPI got it first and now Valgrind is left walking on the air).
I will try to run two different installations of MPI to the same machine (one with blcr support and one without), and I hope I will alternate happily between Valgrind and Checkpoint.
UPDATE:
Even if Checkpoint itself was working, it was not possible to run any mpiexec parallel executables (programs that they were working before).
Mpiexec command itself, was crashing when I was USING (the compiled in) checkpointing library BLCR.
SOLUTION:
I recompiled MPI (mpich-3.1.4-9)  WITHOUT  BLCR support (I put BLCR out completely) and I installed the DMTCP checkpointing solution (dmtcp-2.4.4) that not only works transparently, but it is also faster than BLCR (you will find the benchmarks in the bibliography).
Now everything runs as intended :) and the handling of the checkpointed jobs is done properly too. In the future I will do more heavy tests of DMTCP (I will use local files that will have heavy/active IO from the parallel program).
PS. I also found out that mpich has put out completely the BLCR from their distribution (July 2016).


text:
Q: Stop Windows 7 From Automatically Adjusting Recording Device Audio Levels The most annoying thing I have found in Windows by far is when it automatically lowers the volume to the point where someone cannot hear me, just because I coughed or sneezed. It then never raises the volume, causing me to have to manually adjust the volume every couple minutes,  which is really annoying. What I am talking about is:
Windows Logo > Control Panel > Hardware and Sound > Manage Audio Devices > Recording > "device" > Levels > Microphone
It constantly lowers the volume and I wish it wouldn't. This happens when I use MSN only. How do I fix it?

A: Do you have your Skype or any other similar program on?
If yes then please shut it down or disable automatic mic level input in skype.
By default it remains on.
So it affects the mic slider of windows.
I had problem in Audacity. The line level use to go right and left. I wondered why,
but then there was intuitive spark.
I exited the skype and things became resolved


text:
Q: simple count based on foreign key produces bad result I am helpless with following situation. Let me describe my trouble by three simple queries:
SELECT count(1) FROM table WHERE fk1_id = 15;
SELECT count(1) FROM table WHERE fk2_id = 1;
SELECT count(1) FROM table WHERE fk1_id = 15 AND fk2_id = 1;

Results: 460, 2791 and... 0 (zero)
In addition to that result depends from the time. After reboot of the engine - result is non-zero, some time later - become a zero.
RESET QUERY CACHE - no impact.
FLUSH TABLES - yes, it's temporary fix a situation.
table is not locked based on SHOW ENGINE INNODB STATUS.
Engine:  5.6.26-74 Percona Mysql, table:
CREATE TABLE table (  fk1_id int(11) DEFAULT NULL,  fk2_id int(11) DEFAULT NULL,  KEY (fk1_id),  KEY (fk2_id),  CONSTRAINT c1 FOREIGN KEY (fk1_id) REFERENCES table2 (id),  CONSTRAINT c3 FOREIGN KEY (fk2_id) REFERENCES table3 (id)) ENGINE=InnoDB;

EXPLAIN of the query:
select_type: SIMPLE
type: index_merge
key: fk1_id,  fk2_id
rows: 441
Extra: Using intersect(fk1_id,  fk2_id); Using where; Using index

Workaround to produce good result is force ignoring index like in the following SQL:
SELECT count(1) FROM video IGNORE INDEX(fk1_id) WHERE fk1_id = 15 AND fk2_id = 1;

I will be grateful for the proposals how to proceed with the problem.
PS I have created schema and test data on SQL Fiddle: http://sqlfiddle.com/#!9/7727ee
Other illustration of irrelevant behavior:
SELECT count(fk1_id) FROM table WHERE fk1_id = 15 AND fk2_id = 1;
SELECT count(other_column_not_covered_by_index) FROM table WHERE fk1_id = 15 AND fk2_id = 1;

First SQL result: 0, second: 433.


text:
Q: Using reactJS is there a way to create "n" number of divs/html tags with different information on them? I'm building this site and right now i have 4 divs that do basically the same thing, but theyre being copy and pasted 4 times and just like 4 bits of information are being changed from them. is there any way using react that i can make it so its only one div and a function handles the different parameters needed for the divs? here is is a quick example.
quickExample.jsx
import React, {useRef} from "react";

function test(props) {
    animalAmount = useRef(20);
    return (

I like turtles!

there are {animalAmount.current} turtles in my house!

                <button>Click me!</button>

I like dogs!

there are {animalAmount.current} dogs in my house!

                <button>Click me!</button>

I like fish!

there are {animalAmount.current} fish in my house!

                <button>Click me!</button>

I like hippos!

there are {animalAmount.current} hippos in my house!

                <button>Click me!</button>

    );
}

export default test;

for specific reasons I cant just create a parent component and call it there and duplicate it four times, it needs to be done in this component if possible.

A: Create an array with your data, and then use map to print the divs:
const data = [
  {
    id: 'turtle-id',
    title: 'I like turtles',
    text: '...',
    // rest of needed data
  }, {
    // ...
  }
];

return (
  data.map(item => {
    return (

{item.title}

{item.text}

         <button>Click me!</button>

    );
  });
);

A: You can create an array of objects outside of component and loop through them. Something like this.
const animals = [{
 id: "turtle-id",
 title: "I like turtles!",
 defineText: (value) => `there are ${value} turtles in my house!`
}, ....]

and then in your component's return, you can do something like this.
...
return (

      {animals.map((animal) => {
        return (

{animal.title}

{animal.defineText(animalAmount.current)}

            <button>Click me!</button>

        );
      })}

  );
...

A: *

*Have a set of data describing the animals and set your state with it.

*Shift your animal containers into a new component (Animal).

*map over the animals state to create a series of Animals.

*When a button is clicked update the count value of that animal.

const { useState } = React;

// Pass in some data
function Animals({ data }) {

  // Initialise state with the data
  const [ animals, setAnimals ] = useState(data);

  // Copy the state, find the name of the
  // animal we're updating the count for from
  // the container's dataset, find the index of the
  // animal object in state, update its count value
  // and the update the state
  function handleCount(e) {
    const copy = [...animals];
    const { name } = e.target.closest('.animal').dataset;
    const index = copy.findIndex(obj => obj.name === name);
    ++copy[index].count;
    setAnimals(copy);
  }

  // `map` over the animals state
  // an return an array of Animal components
  return animals.map(animal => {
    return (
      <Animal
        animal={animal}
        handleCount={handleCount}
      />
    );
  });

}

// Animal component
function Animal({ animal, handleCount }) {
  return (

I like {animal.plural}!

There are {animal.count} {animal.plural} in my house!

      <button onClick={handleCount}>Click me!</button>

  );
}

const data = [
  { name: 'turtle', plural: 'turtles', count: 0 },
  { name: 'dog', plural: 'dogs', count: 0 },
  { name: 'fish', plural: 'fish', count: 0 },
  { name: 'hippo', plural: 'hippos', count: 0 }
];

ReactDOM.render(
  <Animals data={data} />,
  document.getElementById('react')
);


text:
Q: Legacy app and scaling in Windows 10 we have a quite old application that is based on Microsoft Access. Parts of the UI are still Microsoft Access, other parts use WinForms and the newest parts use WPF (trying to get rid of the old parts step by step).
We discovered an odd scaling problem in Windows 10 and a high DPI monitor and now I'm looking for a cure for this problem, preferrably one that's not involving changing the old UI.
To be able to work on this high DPI monitor Windows's scaling should be set to 200%.
And here's the problem: When the user logs in with the scaling set to 200% starting our application results in strings that use a too big font for the space the string is placed in. It looks like Windows increased the font size of the strings but not the dimensions of the controls containing the strings. Changing the scaling of Windows doesn't fix the problem, restarting our application after changing the scaling doesn't fix the problem.
Although... when the user logs in with the scaling set to 100% everything is fine, even when changing the scaling afterwards or restarting the application.
But we can't and won't tell our users to always set the scaling of Windows back to 100% when logging off and increasing it again when logging in.
Isn't there an other way to get around this problem?
Thanks for your help (if there is any).

A: After a little bit of googling I found a solution at least for my special problem.
Microsoft Access had a manifest file with a dpiAware node set to true. Changing that to false seems to tell Access to not use Microsoft's "intelligent" scaling and use some kind of "dumb" scaling instead. This fixed the whole problem for me.
As far as I know one can create such a manifest file for any executable to fix that problem with older applications, but I didn't try that because Access was shipped with an already existing manifest file.


text:
Q: How to set discount value in Quick Book? I am trying to apply discount value in Quick book but for some reason discount does not apply in Quickbook. Can you please guide me how can i resolve this issue?
https://github.com/ruckus/quickbooks-ruby/issues/267

Discount value code:
              discount_amount = discount_value
              discount_line_item = Quickbooks::Model::InvoiceLineItem.new
              discount_line_item.amount = discount_amount#149
              discount_line_item.discount_item! do |detail|
                detail.discount_account_id = 48
              end

Discount percentage code:

discount_line_item = Quickbooks::Model::InvoiceLineItem.new
              discount_line_item.amount = discount_percentage_value#149
              discount_line_item.discount_item! do |detail|
                detail.discount_percent = discount_percentage_value#60
                detail.percent_based = percent_based
                detail.discount_account_id = 48
end
 invoice.line_items << discount_line_item

A: I did a google search and fount this link that may be useful in solving your issue. Otherwise, there's no way we can help you; is the application timing out, is the data not being posted to quickbooks, is there an error in your log file?


text:
Q: script does not behave properly when called by acpi and udev events I have the following files in /etc/acpi/events and /etc/udev/rules.d.

*

*/etc/acpi/events/lidclose
# Pass all events to our one handler script
event=button/lid
action=/etc/acpi/monitors.sh

*/etc/udev/rules.d/80-monitor.rules
# change monitor settings when monitor is plugged in or o$
ACTION=="change", SUBSYSTEM=="drm", HOTPLUG=="1", RUN+="/etc/acpi/monitors.sh"

*Now, the (executable and owned by root) /etc/acpi/monitors.sh
#!/bin/sh

# default monitor is LVDS1
STATE=internal
INTERNAL=LVDS1
EXTERNAL=HDMI3

# functions to switch from LVDS1 to VGA and vice versa
function internal {
    echo "Switching to internal"
    xrandr --output $EXTERNAL --off --output $INTERNAL --auto
    STATE=internal
}
function external {
    echo "Switching to external"
    xrandr --output $EXTERNAL --auto --output $INTERNAL --off
    STATE=external
}
function both {
    echo "Switching to both"
    xrandr --output $EXTERNAL --auto --right-of $INTERNAL --output $INTERNAL --auto --primary
    STATE=both
}

# functions to check if VGA is connected and in use
function externalConnected {
    ! xrandr | grep "^$EXTERNAL" | grep disconnected >/dev/null
}
function lidOpen {
    ! cat /proc/acpi/button/lid/LID/state | grep closed >/dev/null
}

# actual script
if ! [ $STATE == "both" ] && externalConnected && lidOpen
then
    both
fi

if ! [ $STATE == "external" ] && externalConnected && ! lidOpen
then
    external
fi

if ! [ $STATE == "internal" ] && ! externalConnected && lidOpen
then
    internal
fi

Now, I tested the script both as root and as my user, and it worked like a charm. I also put some test output via echo bla > /home/me/test in it, and when called by udev and acpid it generated the output, so it is executed. The only thing is, that nothing happens with xrandr.
What am I missing? How could I log the output of the script to find errors?

A: With the help of the guys who commented on my question, I figured out what was wrong and fixed it in the script.
Here now the updated routines how to get automatic screen switching with your laptop to work. You need acpid, kms and udev.
Create the following rules for acpi and udev
/etc/acpi/events/lidclose
# Pass all events to our one handler script
event=button/lid
action=/etc/acpi/monitors.sh

/etc/udev/rules.d/80-monitor.rules
# change monitor settings when monitor is plugged in or o$
ACTION=="change", SUBSYSTEM=="drm", HOTPLUG=="1", RUN+="/etc/acpi/monitors.sh"

now create /etc/acpi/monitors.sh
#!/bin/sh

# specify the monitors to use
INTERNAL=LVDS1
EXTERNAL=HDMI3
USERNAME=oli

# set some variables needed to control the x server
export XAUTHORITY=/home/$USERNAME/.Xauthority
export DISPLAY=:0

# functions to switch from internal screen to external screen and vice versa or to use both screens together
function internal {
    echo "Switching to internal" >> /var/log/monitors.log
    xrandr --verbose --output $EXTERNAL --off --output $INTERNAL --auto >> /var/log/monitors.log 2>&1
}
function external {
    echo "Switching to external" >> /var/log/monitors.log
    xrandr --verbose --output $EXTERNAL --auto --output $INTERNAL --off >> /var/log/monitors.log 2>&1
}
function both {
    echo "Switching to both" >> /var/log/monitors.log
    xrandr --verbose --output $EXTERNAL --auto --right-of $INTERNAL --output $INTERNAL --auto --primary >> /var/log/monitors.log 2>&1
}

# functions to check if external monitor is connected and in use
function externalConnected {
    ! xrandr | grep "^$EXTERNAL" | grep disconnected >/dev/null
}
function lidOpen {
    ! cat /proc/acpi/button/lid/LID/state | grep closed >/dev/null
}

# actual script
if externalConnected && lidOpen
then
    both
fi

if externalConnected && ! lidOpen
then
    external
fi

if ! externalConnected && lidOpen
then
    internal
fi

And hopefully it'll work.

A: janoliver's solution worked almost fine.
One small fix that finally got this working on my system regarding the HOTPLUG variable:
/etc/udev/rules.d/80-monitor.rules:
# change monitor settings when monitor is plugged in or off
ACTION=="change", SUBSYSTEM=="drm", ENV{HOTPLUG}=="1", RUN+="/etc/acpi/monitors.sh"

i.e., change HOTPLUG to ENV{HOTPLUG}.


text:
Q: Mac OS - Installed Python 3 via Anaconda, but no feed back of which python3 As a Python beginner, I installed Python 3 via Anaconda, and have successfully installed it in my Mac laptop. I have no problem to use Python 3 if I launch Jupyter notebook, but I cannot locate it in the terminal.
Specifically, if is type in:
$ which python

I got the feedback of
/usr/bin/python

but if I type in
$ which python3

There is no feedback at all. Just curious if I have missed anything.

A: When you install a new environment with Anaconda with a specific version of Python, that version of Python will be accessible only if you activate the Anaconda's environment.
If you want to access to your python 3 of your environnement from the terminal, you need to activate it :
source activate my_env

Then you can write "which python3"
For example, on my computer, you can see two different versions of Python depending on the environnement I use or the version installed on my Mac.
// On my mac
which python3

>> /Users/michaelcaraccio/anaconda/bin/python3

Then when I activate the env :
which python3

>> /Users/michaelcaraccio/anaconda/envs/TM/bin/python3

If you need more information, don't hesitate to ask :)


text:
Q: Javascript/iframe/embed/object question OK, so here is my issue. I'm building a system which will allow people to embed lists of links on their pages. When the link is clicked, i'd like to use something like Lightview or Lightwindow to open it up over the whole window, not just in the iframe.
I don't have access to the page that the user will be embedding this object into. Everything I've tried so far tells me that I can't open anything over the parent window, since I don't have access to it from the iframe or object, javacript security issue.
However, I've seen sites that do that kind of overlay. so it must be possible. If anyone can point me to any resources that could help, that would be great.
if it matters, i'm using Ruby on Rails...
Thanks...chris

A: It can't be done if the iframe is from another domain than the website, because:

*

*You cannot change the dimensions of
the iframe from within it.

*You cannot access the parent
document from within the iframe.

I suggest trying using some sort of JS file people will embed in they're website, in the place they want your links to be (something like Google Ads) and do a document.write to place
your links in their webpage. then, you will have access to the page, and can do a whole lot more :)
is this helping you?

A: As vsync said, you will have to have the user embed a script instead of the plain HTML.
This script has full control of the page, and if you also want it to be able to communicate with the framed document (your site), then you could use something like easyxdm to do cross document communication.


text:
Q: Error when deploying Node.js on Google App Engine I got an error when trying to deploy node.js app to GAE. I noted that node.js runtime was not able to find the module that require in app.js. If I remove require statement it will be run normally.
// in app.js
var protocol = require("./protocol.js");

The deploy command like bellow:
>gcloud app deploy

After some minutes, the log show errors like:
**> nodejs-getting-started@1.0.0 start /app
> node app.js

module.js:471
    throw err;
    ^

Error: Cannot find module './app/protocol'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/app/app.js:21:16)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "start"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! nodejs-getting-started@1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodejs-getting-started@1.0.0 start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the nodejs-getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs nodejs-getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls nodejs-getting-started
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /app/npm-debug.log

Please help.**

A: Beside checking that double quotes are indeed used in var protocol = require("./protocol.js"); when usually single quotes are expected, it may be worthwhile examining the directory structure of the modules, which has to agree with the path indicated in the require call. How does your package.json look like?


text:
Q: Convolution in state space of a Markov process? This question is regarding the convolution theorem. So far, I have only used it as a tool to solve some recurrence relations. A nice example that I am familiar with is the renewal formula for finding first passage probabilities $-$ consider a continuous time Markov process on a discrete state space $\mathcal{S}$. We denote by $P(C,t|C_0)$ (where $C,C_0\in\mathcal{S}$) the probability density that the process is in state $C$ at time $t$, given that initially it was in state $C_0$. Then, we have $$P(C,t|C_0) = \int_0^t dt'~F(C,t'|C_0)P(C,t-t'|C)$$
where $F(C,t|C_0)$ denotes the probability density that, starting from $C_0$, the first visit to configuration $C$ happens at time $t$. We can define Laplace transforms of $P$ and $F$, and using convolution theorem, we get $$F(C,s|C_0)=\frac{P(C,s|C_0)}{P(C,s|C)}.$$ where $s$ is the Laplace variable.
Thinking more along these lines, consider the following equation $$P(C,t|C_0) = \sum_{C'\in\mathcal{S}} P(C',t^*|C_0)P(C,t-t^*|C')$$  where $t^*$ is some intermediate time between $0$ and $t$. Could the above equation be classified as a convolution in some abstract configuration space? If yes, could a convolution theorem like result be used to simplify the equation (bring it into a product form in the abstract space)? I understand that if we were considering a $1D$ lattice, then going from $C_0=x_0$ to $C'=x'$ would be equivalent to a displacement of $x'-x_0$. And similarly going from $C'$ to $C=x$ is equivalent to covering up the rest of the displacement $x-x'$ needed to finally reach $x$. This allows us to view the problem as a conventional convolution in space. But what if the state space isn't ordered like a lattice, and instead has an arbitrary graph structure?
I would appreciate any comments/suggestions that you may have regarding the question.

A: $\newcommand\S{\mathcal S}\newcommand\V{\mathcal V}\newcommand\tC{\tilde C}\newcommand\tD{\tilde D}$
The answer is: in general, no. Indeed, suppose the contrary: that you have an imbedding $f$ of your state space $\S$ into a vector space $\V$ such that for
$$Q(D',t|D):=
\left\{
\begin{aligned}
P(f^{-1}(D'),t|f^{-1}(D))\quad&\text{if}\quad f^{-1}(\{D'\})\ne\emptyset \text{ and } f^{-1}(\{D\})\ne\emptyset, \\
0\quad&\text{if}\quad f^{-1}(\{D'\})=\emptyset \text{ and } f^{-1}(\{D\})\ne\emptyset, \\
1(D'=0)\quad&\text{if}\quad f^{-1}(\{D\})=\emptyset,
\end{aligned}
\right.
\tag{0}$$
we have
$$Q(D'+d,t|D+d)=Q(D',t|D)\tag{1}$$
for all $D',D,d$ in $\V$.
Suppose now that there are $C',C,\tC$ in $\S$ such that
$$0<P(C',t|C)\ne P(\tC',t|\tC)\tag{2}$$
for all $\tC'\in\S$. Let
$$D':=f(C'),\quad D:=f(C),\quad \tD:=f(\tC),\quad d:=\tD-D,\quad \tD':=D'+d.\tag{3}$$One of the following two cases takes place:
Case 1: $f^{-1}(\{\tD'\})=\emptyset$. Then, by (3), (0), and (2),
$$Q(D'+d,t|D+d)=Q(\tD',t|D+d)=0\ne P(C',t|C)=Q(D',t|D),$$
so that (1) fails to hold.
Case 2: $f^{-1}(\{\tD'\})\ne\emptyset$, so that $f(\tC')=\tD'$ for some $\tC'\in\S$. Then, again by (3), (0), and (2),
$$Q(D'+d,t|D+d)=Q(\tD',t|\tD)=P(\tC',t|\tC)\ne P(C',t|C)=Q(D',t|D),$$
so that (1) fails to hold in Case 2 either.
Thus, you cannot have a desired imbedding whenever condition (2) is satisfied for some $C',C,\tC$ in $\S$ and all $\tC'\in\S$ -- which should be generically so. $\Box$


text:
Q: titleForHeaderInSection is not updating Section Header information correctly I have two tableviews where one navigates to the next. Both use more or less the same code and use the managedObjectContext and FetchedResultsController design pattern to provide the relevant data for both tables.
My problem happens when I navigate from the first to the second tableview and when the datasource has only one Section Header / Row to display in the tableview. I'm finding the datasource does not update Section Header information. It will however update this information if there is more than one row or section data passed the second tableview.
This issue is only really noticeable when attempting to navigate the same criteria of data from a different row of the first tableview a second time. Somehow it has not released the information from the first attempt and instead has used this information as a placeholder. I can confirm memory management methods have been done and that the corresponding Row below the Section Header is using the correct data so my managedObjectModel is being passed correctly.
Has anyone else come across this problem?
Update
This is the code used in the first tableview.
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {

id <NSFetchedResultsSectionInfo> sectionInfo = [[fetchedResultsController sections] objectAtIndex:section];

if ([fetchSectioningControl selectedSegmentIndex] == 2) {
    return [NSString stringWithFormat:NSLocalizedString(@"%@ - %d events", @"%@ - %d events"), [sectionInfo name], [sectionInfo numberOfObjects]];

} else if ([fetchSectioningControl selectedSegmentIndex] == 1) {
    return [NSString stringWithFormat:NSLocalizedString(@"%@ - %d events", @"%@ - %d events"), [sectionInfo name], [sectionInfo numberOfObjects]];

} else {
    NSString *dates = [self.dateFormatter stringFromDate:date];
    NSString *compareDate = [sectionInfo name];

    if ([dates isEqualToString:compareDate]) {
        return [NSString stringWithFormat:@"Today"];

    }else {
        return [sectionInfo name];
    }
}
}

This is the code used in the second tableview
- (NSString *)tableView:(UITableView *)table titleForHeaderInSection:(NSInteger)section {

id <NSFetchedResultsSectionInfo> sectionInfo = [[fetchedResultsController sections] objectAtIndex:section];
NSString *dates = [self.dateFormatter stringFromDate:date];
NSString *compareDate = [sectionInfo name];
if ([dates isEqualToString:compareDate]) {
    return [NSString stringWithFormat:@"Today"];
}else {
    return [sectionInfo name];
}
}

A: I solved this issue by supplying a nil value to cacheName in the initWithFetchedRequest method of my FetchedResultsController. Another recommendation was to delete the cache before instantiating the NSFetchedResultsController using the following method:
+ (void)deleteCacheWithName:(NSString *)name;

All credit for this answer must go to 'unforgiven' for an answer posted here.


text:
Q: best practice for intents in return value android i have 2 activities, one is a Database of exercises and the other one is new exercise creator
in this function i create a new class of an exercise, i want to return the new class to the
Database activity.
and when creating a new exercise delete this activity and create a new one which will create a new Exercise class.
public void onClickDone(View view)
{
    EditText editText = (EditText) findViewById(R.id.edit_name);
    String name = editText.getText().toString();
    editText = (EditText) findViewById(R.id.edit_description);
    String description = editText.getText().toString();
    editText = (EditText) findViewById(R.id.edit_reptitons);
    EditText editSets = (EditText) findViewById(R.id.edit_sets);
    EditText editTimeBetweenSets = (EditText) findViewById(R.id.edit_time_between_sets_);
    int reptitons = 0 ;
    int sets = 0 ;
    int timeBetweenSets = 0;
    try
    {
        reptitons = Integer.parseInt(editText.getText().toString());
        sets = Integer.parseInt(editSets.getText().toString());
        timeBetweenSets = Integer.parseInt(editTimeBetweenSets.getText().toString());
    }
    catch(NumberFormatException ex)
    {
        AlertDialog.Builder dlgAlert  = new AlertDialog.Builder(this);

        dlgAlert.setMessage("please check you input");
        dlgAlert.setTitle("Wrong Input");
        dlgAlert.setPositiveButton("OK", null);
        dlgAlert.setCancelable(true);
        dlgAlert.create().show();
    }
    _excercise = new Exercise(name, description, reptitons, sets, timeBetweenSets);
}

what is a the best practice for 2 activities to create a class, save it to a list and create a new one when pressing the "create new exercise button" again?
or maybe i should create the instance of the class inside the add exercise activity?

A: First of all, you're creating objects, not classes.
You can stop Activities using finish(); which should return you to your previous activity.
If you want your second Activity to send Data to the first activity maybe check out startActivityForResult. Check out this topic.


text:
Q: RealmSwift obtain each T object I have list of objects T and I want to calculate their sum (T objects)
var objects: Observable<List<T>>

T object has a method which return Int value.
The main idea to get each object and prepare array of values (flatMap function). The next step will be reduce func with Int values.
let sum = values.reduce(0) { $0 + $1 }

Q: How to get each T object?

A: Have a look at the solution below which is trying to demonstrate what you are trying to do, you might need a protocol for type T that has int property like the example below. You can try it with playground.
protocol Countable {

    var value: Int { get }
    init(value: Int)
}

class User: Countable {

    var value: Int = 0

    required convenience init(value: Int) {
        self.init()
        self.value = value
    }
}

class UserGroup<T: Countable> {

    func calculateTotal() {
        let users: [T] = [T(value: 2), T(value: 21)]
        let total = users.flatMap { ($0 as Countable).value }.reduce(0) { $0 + $1 }
        print("total", total)
    }
}

let userGroup = UserGroup<User>()
userGroup.calculateTotal()


text:
Q: ExtJS TreeGrid + MVC - not loading I've taken the MVC introduction (http://dev.sencha.com/deploy/ext-4.0.7-gpl/docs/index.html#!/guide/application_architecture) and tried to modify it to load up a treegrid instead, with help from the example here (http://dev.sencha.com/deploy/ext-4.0.0/examples/tree/treegrid.html).
I don't know why, but it doesn't seem to load at all. It never reaches the launch function in Ext.application, I'm assuming it has something to do with the controller not being configured properly, but Firebug isn't showing any errors on the console, so I'm a bit lost.
For what it's worth, I've copied and loaded the TreeGrid example myself and it works, so it's not a ExtJS bug/server config problem, like I thought it would be from this thread:  Configuration required to get Sencha ExtJS TreeGrid example working
My code:
main.js
Ext.Loader.setConfig({ enabled: true });

Ext.require([
    'Ext.data.*',
    'Ext.grid.*',
    'Ext.tree.*'
]);

Ext.application({
    name: 'pr',

    appFolder: '', //This is considered root so no name needs to be supplied.

    controllers: [
        'Control-Product' //filename
    ],

    launch: function () {
        console.log('The app was launched');
        Ext.create('Ext.container.Viewport', {
            layout: 'fit',
            items: [{
                xtype: 'treegrid'
            }]
        });
    }
});

Control-Product.js
Ext.define('pr.controller.Product', {
    extend: 'Ext.app.Controller',
    views: ['user.TreeGrid'],
    stores: ['Store-Products'],
    models: ['Model-Product'],

    init: function () {
        console.log('The controller was instantiated');
        this.control({
            'viewport > panel': {
                render: this.onPanelRendered
            }
        });
    },
    onPanelRendered: function () {
        console.log('The panel was rendered');
    }
});

TreeGrid.js
Ext.define('pr.view.user.TreeGrid', {
    extend: 'Ext.tree.Panel',
    alias: 'widget.treegrid',

    initComponent: function () {
        this.title = 'Products',
        this.store = 'pr.store.Products',
        this.collapsible = true,
        this.useArrows = true,
        this.rootVisible = false,
        this.multiSelect = true,
        this.singleExpand = false,
        //this.renderTo = Ext.getBody(),
        this.columns = [{
            xtype: 'treecolumn',
            text: 'ID',
            flex: 1,
            dataIndex: 'ID',
            sortable: true
        },
        {
            text: 'Price',
            flex: 1,
            dataIndex: 'Price',
            sortable: true
        },
        {
            text: 'Company',
            flex: 1,
            dataIndex: 'Company',
            sortable: true
        }];

        this.callParent(arguments);
    }
});

Model-Product.js
Ext.define('pr.model.Product', {
    extend: 'Ext.data.Model',
    fields: [
            { name: 'ID', type: 'string' },
            { name: 'Price', type: 'string' },
            { name: 'Company', type: 'string' }
        ]
});

Store-Products.js
Ext.define('pr.store.Products', {
    extend: 'Ext.data.TreeStore',
    model: 'pr.model.Product',
    proxy: {
        type: 'ajax',
        //get data from json file for now
        url: '/data/products.json'
    },
    folderSort: true
});

products.json
{"text":".","children": [
    {
        ID:'1111',
        Price:'11.11',
        Company:'Company1',
        expanded: true,
        children:[{
            ID:'',
            Price:'44.44',
            Company:'Company2',
            leaf:true
            }]
    },{
        ID:'2222',
        Price:'22.22',
        Company:'Company1',
        expanded: true,
        children:[{
            ID:'',
            Price:'33.33',
            Company:'Company3',
            leaf:true
            }]
    }
]}

A: After running it through with my colleague it turns out I was not naming my classnames to match my filenames e.g. pr.model.Product should be pr.model.Model-Product. Fixed that and it's all working now.


text:
Q: Will there be a Win64 API? If I'm correct, Win32 is adapting or has been adapted to cope with 64 bit windows, for example, GetWindowLongPtr on 64 bit as opposed to GetWindowLong on 32 bit. Will there be a Win64 Api, and if so, is there any indication on when the transition will happen?
I'm not very knowledgeable on this subject so I apologize if I have anything obvious wrong. Thanks in advance, ell.

A: The new Windows API, just announced, is called WinRT.  For more information, I recommend watching the keynotes from BUILD.

A: The win32 stuff ("Win32 API") in x64 is really 64-bit code through-and-through (* see comments).
The actual 32-bit code (in a 64-bit windows) runs under the WoW64 subsystem which encompasses both the file-system and registry. While this may seem "sloppy" it actually makes a good bit of sense because a program can be compiled for both x32 and x64 without needing to change names (so long as proper version-neutral code has been used) -- that is, the core interface and "how windows works" is a fairly stable target.
Happy coding.

A: The Windows API has suffered terribly from the habit of assuming a known value of sizeof(void *) and sticking it in a field of some integral type believed to be the same size.  Even in the Windows MSG structure, wParam is so named because it was originally a WORD, or unsigned 16 bit value, and lParam a LONG, or signed 32 bit value.  Perhaps this is another symptom of C Programmers' Disease.

A: This transition happened around the turn of the century. 64 bit versions of Windows using the 64 bit version of Win32 have been in use for a long time now.
However, the 64 bit version of Win32 is still known as Win32 since it is essentially an identical interface with the only major difference being different sized pointers.


text:
Q: Prevent span4 from collapsing I am working with twitter bootstrap 2.x.x
I have 3 columns (span4) that I need to stay as that (3 columns) even when viewed on small screen (phone). In other words I need prevent span4 form  collapsing into 1 column, but still enjoy the responsiveness.
Thanks


text:
Q: how i can cancel DISPATCH_QUEUE_PRIORITY_DEFAULT from running well for me I'm using this method to connect with internet service , the main problem is when i go to another storyboard , the method dispatch_get_global_queue won't stop , how i can stop it when i go to another storyboard
         let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
        dispatch_async(dispatch_get_global_queue(priority, 0)) {
            link = "http://nepraswebsite.com/new_lille/mobile_api/Products_list/index/BestView/1"

            if let url = NSURL(string: "http://nepraswebsite.com/new_lille/mobile_api/Products_list/index/BestView/1") {
                if let data = try? NSData(contentsOfURL: url, options: []) {
                    SearchResult = JSON(data: data)
                }
            }
            self.didFinishLoadingSearch = true

        }
        dispatch_async(dispatch_get_main_queue()) {
            HUD.show(.Progress)
        }


text:
Q: Link between class in python I have :
ClassAttribute:
    def __init__(self, string):
        ### example of string :
        ###     "c1 int not null"
        splitted_string = string.split(' ', 2)
        self.col_name = splitted_string[0]
        self.col_def = splitted_string[1]
        if len(splitted_string) == 3:
            self.col_option = splitted_string[2]
        else:
            self.col_option = ""

ClassTable:
    def __init__(self, string):
        ### example of string :
        ###     "create table TABLE_A (c1 int not null, c2 string)"
        string_splitted = string.split(' ', 3)
        self.table_name = string_splitted[2]
        ### In real life, I've a list of my attributes
        ### Example :
        ###     list_attributes = ['c1 int not null', 'c2 string']
        self.table_attributes = []
        for attr in list_attributes:
            self.table_attributes.append(ClassAttribute(attr))

Questions :

*

*How to call my attributes objects in my table without iterating over the list_attributes ? For example, I would like to add the "not null" option of the nth attributes, I don't know its position but I know its name.

*From the attributes object, how to get the table name ?

A: The Evert's suggestion works for me :
ClassAttribute:
    def __init__(self, table, string):
        splitted_string = string.split(' ', 2)
        self.table_name = table.table_name
        self.col_name = splitted_string[0]
        self.col_def = splitted_string[1]
        if len(splitted_string) == 3:
            self.col_option = splitted_string[2]
        else:
            self.col_option = ""

ClassTable:
    def __init__(self, string):
        string_splitted = string.split(' ', 3)
        self.table_name = string_splitted[2]
        self.table_attributes = []
        for attr in list_attributes:
            self.table_attributes.append(ClassAttribute(self, attr))


text:
Q: How to run xUnit test DLL in Commandline without building the project I have a project in .NET Core and have built tests using xUnit. Now I wanted to run the test in deployment process. What I have done so far:
I used this command in commandline:
dotnet test [project address]  ...

it is working but the problem is that this command get the .csproj file and not the dll.
I installed and used xunit.runner.console but its not working with .NET Core projects.
I used dotnet xunit command, this one also not helped while I cannot give it the dll it is also using the project folder.
What can I use to run my built test (dont want to build them again), any commandline tools that I can give my test dll as an input and it runs the test for me.

A: You have several options here:
1. Use vstest command
dotnet vstest Foo.dll

to run tests from a dll. xUnit tests are supported. Documentation.
A single dll file only is not enough. Run dotnet vstest from your bin folder, which usually contains:
Foo.dll
Foo.deps.json
Foo.runtimeconfig.json
Foo.runtimeconfig.dev.json
Microsoft.Extensions.Logging.Test.dll
xunit.runner.reporters.netstandard15.dll
xunit.runner.utility.netstandard15.dll
xunit.runner.visualstudio.dotnetcore.testadapter.dll

This bin output is necessary to run the tests.
2. Skip the project build on test run
dotnet test --no-build


text:
Q: Which part of the Linux kernel code is responsible for implementing LRU? I've been reading the documentation and the comments in the source code files but cannot figure out the exact function/code which is responsible for implementing the LRU in the latest release of the kernel. I want to make slight modifications to it, which is why i'm looking for it.
I've come across that the kernel maintains active and inactive lists. Where is this code?

A: Assuming kernel v3.18, most of the LRU-related code is in mm/swap.c. If you look at this file, there are many functions that are probably what are you interested in. For example:
void lru_cache_add_active_or_unevictable(struct page *page,
                                         struct vm_area_struct *vma)

See: http://lxr.free-electrons.com/source/mm/swap.c#L660
There are other files in mm that are relevant, as well. Try looking at files related to the Linux virtual memory (often shortened to "vm") subsystem, and the files with "swap" in the name.
A lot of the literature on Linux's LRU stuff is out-of-date, as you have discovered. The general concepts are probably the same, but they've renamed/moved around a lot of things.


text:
Q: Error running ADF Morena application? I develop an application in ADF. Scanning documents using Morena 6. When I test on my PC everything works ok but when I switch on the GlassFish application server and start scanning the document I receive an error.
Caused by: java.lang.UnsatisfiedLinkError: SK.gnome.twain.TwainManager.listSources()[LSK/gnome/twain/TwainSource;
 at SK.gnome.twain.TwainManager.listSources(Native Method)
 at SK.gnome.twain.TwainManager.selectSource(TwainManager.java:163)
 at beans.ImageBean.skenirajDokument(ImageBean.java:571)

A: Could it be that your Morena jar file is not cross platform? http://docs.oracle.com/javase/7/docs/api/java/lang/UnsatisfiedLinkError.html


text:
Q: Instrument error: Undefined symbols for architecture x86_64: i try to build my app with the xcodebuild command but i got an error. Here is my command:
xcodebuild clean build -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO -workspace APP.xcworkspace -scheme APP-SCHEME CONFIGURATION_BUILD_DIR=/PATH

Here the error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Flurry", referenced from:
__TMaCSo6Flurry in LoginViewController.o
__TMaCSo6Flurry in RecipientViewController.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **

Has someone any ideas?
Thank

A: You are probably using the wrong binary of Flurry. They bundle several .a with or without some of the architectures.
You can run lipo -info on a library to get which architectures are in the binay.


text:
Q: Windows 7 - Shell Extension dll Initialize method called twice on explorer left pane I have a c++ shell extension dll. The Initialize method is called twice, if I click on the explorer window left pane tree view  folders. But if I click any folders on the explorer window right pane, the Initialize method called once.
The issue is my newly added menu items shows twice in the context menu, if I click on the left pane tree view.
I am wondering, is it a window functionality?
I have commented all my implementation and tested with the below code:
IFACEMETHODIMP CMyContextMenu::QueryContextMenu(HMENU hmenu, UINT /*uIndex*/, UINT    cmdFirst, UINT /*uidCmdLast*/, UINT /*uFlags*/ )
{
UINT cmdId = uidCmdFirst;
OutputDebugString(L"QueryContextMenu");

    return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL,  cmdId  - mdFirst );
}

IFACEMETHODIMP CMyContextMenu::Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT  pDO, HKEY /*hkeyProgID*/)
{
OutputDebugString(L"Initialize");
return S_OK;
}

When I click on left pane, the DebugViewr output is:
Initialize
QueryContextMenu
Initialize
QueryContextMenu
NoRemove Directory
{
    NoRemove Background
    {
        NoRemove ShellEx
        {
            NoRemove ContextMenuHandlers
            {
                ForceRemove myContext = s '{AE843198-3C5D-4EA6-B74F-7A41FC91D7FF}'
            }
        }
    }
}

NoRemove Directory
{
    NoRemove ShellEx
    {
        NoRemove ContextMenuHandlers
        {
            ForceRemove myContext = s '{AE843198-3C5D-4EA6-B74F-7A41FC91D7FF}'
        }
    }
}

The above registry entry is causing this issue in Win 7, If I remove  "NoRemove Background", the context menu will be displayed once in tree view. But if I click on folder empty area Initialize method will not be invoked.

A: I am posting a working example from my real program (an application specific code omitted for clarity). Please try it.
STDMETHODIMP CShlExtExample::Initialize (
LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hProgID )
{
 FORMATETC fmt = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
 STGMEDIUM stg = { TYMED_HGLOBAL };
 HDROP     hDrop;

   // Look for CF_HDROP data in the data object.
   if ( FAILED( pDataObj->GetData ( &fmt, &stg ) ))
   {
       // Return an "invalid argument" error.
       return E_INVALIDARG;
   }

   // Get a pointer to the actual data.
   hDrop = (HDROP) GlobalLock ( stg.hGlobal );
   if ( NULL == hDrop )
       return E_INVALIDARG;

   // Make sure there is at least one file to show menu for.
   UINT uNumFiles = DragQueryFile ( hDrop, 0xFFFFFFFF, NULL, 0 );
   HRESULT hr = S_OK;
   if ( 0 == uNumFiles )
   {
       GlobalUnlock ( stg.hGlobal );
       ReleaseStgMedium ( &stg );
       return E_INVALIDARG;
   }

   // Application specific code.

   GlobalUnlock ( stg.hGlobal );
   ReleaseStgMedium ( &stg );

   return hr;

}
   STDMETHODIMP CShlExtExample::QueryContextMenu (
   HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd,
   UINT uidLastCmd, UINT uFlags )
   {
     // If the flags include CMF_DEFAULTONLY then do nothing.
     if ( uFlags & CMF_DEFAULTONLY )
         return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 0 );

   InsertMenu ( hmenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd, _T("Test Item") );

   return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 1 );
   }


text:
Q: Apps script and setNumberFormat I have a Google spreadsheet script that pulls some data through API. The problem is that i'm pulling some data that returns a number like this: 142499.68000000
The problem is that my spreadsheet is configured to brazilian format and i'm getting some crazy results (14.249.968.000.000,00). I want to format this number like this: 142.499,68 (we use comma and not dot as US format).
I've been playing around with .setNumberFormat() but had no success.
How can I format the number like that in my script?

A: You can use JavaScript directly and in particular Intl.NumberFormat:
function myFunction() {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
  const sheet = ss.getSheetByName('Sheet1');
  const cell = sheet.getRange("A1");
  const number = new Intl.NumberFormat('de-DE').format(142499.68000000);
  cell.setValue(number);
}

It works for me when I change my spreadsheet locale to Brazil.
Make sure you don't have other number formatting on the cells that could affect the formatting returned by the script.
The de-DE version returns the desired result:


text:
Q: flyspell, emacs and aspell seem to diverge I'm using the following configuration for aspell in my .emacs file
(setq ispell-program-name "/opt/local/bin/aspell")
(setq ispell-list-command "list")
(setq ispell-extra-args '("--dont-tex-check-comments"))

and my ~/.aspell.conf contains the following line
add-tex-command bibliographystyle p

trying this latex file:
\documentclass{article}
\begin{document}
\bibliographystyle{plainnat}
\end{document}

emacs flyspell mode shows me plainnat as an error.

When I invoke aspell from the command line with the following command
aspell --dont-tex-check-comments -c ~/test.tex

it shows no errors. Flyspell does not seem to use aspell or the aspell config. How can I change this in such a manner that I only have to maintain one config for my spell checking needs and not have an extra config for flyspell?

A: Flyspell uses a mode-specific function called flyspell-generic-check-word-predicate to identify areas to ignore when highlighting spelling errors. This is slightly more involved than normal customizations.
As I understand it, there are three steps. First, set the flyspell-mode-predicate property of LaTeX-mode to the name of your custom function. Second, define a function that will return t when point is on a word you want to ignore. Third, add a hook to LaTeX-mode to define flyspell-generic-check-word-predicate to use this new function whenever you enter LaTeX mode.
(The order doesn't really matter, so long as all three steps are done before you open a latex file.)
If you don't know elisp, that probably doesn't make much sense to you. Adding the following to your .emacs file and restarting Emacs should solve the problem. If you want to add additional regions to ignore, the part to play with is the (save-excursion ... ) form.
(put 'LaTeX-mode 'flyspell-mode-predicate 'auctex-mode-flyspell-verify)
(defun auctex-mode-flyspell-verify ()
  "Function used for `flyspell-generic-check-word-predicate' in auctex mode."
  (save-excursion
    (forward-word -2)
    (not (looking-at "bibliographystyle{"))))

(add-hook 'LaTeX-mode-hook
  (lambda () (setq flyspell-generic-check-word-predicate
    'auctex-mode-flyspell-verify)))

A: A simpler solution is to customize the variable flyspell-tex-command-regexp. The default value is
\(\(begin\|end\)[   ]*{\|\(cite[a-z*]*\|label\|ref\|eqref\|usepackage\|documentclass\)[     ]*\(\[[^]]*\]\)?{[^{}]*\)

Just append \|bibliographystyle (read "or bibliographystyle") as shown below:
\(\(begin\|end\)[   ]*{\|\(cite[a-z*]*\|label\|ref\|eqref\|usepackage\|documentclass\|bibliographystyle\)[  ]*\(\[[^]]*\]\)?{[^{}]*\)

You can replace bibliographystyle by other commands whose input you may want to ignore, e.g. newenvironment.

A: This is more of a long comment than a real answer.
The behavior is even more confusing that what you describe. I used your file but added a misspelled word in a comment and a "fake" TeX command with a misspelled word as its argument
\documentclass{article}
\begin{document}
\bibliographystyle{plainnat}
\bdfg{rwt}
\end{document}
% qwrx

Behavior that I saw:

*

*Using aspell -c test.tex this gives an error for "plainnat" and "rwt", but not for "qwrx". I guess my aspell doesn't need the --dont-tex-check-comments switch.

*Using ispell-buffer in emacs gives an error only for "rwt".

*Using flyspell-buffer in emacs gives an error for "plainnat", "rwt" and "qwrx".

*Putting point on "qwrx" or "plainnat" in emacs, and then using either ispell-word or flyspell-word gives an error.

*Putting point on either "bibliographystyle" or "bdfg" in emacs, and then using ispell-word gives an error, but using flyspell-word gives no error.

*All of the above was verified running ispell-kill-ispell before running the commands, to ensure that you start with a fresh ispell process. But if you, e.g., spell-check the buffer with ispell-buffer, "(a)ccept" "rwt" as an OK word for this session, and then run flyspell-buffer, flyspell will no longer complain about "rwt"

I believe that what's going on is that neither ispell nor flyspell send the entire buffer as a unit to aspell and ask it to spellcheck it [1]. Instead, the two modes go through the file one word at a time, and send each individual word to aspell. While flyspell does eventually call the function ispell-word to make the actual call to aspell [2], the logic of which words to spellcheck is different in flyspell vs ispell. It appears that both contain logic relevant to TeX/LaTeX, but not the same logic.
So aspell never gets a chance to apply its custom rules regarding TeX commands and their arguments, because it doesn't realize that the word "plainnat" is part of a TeX command.
I was using emacs 24.3, AUCTeX (although I don't thnk that AUCTeX does anything that really changes this behavior), aspell 3.1.20. Cygwin.
[1] This is implicit in Tyler's answer, but I think it's worth pointing it out very explicitly, because emacs' behavior here doesn't make any sense until you understand this!
[2] This probably explains the behavior in my last bullet point.


text:
Q: Spread-chain group of elements with ConstraintLayout I'm having an issue to spread-chain 2 groups of elements with Constraint Layout. I understand the goal of this new layout is to use a flat hierarchy so I'd like to avoid putting my elements inside a child layouts.
I looked at some awesome resources like constraintlayout.com but couldn't figure out how to make it work for my specific case - which I think can be common..
Here is an image of what I'd like to achieve. In red, spaces 1, 2 and 3 need to have the same height (just like spread chain).

Thank you for your attention :)

A: You can achieve this using:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                   xmlns:app="http://schemas.android.com/apk/res-auto"
                                                   android:orientation="vertical"
                                                   android:layout_width="match_parent"
                                                   android:layout_height="match_parent">

    <Button
            android:text="Button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toTopOf="@+id/button2"
            app:layout_constraintVertical_chainStyle="packed"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"/>
    <Button
            android:text="Button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button2"
            app:layout_constraintTop_toBottomOf="@+id/button"
            app:layout_constraintBottom_toTopOf="@+id/button3"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"/>
    <Button
            android:text="Button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button3"
            app:layout_constraintTop_toBottomOf="@+id/button2"
            app:layout_constraintBottom_toTopOf="@+id/space"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"/>
    <Space
            android:id="@+id/space"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintBottom_toTopOf="@+id/button4"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"/>
    <Button
            android:text="Button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button4"
            app:layout_constraintTop_toBottomOf="@+id/button3"
            app:layout_constraintBottom_toTopOf="@+id/button5"
            app:layout_constraintVertical_chainStyle="packed"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"/>
    <Button
            android:text="Button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/button5"
            app:layout_constraintTop_toBottomOf="@+id/button4"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>


text:
Q: How to change the Android Studio Project minSDK version? I had a recurring error that I wasnt sure how to correct. My android studio was returning the an error indicating that my minSdk version was 11 and had to 14 in order to use the NoTitleBar parent reference in styles.xml. My AndroidManifest had the tag <uses-sdk android:minSdkVersion="14"/> but the error would not go away. I re-cleaned the project and tried to build again - same error.
Android Studio version: 0.8.6
OS: Win8.1

A: In app > build.gradle file try to modify this section
    defaultConfig {
        minSdkVersion 11
    }
Best regards

A: Although I had the minSdk set in the manifest the project level sdk was overriding this or at least causing a collision. I located this way: File -> Project Structure -> App -> Flavors -> Change the minSdk version to whatever you need (preferably to match whats in the manifest if its declared - otherwise remove it from there). Hope this helps.
As a note I also next ran into this error I have not resolved yet:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1


text:
Q: Как в  сделать так, чтобы при вводе текста только первая буква в предложении была заглавной? Добрый день.

Вопрос: При вводе текста строчными буквами в <textarea> сделать так, чтобы только первая буква в предложении была заглавной?

Спасибо.

A: С помощью css такое может решить только атрибут autocapitalize. Проблема в том, что это не универсальное решение.
Поэтому такую задачу можно решить только с помощью js. Например так:

$("#someId").on('keyup', function(e) {
    var arr = $(this).val().split('.');
    var result = '';
    for (var x = 0; x < arr.length; x++) {
        result += arr[x].replace(/^\s+/, '').charAt(0).toUpperCase() + arr[x].replace(/^\s+/, '').slice(1) + '. ';
    }
    $(this).val(result.substring(0, result.length - 2));
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea id="someId"></textarea>


text:
Q: Change Action Bar Background I'm trying to change the action bar color.

Does anyone knows how it's possible?
Thanks!!

A: Following Google page: https://developer.android.com/training/material/theme.html#ColorPalette
I added a style propriert inside my main theme:
<item name="colorPrimary">#6876c5</item>

and it did work!


text:
Q: how to code one vs rest multi class SVM for action recognition project I'm new to SVM. I want to use Multiclass svm for classification in my action recognition project. My data set have 15 class like running jogging walking biking etc. I understand binary SVM and seen lot of examples. I'm getting confusion in one vs one multiclass svm and one vs rest multiclass svm.
My question is: Should I have to create and train a svm for each class like svm1  for running, svm2 for jogging.....etc what should be class lebels for each created svm either (0,1,2,.......14) or (0,1). how to determine the model for multiclass classification.how the result will be predicted ?
I was trying some thing like this:
Mat trainData, trainLabels;

for (int i = 0; i < 15; i++ )
        {
        sprintf_s(filename, "VocabularyHOG/Dictionary%d.yml", i);
        Mat feature;
        FileStorage fs(filename, FileStorage::READ);
        fs["vocabulary"] >> feature;
        feature.convertTo(feature, CV_32F); // make sure we got float data
        trainData.push_back(feature.reshape(1, 1)); // as a flat column
        trainLabels.push_back(i); // the classlabel
}

// Train the SVM
Ptr<SVM> svm = SVM::create();
svm->setType(SVM::C_SVC);
svm->setKernel(SVM::LINEAR);
svm->setTermCriteria(TermCriteria(TermCriteria::MAX_ITER, 100, 1e-6));
svm->train(trainData, ROW_SAMPLE, trainLabels);
     Mat testData;
 FileStorage fs("DictionaryrunningHOG.yml", FileStorage::READ);
    fs["vocabulary"] >> testData;
    int response = svm->predict(testData.reshape(1, 1));
    if (response == 1)
        cout << "boxing";
    else
        cout << "negative result";

    waitKey(27);
    return 0;

but getting error. what is wrong here?? how to code one vs rest multiclass svm properly.What is the label for each svm? Thanks


text:
Q: How do I use schedule py and Discord py together? Main goal:
Send a message to a channel every Wednesday at 08:00
This is my current code:
import schedule
import time
import discord
import asyncio
from discord.ext import commands, tasks
from discord.ext.tasks import loop

client = discord.Client()

# IMPORTANT
channel =
botToken = ""

async def sendloop():
  while True:
    schedule.run_pending()
    await asyncio.sleep(1)

@client.event
async def on_ready():
        general_channel = client.get_channel(channel)
        print('ready')
        schedule.every(2).seconds.do(lambda:loop.create_task(general_channel.send('TEST')))

client.run(botToken)

So far, there are no errors, just stuck on "ready". I am a beginner using VS Code.

A: I wouldn't recommend using scheduler, since discord the extension task which can do the same as what you are trying to implement in your code:
from discord.ext import commands, tasks

ch = id_channel
client = commands.Bot(command_prefix='.')
TOKEN = "Token"

#every week at this time, you can change this to seconds=2
#to replicate what you have been testing
@tasks.loop(hours=168)
async def every_wednesday():
    message_channel = client.get_channel(ch)
    await message_channel.send("Your message")

@every_wednesday.before_loop
async def before():
    await client.wait_until_ready()

every_wednesday.start()

client.run(TOKEN)

If you were to run this code on the time you want it to be repeated, it will accomplish what you want. Another approach is checking on the before() function to check if it is the right time to run if you don't want to wait and run the code on the day you want this to run.
But if you really want to use the schedule module, this post my help you:  Discord.py Time Schedule


text:
Q: Other than session state what else in an asp.net application would use up server RAM? If I had 2 million users I've cached 1 mb's of data shared between all those users what else would use up RAM that each user would create?
EDIT:
2 million users login and have sessions at the same time, they are all making requests - maybe 10 requests per second. They are retrieving, for example, random numbers using a random number generator.

A: There is overhead for each request in a web application. It starts at the socket and works it's way up through IIS to ASP.NET to your application.  You should look into performance monitoring.  You can learn all sorts of neat things.  Here is a good link for that:
How to Measure Memory Usage for a Live ASP.NET MVC Web Application

A: Best thing to do is look at your process yourself.  Take a memory dump (using procdump or taskmgr) and then analyse it with windbg.  This will show you exactly what is in memory on each heap and how much of it there is:
A good place to start is with the sos command !dumpheap -stat


text:
Q: Mysql 1064(4200) error shows up when I tried to create a table -CREATE TABLE accesslogs (
page VARCHAR(250) NOT NULL,
userid VARCHAR(8) BINARY NOT NULL,
visitcount MEDIUMINT(5) DEFAULT 0 NOT NULL,
accessdate TIMESTAMP(14),
PRIMARY KEY (userid, page));

After I press enter from the command line and error is shown:
-ERROR 1064 (4200): You have an error in your SQL syntax; check the manual that corresponds to
your MYSQL server version for the right syntax to use near '(14), PRIMARY KEY (userid, page)'
at line 5.

This error keeps on occurring every time I try to create the table after flushing the privileges.
Please help.
Thanks

A: Change:
accessdate TIMESTAMP(14),

to
accessdate TIMESTAMP,

The TIMESTAMP data type doesn't have a size option.


text:
Q: Python & Pandas: Value lookup and extraction between columns EDIT: I'm just looking for hint on how to approach this issue.
I'm trying to perform a fairly advanced lookup of values in Pandas DF, but I have no clue how to approach it.
The logic should be as follows:

*

*Find if there is matching value of id1 in id2.

*If there is a match, list all content values matching id1 and to each individual value assign all values matching id2

*Do this for the whole dataframe and sum all occurrences / variations

My DF looks like this:
id1 id2 content
20  10  item 1
20  10  item 2
20  10  item 3
30  20  item 4
30  20  item 5
30  20  item 6

And I need to get the following:
content  previous_content   sum_of_occurances
item 4   item 1             1
item 4   item 2             1
item 4   item 3             1
item 5   item 1             1
item 5   item 2             1
item 5   item 3             1
item 6   item 1             1
item 6   item 2             1
item 6   item 3             1

Count anyone give me a hint how should I approach it in Python? I'm fairly new, so it may be a beginner-level issue. Thank you beforehand.

A: Input:
from io import StringIO
import pandas as pd
df = pd.read_table(StringIO("""id1  id2  content
20  10  item 1
20  10  item 2
20  10  item 3
30  20  item 4
30  20  item 5
30  20  item 6"""), sep='  ', engine='python')

Use pd.merge to (self) join dataframe on id1/id2 and add suffix to common columns:
merged_df = pd.merge(df, df, how='inner', left_on='id2',
                     right_on='id1', suffixes=('','_previous'))
# Take essential columns
merged_df = merged_df[['content','content_previous']]

Groupby content columns, take the count to get number of occurances, rename the "index" column:
# Reset index so we have something to count, then group by
grouped_df = merged_df.reset_index().groupby(['content','content_previous']).count()
# Reset index and change name of column
final_df = grouped_df.reset_index().rename(columns={'index':'sum_of_occurances'})  #There may be a better to get unique count across two columns

Output:
  content content_previous  sum_of_occurances
0  item 4           item 1                  1
1  item 4           item 2                  1
2  item 4           item 3                  1
3  item 5           item 1                  1
4  item 5           item 2                  1
5  item 5           item 3                  1
6  item 6           item 1                  1
7  item 6           item 2                  1
8  item 6           item 3                  1


text:
Q: why is the call stack set up like this? I was just playing with the call stack, trying to change the return address of a function etc, and wound up writing this program in C:
#include<stdio.h>

void trace(int);
void func3(int);
void func2(int);
void func1(int);

int main(){

    int a = 0xAAAA1111;

    func1(0xFCFCFC01);

    return 0;

}

void func1(int a){

    int loc = 0xBBBB1111;

    func2(0xFCFCFC02);

}

void func2(int a){

    int loc1 = 0xCCCC1111;
    int loc2 = 0xCCCC2222;

    func3(0xFCFCFC03);

}

void func3(int a){

    int loc1 = 0xDDDD1111;
    int loc2 = 0xDDDD2222;
    int loc3 = 0xDDDD3333;

    trace(0xFCFCFC04);

}

void trace(int a){

    int loc = 0xEEEE1111;

    int *ptr = &loc;

    do {
    printf("0x%08X : %08X\n", ptr, *ptr, *ptr);
    } while(*(ptr++) != 0xAAAA1111);

}

(sorry for the length)
This produced the following output (with comments that I added):
0xBF8144D4 : EEEE1111 //local int in trace
0xBF8144D8 : BF8144F8 //beginning of trace stack frame
0xBF8144DC : 0804845A //return address for trace to func3
0xBF8144E0 : FCFCFC04 //int passed to trace
0xBF8144E4 : 08048230 //(possibly) uninitialized padding
0xBF8144E8 : 00000000 //padding
0xBF8144EC : DDDD3333 //local int in func3
0xBF8144F0 : DDDD2222 //local int in func3
0xBF8144F4 : DDDD1111 //local int in func3
0xBF8144F8 : BF814518 //beginning of func3 stack frame
0xBF8144FC : 08048431 //return address for func3 to func2
0xBF814500 : FCFCFC03 //parameter passed to func3
0xBF814504 : 00000000 //padding
0xBF814508 : 00000000 //padding
0xBF81450C : 00000000 //padding
0xBF814510 : CCCC2222 //local int in func2
0xBF814514 : CCCC1111 //local int in func2
0xBF814518 : BF814538 //beginning of func2 stack frame
0xBF81451C : 0804840F //return address for func2 to func1
0xBF814520 : FCFCFC02 //parameter passed to func2
0xBF814524 : 00000000 //padding
0xBF814528 : BF816728 //uninitialized padding
0xBF81452C : B7DF3F4E //uninitialized padding
0xBF814530 : B7EA61D9 //uninitialized padding
0xBF814534 : BBBB1111 //local int in func1
0xBF814538 : BF814558 //beginning of func1 stack frame
0xBF81453C : 080483E8 //return address for func1 to main
0xBF814540 : FCFCFC01 //parameter passed to func1
0xBF814544 : 08049FF4 //(maybe) padding
0xBF814548 : BF814568 //(maybe) padding
0xBF81454C : 080484D9 //(maybe) padding
0xBF814550 : AAAA1111 //local int in main

I was wondering if anybody could fill me in on the blank spots here... I'm running Ubuntu linux compiling with gcc 4.3.3 (on an x86 -- AMD Turion 64)
What are the 0804... numbers? What's the third address up from the bottom? Is that the return address for main? If so, why is it out of order compared to the rest of the stack?
The 0x0804 numbers are return addresses, or pointers to code/data or something, while the 0xBF814 numbers are stack pointers
What's this:
0xBF814524 : 00000000 //padding?
0xBF814528 : BF816728 //I have no idea
0xBF81452C : B7DF3F4E //????
0xBF814530 : B7EA61D9 //????

seen just after the local int in func1?
Okay I have my stack dump almost completely filled in.
It looks like the the compiler wants to have the parameters pushed onto the stack starting at a 0x.......0 address, and everything between the local variables from the function before and the first parameter of the function being called seems to be padding (whether 0x00000000 or some uninitialized value). Some of them I'm unsure about because they look like code/data segment pointers, but I can't see them being used in the code: they're just there when the stack pointer gets reduced.
and I know it's a HUGE nono to touch the call stack in any kind of project, but that's okay. It's fun, right?
also
Greg wants to see the assembly,
here it is
    .file   "stack.c"
    .text
.globl main
    .type   main, @function
main:
    leal    4(%esp), %ecx
    andl    $-16, %esp
    pushl   -4(%ecx)
    pushl   %ebp
    movl    %esp, %ebp
    pushl   %ecx
    subl    $20, %esp
    movl    $-1431695087, -8(%ebp)
    movl    $-50529279, (%esp)
    call    func1
    movl    $0, %eax
    addl    $20, %esp
    popl    %ecx
    popl    %ebp
    leal    -4(%ecx), %esp
    ret
    .size   main, .-main
.globl func1
    .type   func1, @function
func1:
    pushl   %ebp
    movl    %esp, %ebp
    subl    $24, %esp
    movl    $-1145368303, -4(%ebp)
    movl    $-50529278, (%esp)
    call    func2
    leave
    ret
    .size   func1, .-func1
.globl func2
    .type   func2, @function
func2:
    pushl   %ebp
    movl    %esp, %ebp
    subl    $24, %esp
    movl    $-859041519, -4(%ebp)
    movl    $-859037150, -8(%ebp)
    movl    $-50529277, (%esp)
    call    func3
    leave
    ret
    .size   func2, .-func2
.globl func3
    .type   func3, @function
func3:
    pushl   %ebp
    movl    %esp, %ebp
    subl    $24, %esp
    movl    $-572714735, -4(%ebp)
    movl    $-572710366, -8(%ebp)
    movl    $-572705997, -12(%ebp)
    movl    $-50529276, (%esp)
    call    trace
    leave
    ret
    .size   func3, .-func3
    .section    .rodata
.LC0:
    .string "0x%08X : %08X\n"
    .text
.globl trace
    .type   trace, @function
trace:
    pushl   %ebp
    movl    %esp, %ebp
    subl    $40, %esp
    movl    $-286387951, -4(%ebp)
    leal    -4(%ebp), %eax
    movl    %eax, -8(%ebp)
.L10:
    movl    -8(%ebp), %eax
    movl    (%eax), %edx
    movl    -8(%ebp), %eax
    movl    (%eax), %eax
    movl    %edx, 12(%esp)
    movl    %eax, 8(%esp)
    movl    -8(%ebp), %eax
    movl    %eax, 4(%esp)
    movl    $.LC0, (%esp)
    call    printf
    movl    -8(%ebp), %eax
    movl    (%eax), %eax
    cmpl    $-1431695087, %eax
    setne   %al
    addl    $4, -8(%ebp)
    testb   %al, %al
    jne .L10
    leave
    ret
    .size   trace, .-trace
    .ident  "GCC: (Ubuntu 4.3.3-5ubuntu4) 4.3.3"
    .section    .note.GNU-stack,"",@progbits

A: Inspecting the stack like this seems like one step too far away. I might suggest loading your program in a debugger, switching to the assembly language view, and single stepping through every machine instruction. Understanding of the CPU stack necessarily requires an understanding of the machine instructions operating on it, and this will be a more direct way to see what's going on.
As others mentioned, the structure of the stack is also highly dependent on the processor architecture you're working with.

A: Most likely those are stack canaries. Your compiler adds code to push additional data to the stack and read it back afterwards to detect stack overflows.

A: I'm guessing those values starting with 0x0804 are addresses in your program's code segement (like return addresses for function calls).  The ones starting with 0xBF814 that you've labeled as return addresses are addresses on the stack -- data, not code.  I'm guessing they're probably frame pointers.

A: As already pointed out, the 0xBF... are frame pointers and 0x08... return addresses.
The padding is due to alignment issues. Other unrecognized values are also padding as the stack is not initalized to zero or any other value. Uninitialized variables and unused padding space will contain whatever bytes are in those memory locations.

A: The 0xBF... addresses will be links to the previous stack frame:
0xBF8144D8 : BF8144F8 //return address for trace
0xBF8144DC : 0804845A //

0xBF8144F8 : BF814518 //return address for func3
0xBF8144FC : 08048431 //????

0xBF814518 : BF814538 //return address for func2?
0xBF81451C : 0804840F //????

0xBF814538 : BF814558 //return address for func1
0xBF81453C : 080483E8 //????

The 0x08... addresses will be the addresses of the code to return to in each case.
I can't speak for the other stuff on the stack; you would have to step through the assembly language and see exactly what it is doing. I guess that it is aligning the start of each frame to a specific alignment so that __attribute__((align)) (or whatever it's called these days...) works.

A: The compiler uses EBP to store the frame's base address.  It's been a while so I looked at this, so I may get the details a bit wrong, but the idea is like this.
You have three steps when calling a function:

*

*The caller pushes the function's parameters onto the stack.

*

*The caller uses the call instruction, which pushes the return address onto the stack, and jumps to the new function.

*The called function pushes EBP onto the stack, and copies ESP into EBP:

*(Note: well behaved functions will also push all the GPRs onto the stack with PUSHAD)

push EBP
mov EBP, ESP

When the function returns it:

*

*pops EBP

*executes the ret instruction, which pops off the return address and jumps there.

pop EBP
ret

The question is, why is EBP pushed, and why does ESP get copied into it?
When you enter the function ESP points to the lowest point on the stack for this function.  Any variables you declare on the stack can be accessed as [ESP + offset_to_variable].  This is easy!  But note that ESP must always point to the top of the stack, so when you declare a new variable on the stack, ESP changes.  Now [ESP + offset_to_variable] isn't so great, because you have to remember what ESP was at the time the variable was allocated.
Instead of doing that, the first thing the function needs to do is to copy ESP into EBP.  EBP won't change during the life of the function, so you can access all variables using `[EBP + offset_to_variable].  But now you have another problem, because if the called functions calls another function, EBP will be overwritten.  That's why before copying EBP it needs to be saved onto the stack, so that it can be restored before the returning to the calling function.

A: Is this a debug or release build?  I'd expect some padding with the debug builds for detecting Stack Overflows.


text:
Q: Is this the best way for the below needed Ruby application? + [Help in Arrays] Please advise if the code is correct or there is a better version and also how to sort the Array in descending orders & the output to be like that:

A program that takes a user's input, then builds a hash from that input. Each key in the hash will be a word from the user; each value will be the number of times that word occurs. For example, if our program gets the string "the rain in Spain falls mainly on the plain,"

print "What is the sentence that needs to be analysed? "
sentence = gets.chomp
#puts sentence

#Text to Array
my_array = sentence.split

#Create the Hash

word_frequency = Hash.new(0)
#Iterate through the given array in the built Hash
my_array.each { |word|
   word_frequency[word] += 1
}

puts word_frequency

Needed Output to be if we run the code:

I love coding to the moon and love web coding

Love 2
coding 2
I 1
to 1
..... etc.

A: sentence = "Is this the best way for the below needed Ruby application?"

sentence.split.tally.sort_by { |_word, count| - count }.to_h

# => {"the"=>2, "Is"=>1, "this"=>1, "best"=>1, "way"=>1, "for"=>1, "below"=>1, "needed"=>1, "Ruby"=>1, "application?"=>1}

Firstly tokenize sentence to words array, than tally makes hash where key is word and value is count, than sort descending
You can also sort like this
sentence.split.tally.sort_by(&:last).reverse.to_h

Also you can use unified case, for example with String#upcase method and to avoid capturing punctuation it's possible to use String#scan method
sentence.upcase.scan(/[[:word:]-]+/).tally.sort_by(&:last).reverse.to_h

A: After many trails & @mechnicov I had reached the below and hope to hear reviews:
print 'What is the sentence that needs to be analysed? '
sentence = gets.chomp

# Convert Text to Array:
my_array = sentence.split

# Create the Hash called histogram
histogram = Hash.new(0) # zero added as a counter for iterate through word and add on it if exist

my_array.each do |word|
  histogram[word] += 1
end

# Sort descending by values
sorted_histogram = histogram.sort_by { |_k, v| v }.reverse

#Print final output:
sorted_histogram.each do |_word, _count|
  puts _word + ' ' + _count.to_s
end


text:
Q: AJAX post data is null when it reaches the ASP.NET Core 2.1 controller I'm posting data to an ASP.NET Core MVC 2.1.2 page using this jQuery code:
function OnCountryChange() {
    $.ajax({
        url: "/OnCountryChange",
        type: "POST",
        contentType: "application/json; charset=utf-8",
        datatype: "json",
        headers: {
            "RequestVerificationToken": $('input[name = __RequestVerificationToken]').val()
        },
        data: JSON.stringify({
            sCountryCode: "Test 123"
        })
    });
}

I am receiving the post in the controller with this method:
[HttpPost]
[ValidateAntiForgeryToken]
[Route("/OnCountryChange")]
public IActionResult OnCountryChange([FromBody] string sCountryCode)
{
    logger.LogDebug($"Country code is: {sCountryCode ?? "null"}");

    return Json(sCountryCode);
}

The output printed to the log is:

Country code is: null

The raw request body (viewed using Fiddler) looks like this:
{"sCountryCode":"Test 123"}

Why isn't the data being passed?

A: I am not familiar with C#,but in your question you have add
contentType: "application/json; charset=utf-8"

in your Ajax method which means the data parameter is json format,so you need to access as json object instead of access string directly.
Two ways to solve it:
a. Change your C# controller method to access like a json object
b. Send Ajax parameter without json,code similar to below:
function OnCountryChange() {
    $.ajax({
        url: "/OnCountryChange",
        type: "POST",
        datatype: "json",
        headers: {
            "RequestVerificationToken": $('input[name = __RequestVerificationToken]').val()
        },
        data: {sCountryCode: "Test 123"}
    });
}


text:
Q: Spring boot thymeleaf cannot access attributes I followed the spring boot thymeleaf tutorial here.
HelloController.java
@RestController
public class HelloController {

    @GetMapping({"/", "/hello"})
    public String hello(Model model, @RequestParam(value="name", required=false, defaultValue="World") String name) {
        model.addAttribute("name", name);
        return "hello";
    }
}

hello.html
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title th:text="'Hello, ' + ${name} + '!'"></title>
    <link href="/css/main.css" rel="stylesheet">

application.properties
spring.thymeleaf.check-template=true
spring.thymeleaf.check-template-location=true
spring.thymeleaf.enabled=true
spring.thymeleaf.suffix=.html
spring.thymeleaf.cache=false

The css and js files are identical as on the link above.
However when I go to the localhost:8080/hello?name=test, I only see the "hello" returned. Also, when in the hello.html, Intellij highlights ${name} and says cannot resolve name; though scouring the internet leads me to believe that this is an IntelliJ issue.
Note, when I debug, the name actually does get set in the Controller.
Am I missing something to tie in the model attribute and thymeleaf name?
Thanks


text:
Q: Rails combine searching by enum and find_or_initialize_by methods this question is based on this one: Rails find_or_create_by with/without where
I've experienced some strange issue about enum & find_or_initialize_by methods in rails.
Let suppose I have the model Task.
class Task < AR::Base
  enum status: { todo: 0, awaiting: 1, done: 2, another_one: 3, et.c. }

I want to find through todo and awaiting tasks, and if there is no exist, create a new one, but without a todo and awaiting value (status should be just nil). But, ActiveRecord::Enum strikes here!
This is the normal code in most cases:
Task.where(status: [Task.statuses[:todo], Task.statuses[:awaiting]]).find_or_initialize_by(title: 'epic')

But because of this string I get annoying '[0, 1]' is not a valid status exception. How can I avoid this exception without superfluous code?

A: When querying an enum attribute you should use the symbol representing the enum and not the actual integer column value:
@task = Task.where(status: [:todo, :awaiting])
            .find_or_initialize_by(title: 'epic')

Hence the '[0, 1]' is not a valid status since Rails is trying to be helpful and look up the enum values for you. In general you almost never need to use the actual integer value unless your are building a custom SQL string:
Task.where.not(status: :awaiting)

Rails also generates scopes based on the enum:
@tasks = Task.todo.awaiting.find_or_initialize_by(title: 'epic')
# or
@tasks = Task.todo.merge(Task.awaiting)
             .find_or_initialize_by(title: 'epic')

A: For now I see just one relatively cool solution. Will be great if somebody another gives solution better.

*

*Install gem 'active_record_union'

*Use it!
Task.todo.union(Task.awaiting).union(Task.starting)


text:
Q: Any grunt packages exist for including html partials from an external web source? I looked and I don't seem to see any grunt modules that can accommodate a url (http://domain.com/route) when pulling partials.
all of them seem to only pull from the local directory.
Ideally I could do something along the lines of
@@indlude(http://localhost:3000/something/else)

and it would pull in the html from that url.
I am using php to render partials with "good" fake content. It would save me a step if grunt could pull the rendered resources in when building the "dist"

A: If I understand you correctly, you're saying you can trigger generation of the source HTML markup by hitting a list of URLs. You want to save this generated source in a bunch of individual files so you can use them as template files (partials).
You could do this with grunt-curl, for example.
From there, you should be able to put something like this into your Gruntfile.js configuration file:
'curl-dir': {
  'task-name': {
    src: [
      'http://localhost:3000/something/else/a.html',
      'http://localhost:3000/something/else/b.html'
    ],
    dest: 'location/to/save/files'
  }
}

That grunt task should then save the markup source to the directory you specify by running the grunt task directly: grunt curl-dir:task-name.


text:
Q: Unable to access map field value in jquery I have a form in Drupal 8 that has this map field:

When I select a place, latitude and longitude are shown in the fields below but fields values are not updated:

And when I check values like console.log($('#edit-field-camp-localizacion-0-lat').val());, I get nothing.
Anyway, if I check field in depth like console.log($('#edit-field-camp-localizacion-0-lat'));, I can see the value in there:

So the question is: any idea on how can I get the value from a .js file?


text:
Q: Can't infer proper type myself in Kotlin when using JavaFX I just started to study Kotlin and JavaFX by following tutorial.
I could see blank JavaFX windows, and I proceed next step that using FXML.
import javafx.application.Application
import javafx.fxml.FXMLLoader
import javafx.scene.Scene
import javafx.stage.Stage

class AppMain : Application() {

    override fun start(primaryStage: Stage) {
        primaryStage.title = "Try JavaFX"
        val fxml = javaClass.getResource("fxml/Main.fxml")
        val root = FXMLLoader.load(fxml) // ERRORS here! `load`
        val scene = Scene(root)

        primaryStage.scene = scene

        primaryStage.show()
    }

}

However, I couldn't figure out that how to avoid the type inferencing error like:
Error:(12, 31) Kotlin: Type inference failed: Not enough information to infer parameter T in fun <T : Any!> load(p0: URL!): T! Please specify it explicitly.
From the message, I understand that I have to write the type of variable fxml explicitly.
But I have no idea that what type should be labeled to fxml.
I tried to read the document about JavaFX, but I couldn't figure it out.(I'm not familiar with Java and Kotlin)
I tried to type like URL but it does not make sense.
Many JavaFX & Kotlin example codes that I could find from google does not seems to have the problem like this. (Are the example codes written in previous version?)
What type should I put for the variable?
Or did I miss something other?
Environment and Codes
Environment

*

*JDK 11

*JavaFX 11

*Kotlin 1.2.71

My complete trial code
https://github.com/QuietJoon/StudyKotlin-JavaFX/tree/fxml

A: The problem isn't the parameter to the FXMLLoader.load function (which is a java.net.URL object, as returned by javaClass.getResource). It's that this function returns a generic type:
public static <T> T load(URL location)
The Kotlin compiler needs to know what type your root variable will be (as you've not explicitly defined it), but it can't know that as there's nothing in the code that will allow it to infer this.
A quick Google returned this example which has this code in it (in Java):
Parent root = FXMLLoader.load(getClass().getResource("fxml_example.fxml"));
As you can see here, the root variable is of type Parent.  So what you need to do is provide this type (i.e. what you expect the load function to return) in some way.  Here are two different ways you could do this:

*

*Specify the type explicitly when declaring the variable: val root: Parent = FXMLLoader.load(fxml)

*Specify the generic type when calling the method: val root = FXMLLoader.load<Parent>(fxml)
Note also that in your build.gradle file in your github repo there's a mistake that means the code didn't immediately compile when I fetched it:
compile "org.openjfx.javafx.fxml:11:$platform" should be compile "org.openjfx:javafx-fxml:11:$platform" (one of the dots should be a colon).


text:
Q: How to change language of an existing Pages for iCloud document? I have document that was created in Pages for Mac with the correct spelling/language (not English) settings for each paragraph. However, when I now try to edit this document using Pages for iCloud the spelling is set to English.
I have read several support documents about this
Pages for iCloud: Work in other languages
Pages for iCloud: Search, replace, and spell-check text
iCloud: Change the language or time zone on iCloud.com
as well as some "third party" suggestions, all to no avail.
I have made sure that the correct language is my primary language in my browser (Chrome), in my OS (Win 10), changed the language of the iCloud UI (through Settings), changed the format used by iCloud (also via Settings) but my document is still spelled in English.
I believe the first link above explains how one create a completely new document in a certain language but my document already exists.
How do I change the language used for spell-check on an existing document?

A: I also searched quite in vain...
You can change the Language & Region settings (the three dot button) using iPad or iPhone, then the document will appear in iCloud with the desired language.
Details here. Of course, you can also do that from a mac.


text:
Q: Ruby equivalent of lisp-like "apply"? I would like to create an instance method that takes another instance method of its own class as a parameter, and then applies the passed method on the instance it's working on (known as self):
class MyClass

  attr_reader :called_methods

  def initialize
    @called_methods = []
  end

  def my_first_method!
    @called_methods << :my_first_method
    self
  end

  def my_second_method!
    @called_methods << :my_second_method
    self
  end

  def my_strange_method!(secondary)
    # Want to apply method whose name is given by secondary, to self
  end
end

p MyClass.new.my_second_method!.my_strange_method!(:my_first_method!).called_methods

I suspect the unary & may be key, but all the web pages I can find on that operator involve calling methods on multiple objects, as when iterating over an Enumerable with #each or #map.

A: Use Object#public_send (or Object#send to apply protected/private method).
def my_strange_method!(secondary)
  public_send(secondary)
  self
end

p MyClass.new.
    my_second_method!.
    my_strange_method!(:my_first_method!).
    called_methods
#⇒ [:my_second_method, :my_first_method]

There could be more defensive way to apply if and only the method is known:
def my_strange_method!(secondary)
  raise ArgumentError.new("Unknown method #{secondary}") \
    unless methods.include? secondary.to_s.to_sym
  public_send(secondary)
end

p MyClass.new.
    my_second_method!.
    my_strange_method!(:my_first_method!).
    called_methods
#⇒ [:my_second_method, :my_first_method]

p MyClass.new.
    my_second_method!.
    my_strange_method!(:inexisting_method!).
    called_methods
#⇒ ArgumentError: Unknown method inexisting_method!

A: This is tagged with functional-programming so I'm going to offer a persistent (immutable) design -
class MyClass

  attr_reader :called_methods

  def initialize(m = [])
    @called_methods = m
  end

  def my_first_method!
    MyClass.new(called_methods + [ :first ])
  end

  def my_second_method!
    MyClass.new(called_methods + [ :second ])
  end

  def my_strange_method!(secondary)
    public_send secondary
  end
end

MyClass.new.my_second_method!.my_strange_method!(:my_first_method!).called_methods
# [:second, :first]