text:
Q: Using Prefix Lists in Security Groups if I was to use the AWS documentation for creating Security Groups using CloudFormation (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html), it appears lacking in what I am trying to achieve. There are plenty of examples where egress rules can be configured to use a CIDR value as the destination which is all very well and good.
But what I am trying to achieve is to use a prefix-list id (pl-112233) as a network destination
For example:
    "SecurityGroupEgress" : [{
        "IpProtocol" : "tcp",
        "FromPort" : 80,
        "ToPort" : 80,
        "CidrIp" : "0.0.0.0/0" # using prefix list example pl-112233
    }]

Unfortunately I cannot locate any support for this requirement and I want to understand if other's have met this difficulty. I should point out that these prefix lists pre-exist and don't need to be created as part of this CloudFormation.

A: Based on AWS::EC2::SecurityGroup Egress - AWS CloudFormation, it would seem that you can use:
 "SecurityGroupEgress" : [{
        "IpProtocol" : "tcp",
        "FromPort" : 80,
        "ToPort" : 80,
        "DestinationPrefixListId" : "pl-112233"
    }]


text:
Q: Can each of Jenkins-slave(kubernetes pod) to be bound to one build job while keep it alive even finished the job We are using kubernetes plugin for Jenkins to construct a special CI system. We want to achieve that:

*

*For a given build job(named job_A), it will be built more than one time;

*We hope this job job_A to be bound to a specific jenkins-slave(named pod_A), and the pod_A should only provide service for job_A.

*After the job_A finished the build, pod_A should keep alive for the period of time time_T;

*During the time_T, the pod_A should not build other jobs even through it is idle.

*After another time interval which is less than time_T(the pod_A is still alive), we want to re-build the job_A, it will be send to pod_A and be build there.
Is there any way to achieve this?

A: In the PodTemplate definition there is an option idle time Time in minutes to retain slave when idle (time_T) that you can set to a large value.
Then set the label of the pod template to a unique value and same label in your job. That way that pod will only take builds of that job

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to delete and add nodes to/from Dynatree prog how to delete and add nodes to/from Dynatree without disturbing other node?
I have a Dynatree with check box And a user can add / remove nodes from a list of nodes in a pop up. While updating the data should be added / remove with out disturbing the previously checked nodes.


text:
Q: Gradient Layer in Navigation Bar in iOS 11 After adding gradient layer in navigation bar, I don't see any right/left bar button items when i run on iOS 11. But the same code displays well on iOS 10/9..
Can anyone provide your valuable suggestions to fix this
override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    setUpGradientNavigationBar()
}

func setUpGradientNavigationBar() {

    let lightRedColor = UIColor(red: CGFloat(197/255.0), green: 47/255.0, blue: 40/255.0, alpha: 1.0).cgColor
    let mediumRedColor = UIColor(red: CGFloat(176/255.0), green: 42/255.0, blue: 36/255.0, alpha: 1.0).cgColor
    let darkRedColor = UIColor(red: CGFloat(106/255.0), green: 25/255.0, blue: 22/255.0, alpha: 1.0).cgColor
    let colors = NSArray(objects: lightRedColor, mediumRedColor, darkRedColor)

    let gradientLayer = getGradientLayerForColors(colors, location: 0.5, andFrame: self.navigationController?.navigationBar.bounds)

    self.navigationController?.navigationBar.barTintColor =  UIColor.black
    self.navigationController?.navigationBar.layer.insertSublayer(gradientLayer, at: 1)
    self.navigationController?.navigationBar.tintColor = UIColor.white

    self.navigationController?.navigationBar.topItem?.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.cancel, target: nil, action: nil)

}

func getGradientLayerForColors(_ colors: NSArray, location:CGFloat, andFrame frame:CGRect?) -> CAGradientLayer {
    let gradientLayer = CAGradientLayer()
    gradientLayer.colors = colors as [AnyObject]
    gradientLayer.locations = [0.0,NSNumber.init(value: Float(location))]
    gradientLayer.frame = frame!
    return gradientLayer
}

A: Swift 5

*

*Includes status bar in gradient.

*Doesn't use an image.

*Uses transparency so content is visible through nav bar.

extension UINavigationBar {

    func addGradient(_ toAlpha: CGFloat, _ color: UIColor) {
        let gradient = CAGradientLayer()
        gradient.colors = [
            color.withAlphaComponent(toAlpha).cgColor,
            color.withAlphaComponent(toAlpha).cgColor,
            color.withAlphaComponent(0).cgColor
        ]
        gradient.locations = [0, 0.8, 1]
        var frame = bounds
        frame.size.height += UIApplication.shared.statusBarFrame.size.height
        frame.origin.y -= UIApplication.shared.statusBarFrame.size.height
        gradient.frame = frame
        layer.insertSublayer(gradient, at: 1)
    }

}


text:
Q: Mongoose 4.x "model.update()" callback changed Before mongoose 4.x, in update(), you can check the 2nd parameter in callback to see if the document is found. In example below, you can use "rowAffected" to see if there exists a document with username john.
model.update({ username: "john" }, { ... }, function(err, rowAffected){
    if (rowAffected) // document found

But now from mongoose 4.x, the 2nd parameter in callback becomes the raw output of MongoDB from update operation. So to find if document exists I have to do raw.n
model.update({ username: "john" }, { ... }, function(err, raw){
    if (raw.n) // document found

My question is are "rowAffected" and "raw.n" the same thing? If so, is it safe to replace all rowAffected by raw.n when migrating from 3.x to 4.x?

A: Yes, they are the same thing. According to the 4.0 release notes:

#2552: Upgraded mongodb driver to 2.0.x. Mongoose is a wrapper layer on top of the MongoDB node driver. The mongodb driver recently
  released version 2.0, which includes numerous performance and
  usability improvements. The new driver, however, introduces a few
  changes that affect the way you use Mongoose:

*

*If you are connecting to
  a replica set, you must specify the replicaSet option in the
  connection string.

*update returns a result object from the MongoDB
  server, rather than just the number affected. The second parameter to
  the callback will now look like { ok: 1, n: 3 } rather than simply the
  number affected.


text:
Q: Umbrella term for "penalty" and "bonus" On Academia SE, there is a proposal to create a tag covering leniency and penalties towards students, where leniency is about not applying penalties or giving exceptional allowances or a bonus to a student due to mitigating circumstances or similar. Since leniency-and-penalties is pretty clumsy for a tag name, I am wondering whether there exists a better term covering both cases.
Given that in these context, penalty (or malus) is an antonym of the result of leniency (or bonus), it seems plausible to me that such a term exists. It feels as if it the term on the tip of my tongue (though I might be wrong about this or it may be in another language).
Indeed, the word handicap as used in sports and similar¹ fits these requirements, but this is usually not applied the intended context nor is it suited as a tag name, as it is also a synonym of disability, which is another, distinct tag.
Therefore I am asking for another umbrella term that generalises penalty, malus, allowance, bonus, and so on.

¹ "An allowance […], granted in a race (or other contest of skill) to the competitor possessing disadvantages; or an additional […] hindrance imposed upon the one possessing advantages, in order to equalize, as much as possible, the chances of success." (Wiktionary)

A: Why not use terms used by educators when grading, like 'adjustment' or 'curve'?
Adjustment (MW, definition 5)

a correction or modification to reflect actual conditions

Curve (MW, noun definition 4)

a distribution indicating the relative performance of individuals measured against each other that is used especially in assigning good, medium, or poor grades to usually predetermined proportions of students rather than in assigning grades based on predetermined standards of achievement

For actual tag names, you could use 'grade-adjustment' or 'grade-on-a-curve'.

A: Almost everything on the list in the referenced Academia Meta question seems to be related to grading policies -- grading of homework, grading of projects, grading of quizzes, grading of exams.  So I will propose:

grading-policy or grading-policies

Maybe some would say that adjusting an exam or quiz date would not fall under that umbrella -- but I personally think it does, indirectly.
Academia SE already has tags for "grades" and "grading."  I confess I don't understand the difference.  I'm guessing neither one covers what you want, because otherwise you wouldn't be asking!
There is already a tag for "policy," but policy could refer to policies about encouraging and supporting diversity, sexual harassment, sexual conduct between a student and a teaching assistant, plagiarism, lab safety, leave of absence, etc., etc.  (I have not looked at the questions that have been tagged with "policy" -- I will.)
Your question here also made mention of the concepts of handicap and adjustment.  I can see that these concepts might sometimes overlap orthogonally with a grading-policy tag, since various disabilities might call for adjustments to be made that could result in exceptions being made to a particular grading policy.  In the United States, at least, there is already a word for academic adjustments which are made due to a student's disability: accommodations or reasonable accommodations.
There is a whole legal framework in the U.S. for providing academic accommodations for a student with a disability, through a legally binding document called a "Section 504 Accommodation Plan," or "504 Plan," for short.  This legal framework applies to both grade school and higher education (although of course there are some nuances).  Here are some examples of adjustments that one might see in a 504 plan:

*

*hand in assignments later than the official due date

*take exams in a separate location

*use proportionally more time for exams

*take a 10-minute movement break every 40 minutes during an exam

*have access to a portable word processor for writing exams (there might be qualifications to this, such as, turn off the spell checker, turn off the grammar checker, be disconnected from the internet)

*large type format
Note that although the 504 plan is a legally binding document, it is not (normally, at least!) drawn up by lawyers or judges.  (Also note that one could also, in principle, speak of "504 accommodations" in the workplace, or in health care.)
Careful documentation must be submitted to the university for a student to establish 504 eligibility, and for specific accommodations to be included in the student's 504 plan.  The federal government (I'm still talking about the U.S. here) has provided the legal framework, but each educational institution must establish its own 504 policy and procedures, within that framework.
The government website doesn't do a great job of providing a concise overview; colleges and universities in the U.S. vary in the amount and extent of explanation they provide on their websites regarding their 504 policy and procedures.  Here's a reasonably concise yet informative one from Penn State: http://equity.psu.edu/student-disability-resources/considering-penn-state/reasonable-accommodations
Academia SE has international scope, of course.  I have tried to find out what the analogous terminology, legal framework, and customs are in Europe, through questions posed on Academia SE and Law SE, but so far these attempts have gotten me... absolutely NOWHERE.  Therefore, I would suggest that Academia SE begin with the following:

academic-accommodations or reasonable-accommodations

Hopefully, over time, this could be given some tag synonyms to incorporate the terminology used in other parts of the world.
I have to be honest, I proposed a tag of this sort a while back -- see https://academia.meta.stackexchange.com/questions/2050/need-new-tag-for-504-plan-and-or-504-accommodations; the idea didn't get any traction.  I hope that won't prevent you from seriously considering the idea.


text:
Q: Route internet traffic to isolated vm I got two VMs, i want VM-2 to be an isolated host, forced to route it's traffic through VM-1. So for example if i use a VPN on VM-1 this will affect VM-2.
VM-1:
Windows 7, 2 NICs
192.168.1.80 255.255.255.0 Bridged networking
192.168.50.2 255.255.255.0 VLAN1

VM-2:
Debian 7, 1 NIC
192.168.50.3 255.255.255.0 VLAN1

Is this possible? Thanks in advance for any help.

A: If you set VM-1 to share it's internet and VM-2 to route all it's traffic through VM-1 this should work. You can set this setting either with ip route or route command.
I guess this should be the configuration needed on VM-2:
ifconfig eth0 192.168.50.3/24
route add default gw 192.168.50.2

Note: that as far as I remember, vmplayer/vmware workstation creates a few virtual network cards, one is for the host private network, one is for the nat network. If both VM-1 and VM-2 use host private network, they should be ok.


text:
Q: Is it true that any continuous probability distribution gives probability zero to any single element in the sample space? Let $p$ be some probability distribution with a density $f$.
$p$ is defined over $\Omega$.
Is it true that for any $\omega \in \Omega$, $p(\omega) = 0$?
If not, what are the "minimal conditions" under which $p(\omega) = 0$ for any $\omega$ (the space $\Omega$ is actually a subset of $\mathbb{R}^d$ for some $d$)?

A: The OP asks for a precise mathematical answer to an imprecise question. For example, the term "probability distribution" has a very precise meaning in terms of the measure transfered by some random object from some probability space to its image, but here you have only one probability space, and no random object. I will try to give an answer in his original setting.
Suppose that you have a measurable space $(\Omega,\mathscr{F}$), where $\Omega=\mathbb{R}$ and $\mathscr{F}$ is the class of Borel subsets of $\mathbb{R}$. The extension to higher dimensions adds nothing conceptually.
You have a probability measure $P$ over $(\Omega,\mathscr{F}$), and you say that $P$ has a density $f$. What does that mean exactly? It means that you have a measure (not necessarily a probability measure) $\lambda$ over $(\Omega,\mathscr{F}$) and
$$
  P(B) = \int_B f(\omega)\,d\lambda(\omega) \, ,
$$
for every $B\in\mathscr{F}$, where the nonnegative $f$ is such that $\int_\mathbb{R}f\,d\lambda=1$.
The measure $\lambda$ dominates $P$, in the sense that for every $B\in\mathscr{F}$, if $\lambda(B)=0$ then $P(B)=0$.
Note that for each $\omega\in\Omega$, the singleton $\{\omega\}\in\mathscr{F}$, so it is legal to talk about $P(\{\omega\})$, and that is the substance of the point raised by the comment made by whuber.
Now, to answer your question "Is it true that $P(\{\omega\})=0$ for every $\omega\in\Omega$?", consider two cases.

*

*Let $\lambda$ be Lebesgue measure. In this case, the answer is clearly "Yes", because $\lambda(\{\omega\})=0$ for every $\omega\in\Omega$, and $\lambda$ dominates $P$.

*Let $\lambda$ be such that $\lambda(\mathbb{R})=2$, and $\lambda(\{0\})=\lambda(\{1\})=1$. Let a function $f$ be defined by $f(0)=1/4$, $f(1)=3/4$, and define $f(\omega)$ arbitrarily for $\omega\notin \{0,1\}$. Now, define a probability measure $P$ over $(\Omega,\mathscr{F})$ by
$$
  P(B) = \int_B f(\omega)\,d\lambda(\omega) \, .
$$
This $P$ is a genuine probability measure, it has density $f$ with respect to $\lambda$, but
$$
  P(\{0\}) = \int_{\{0\}} f(\omega)\,d\lambda(\omega) = f(0) \cdot \lambda(\{0\}) = \frac{1}{4} \, ,
$$
and
$$
  P(\{1\}) = \int_{\{1\}} f(\omega)\,d\lambda(\omega) = f(1) \cdot \lambda(\{1\}) = \frac{3}{4} \, ,
$$
Hence, in this case the answer is "No".
Short answer: it depends on the dominating measure.

A: I'd like to share the answer to this question with you in very simple words. Because I also wondered in my early days on why R gives a value when I input a single value in any density function of a continuous variable, say for example in dnorm. As I know for a particular value the probability should be zero.
Here an important thing to be noticed is that if you manually put the value of the random variable, say, $X$, in the form of the probability density function (p.d.f.) of a continuous random variable, then you do not get the probability. What you get is called simply the 'ordinate'. If you consider a X-Y plane, then this value is the $Y$ coordinate value against your value for $X$ coordinate.
Following is a practical example of why a particular point gives probability zero in a continuous probability distribution:
While for a discrete distribution an event with probability zero is impossible (e.g. rolling 3½ on a standard die is impossible, and has probability zero), this is not so in the case of a continuous random variable. For example, if one measures the width of an oak leaf, the result of 3½ cm is possible, however it has probability zero because there are uncountably many other potential values even between 3 cm and 4 cm. Each of these individual outcomes has probability zero, yet the probability that the outcome will fall into the interval (3 cm, 4 cm) is nonzero. This apparent paradox is resolved by the fact that the probability that $X$ attains some value within an infinite set, such as an interval, cannot be found by naively adding the probabilities for individual values. Formally, each value has an infinitesimally small probability, which statistically is equivalent to zero.


text:
Q: Which of these approaches gives the correct solution to the system of PDEs I'm trying solve a somewhat complicated system of PDEs using the Fourier transform. For the sake of completeness, the system is
\begin{align}
\frac{\partial T}{\partial t}-K_x\frac{\partial^2 T}{\partial x^2}-K_z\frac{\partial^2 T}{\partial z^2} &= 0 \\
(1-2\nu) \left(\frac{\partial^2 u_x}{\partial x^2}+\frac{\partial^2 u_x}{\partial z^2} \right)+\frac{\partial^2 u_x}{\partial x^2}+\frac{\partial^2 u_z}{\partial x\partial z} &= 2(1+\nu)\alpha\frac{\partial T}{\partial x} \\
(1-2\nu) \left(\frac{\partial^2 u_z}{\partial x^2}+\frac{\partial^2 u_z}{\partial z^2} \right)+\frac{\partial^2 u_x}{\partial x\partial z}+\frac{\partial^2 u_z}{\partial z^2} &= 2(1+\nu)\alpha\frac{\partial T}{\partial z}
\end{align}
where $u_{j} = u_{j}(t, x, z)$, and $T = T(t, x, z)$. The boundary conditions are
$$\lim_{z \to \infty} T(t, x, z) = 0, \qquad \frac{\partial T(t, x, 0)}{\partial z} = \frac{Q_0 \cos(q_0x)\delta(t)}{k_{z}}$$
while those for $u_x$ and $u_z$ are not relevant for this question.
Transforming to Fourier space ($x\rightarrow q$) and ($t\rightarrow \omega$) is pretty straightforward, and so is finding the solutions in Fourier space. I'm particularly interested in $u_z(t, x, 0)$, which in Fourier space is
$$\hat{u}_z(\omega,q,0)=\frac{A\eta(q)}{\beta(\beta+q)}$$
where $\eta(q)$ is a Fourier transform of $\cos(q_{0} x)$, which comes from the boundary condition for $T$. I packed the constants in $A$ and defined $\beta=\sqrt{\frac{q^{2} K_x + i \omega}{K_z}}$. Now I have to do inverse Fourier transforms ($q\rightarrow x$) and ($\omega\rightarrow t$). First, I do the inverse Fourier in time domain. I solve the integral using a Feynman trick, it's a bit lengthy so I won't go into detail, but the result is
$$\hat{u}_z(t,q,0)=B\eta(q)e^{-(K_x-K_z) q^{2} t} \text{erfc}(q\sqrt{K_zt})$$
Now, I can think of 3 approaches that in my mind should all lead to the same result.

*

*$\eta(q)=\frac{1}{2}(\delta(q-q_0)+\delta(q+q_0))$, which after the inverse Fourier in $x$ gives
$$u_z(t,x,z=0)=Ce^{-q_0^2(K_x-K_z)t}(\cos(q_0x)-i\sin(q_0x)\text{erf}(q_0\sqrt{K_zt}))$$

*Let's replace $\cos(q_0x)$ in the boundary condition with $e^{iq_0x}$. In the end we will take a real part of the complex result. Then, $\eta(q)=\delta(q-q_0)$, which after taking only a real part leads to solution
$$u_z(t,x,z=0)=Ce^{-(K_x-K_z)q_{0}^{2}t} \cos(q_0x) \text{erfc}(q_0\sqrt{K_zt})$$

*Let's replace $\cos(q_0x)$ in the boundary condition with $e^{-iq_0x}$. In the end we will take a real part of the complex result. Then, $\eta(q)=\delta(q+q_0)$, which after taking only a real part leads to solution
$$u_z(t,x,z=0)=-Ce^{-(K_x-K_z)q_{0}^{2} t}\cos(q_0x)(1+\text{erf}(q_0\sqrt{K_zt}))$$
So my question is, why does each of these approaches lead to a different solution and where exactly did I go wrong in the two that are incorrect. In the paper I'm studying, the authors don't explain the entire derivation, but the end result they state is the one from approach 2). It also does satisfy the initial equations.
Edit: Since there has been no answers or comments so far, I decided to share some of my findings. All three approaches lead to a solution that satisfies the initial system of PDEs. However, only approach 2 leads to a solution that also satisfies both boundary conditions. Approaches 1 and 3 do not satisfy $\lim\limits_{z \to \infty} u(t, x, z) = 0$, which was enforced early on by removing certain terms from the general solution. So somehow the approaches 1 and 3 reintroduced the terms that don't vanish at $z\rightarrow\infty$ and I would like to learn why that is so.


text:
Q: php json array problems I am creating a json array in PHP like this (it's inside a class):
$STH = $DBH->query("SELECT ID,title,content FROM table WHERE ID= '".$ID."' ");
$querycount = $STH->rowCount();
if($querycount!=0):
    $STH->setFetchMode(PDO::FETCH_OBJ);
    while( $row = $STH->fetch()) :
        $thread[$row->ID]['title'] = $row->title;
        $thread[$row->ID]['content'] = $row->content;
    endwhile;
    $this->querycount = $querycount;
    $this->thread = json_encode($thread);
 else:
    $this->querycount = $querycount;
 endif;

But I seem to get "strange" decodes the other end. I cannot actually reference the array by key's;
So far it will let me do this: (Where af_threads is the class name and $key id the ID in the table query)
$threads = new af_threads($key,$DBH);
$threads = json_decode($threads->thread);
foreach($threads as $key1=>$thread):
    foreach($thread as $key2=>$val):
        echo $key2;
        echo $val;
    endforeach;
    echo '<hr />';
endforeach;

But what it will not let me do is something like this
$threads[$key]['title']

I'm not sure why.  As the class builds i.e. with more rows etc. I will need to call specific rows in specific places. i.e. $threads[$key]['newrow'], $threads[$key]['newrow2'], and or to manipulate a row with say substr(); etc.
Yes I know I could just echo out an array without json, but eventually I want to add cross domain functionality with JQuery getJSON() ...
Have I got it all wrong?

A: By default, json_decode() returns stdClass, modify second line with
$threads = json_decode($threads->thread, true)

and you will get an associative array and be able to reference it by keys, $threads[$key]['title'] for example.


text:
Q: D3DXCreateTextureFromFileEx Access Violation (nvd3dum.dll) I am trying to create a game and I need sprites so I have built a small image class that creates a texture from a file but something really weird is happening.
Sometimes it works (like 80% of the times) but sometimes it crashes with the following error
Unhandled exception at 0x6BFC2B06 (nvd3dum.dll) in Application.exe:
0xC0000005: Access violation reading location 0x00000010.

I do not think that there is a bug in the nVidia drivers but rather in my code.
I am not 100% sure that the problem lays within my Image class but when I do not create any Images it does not crash .
I have no idea how to pinpoint the exact location of the error, is there something wrong with my Image class or should I look elsewhere.
CImage.h:
class CImage {
public:
    CImage(COverlay* overlay, const char* fileName, int w, int h);

    void draw(float x, float y, Color c = Color::White());

    int getWidth();
    int getHeight();

private:
    COverlay* _overlay;
    const char* _fileName;

    int _w;
    int _h;

    LPDIRECT3DTEXTURE9 _texture;
    LPD3DXSPRITE _sprite;
};

CImage.cpp:
CImage::CImage(COverlay* overlay, const char* fileName, int w, int h) {
    _overlay = overlay;
    _fileName = fileName;
    _w = w;
    _h = h;

    int eCode;
    if (FAILED(eCode = D3DXCreateTextureFromFileEx(overlay->GetDevice(), fileName, w, h, D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0xFFFF00FF, NULL, NULL, &_texture))) {
        std::string error_msg = "There was an error creating the texture for an image. Make sure the file is available. Requested file: ";
        error_msg += fileName;
        error_msg += ", Error: ";
        switch (eCode) {
        case D3DERR_INVALIDCALL:
            error_msg += "D3DERR_INVALIDCALL";
            break;
        case D3DERR_NOTAVAILABLE:
            error_msg += "D3DERR_NOTAVAILABLE";
            break;
        case D3DERR_OUTOFVIDEOMEMORY:
            error_msg += "D3DERR_OUTOFVIDEOMEMORY";
            break;
        case D3DXERR_INVALIDDATA:
            error_msg += "D3DXERR_INVALIDDATA";
            break;
        case E_OUTOFMEMORY:
            error_msg += "E_OUTOFMEMORY";
            break;
        }
        error_msg += ".";
        MessageBox(NULL, error_msg.c_str(), "Error", NULL);
        exit(1);
    }

    if (FAILED(D3DXCreateSprite(overlay->GetDevice(), &_sprite))) {
        MessageBox(NULL, "There was an error creating a DirectX sprite.", "Error", NULL);
        exit(1);
    }
}

void CImage::draw(float x, float y, Color c) {
    if (_texture && _sprite) {
        _sprite->Begin(D3DXSPRITE_ALPHABLEND);

        D3DXVECTOR3 pos = { x, y, 0 };
        _sprite->Draw(_texture, NULL, NULL, &pos, c.Code());

        _sprite->End();
    }
}

int CImage::getWidth() {
    return _w;
}

int CImage::getHeight() {
    return _h;
}

Code to create the images (when this is commented out the application does not crash):
    CMenuBox::_boxHeader = new CImage("../plaatjes/box_header.png", 152, 40);
    CMenuBox::_boxPattern = new CImage("../plaatjes/box_pattern.png", 152, 1);
    CMenuBox::_boxBottom = new CImage("../plaatjes/box_bottom.png", 152, 16);
    CMenuBox::_boxDivider = new CImage("../plaatjes/divider.png", 134, 2);

Any help would be greatly appreciated.


text:
Q: jQuery how to get div element value from radio button and assign value to a specific div Here I need to get the selected radio button value (123,456,789) and assign it to valueee div element? I used document.getElementsById, but couldn't get what I need.
Any help would be highly appreciated.

<!DOCTYPE html>

  <title>Radio Button Selection</title>

  <form id="myform">

Choose option:

      <input type="radio" name="user_options" />

123

    CSS

      <input type="radio" name="user_options" />

456

    html

      <input type="radio" name="user_options" />

678

    jquery

      <input type="radio" name="user_options" />

675

    JS

<button id="radio_submit" type="button">Show Selected Radio</button>

  </form>

A: jQuery
$(document).ready(function() {
    $("#radio_submit").click(function (e) {
        var checked_option_radio = $("input[name=user_options]:checked").val();
    });
});

Full Code

$(document).ready(function() {
    $("#radio_submit").click(function (e) {
     var checked_option_radio = $("input[name=user_options]:checked").val();
     if(checked_option_radio===undefined){
          alert('Please select options!');
     }else{
          alert("inside else");
          $('#valueee').html(checked_option_radio);
     }
    });
});

<form id="myform">

Choose option:

<input type="radio" name="user_options" value="456"/>

123

CSS

<input type="radio" name="user_options" value="456" />

456

html

<input type="radio" name="user_options" value="678" />

678

jquery

<input type="radio" name="user_options" value="675" />

675

JS

<button id="radio_submit" type="button">Show Selected Radio</button>

</form>

Check jsFiddle

A: I am adding a class for selected radio button parent div,based on the class I am getting the next div text and printing in the desired place using Jquery.

Rename the name=deff to class=deff.
    $("#radio_submit").click(function (e) {
    var checked_option_radio = $(this).closest('form').find('div').hasClass('selected');
    if(checked_option_radio) {
        var hello = $('.selected').next('.deff').text();
        $('#valueee').html(hello);
    } else {
        alert('nothing selected');
        var hello2 = "no radio button is selected"
        $('#valueee').html(hello2);
    }
 });
$('input').on('click',function(){
    if (!$("input").is(':checked')) {
                              $(this).parent().addClass('selected').siblings().removeClass('selected');
    }
    else {
             $(this).parent().addClass('selected').siblings().removeClass('selected');
    }
});

<form id="myform">

Choose option:

<input type="radio" name="user_options" />

123

CSS

<input type="radio" name="user_options"  />

456

html

<input type="radio" name="user_options"  />

678

jquery

<input type="radio" name="user_options" />

675

JS

<button id="radio_submit" type="button">Show Selected Radio</button>

</form>

http://jsfiddle.net/silpa/xeb9hoyr/2/
Here is the updated code to get input value
var check_div = $('.selected').next().is('div');
        var check_input = $('.selected').next().is('input');
        var div_value = $('.selected').next('.deff').text();
        var input_value = $('.selected').next('input').val();
        if(check_div){
            $('#valueee').html(div_value);
        }
        if(check_input){
         $('#valueee').html(input_value);
        }

http://jsfiddle.net/silpa/xeb9hoyr/9/

A: since you have the jquery library implemented use
 $('#divid').val(somevalue);


text:
Q: LOC() for user defined types gives different results depending on the context I'm trying to debug some code in which members of a user defined object mysteriously change addresses, and while doing that I realized user defined objects do that as well. Here's a small example of querying object address from function that created it and then from its member function:
  module foo_module

    type foo_type
      contains
        procedure :: foo
    end type foo_type

    contains

      subroutine foo(this)
        class(foo_type) :: this
        print *, 'Inside foo this is', loc(this)
      end subroutine foo

  end module foo_module

  program trial

    use foo_module
    type(foo_type) :: object

    print *, 'Object address', loc(object)
    call object%foo()

  end program trial

A sample output I get is:
Object address            4452052800
Inside foo this is       140734643354880

Why am I getting two different addresses for the same object? Am I doing something wrong? Or is there something with LOC that comes into play I don't understand?
I'm using ifort under osx.

A: LOC is an extension.  Its behaviour is as specified by the compiler vendor.
What the behaviour intended by the vendor here isn't clear, but the difference that you are seeing is that in the main program you get the integer equivalent of the memory address of the non-polymorphic object (what you probably expect), while in the subroutine you get the integer equivalent of the memory address of the polymorphic descriptor for the object (maybe what you want, maybe not).
Using TRANSFER(C_LOC(xxx), 0_C_INTPTR_T) is a more portable way of getting the integer representation of the address of an object (where the C_* things are from the ISO_C_BINDING intrinsic module).  C_LOC requires that its argument have the TARGET attribute and be non-polymorphic (use SELECT TYPE).
I'd recommend asking on the relevant Intel Forum if you want further clarification on the intended behaviour of the LOC extension.

A: I reported the bug to the developers  our internal issue ID is DPD200253159. I found that the C_LOC function from ISO_C_BINDING works. For example:
  subroutine foo(this)
    use, intrinsic :: iso_c_binding
    class(foo_type) :: this
    print *, 'Inside foo this is', transfer(c_loc(this),0_C_INTPTR_T)
  end subroutine foo