Q: Drawstring on a panel change when other panel move over I draw a rectangle panel with every button click. After that add a line on the edge of the rectangle and text on the center. But when I drag a panel move over other panel. The panel string will change. Please advice. I can't upload an image. How can I upload an image like that can show my problem more clearly.
This link http://i3.photobucket.com/albums/y53/ctkhai/1-4.png show the gui of my software. The upper left and lower left are picturebox. User add a "box" when click on button once and the "box" will show on upper left. User can drag the box to lower right and arrange all the box.
now the problem is when user drag the new added "box" and move over some other "box", the text i draw on previous box will change. like this  http://i3.photobucket.com/albums/y53/ctkhai/2-4.png.
Update: I try to create a class for the tag. but it won't work, the number change again. It is the way I create class for the tag and read is wrong? code like below
Product _box = new Product();
List<Panel>product = new List<Panel>();

public  class Product
{
    public  float X { set; get; }     //box coordinate
    public  float Y { set; get; }     //box coordinate
    public  int rotate { set; get; }
    public  int entryP { set; get; }
    public  int boxName { set; get; }

}

private void button_RecAdd_Click(object sender, EventArgs e)
{

   locX = pictureBox_conveyor.Left + (pictureBox_conveyor.Width / 2 - box_y / 2);
   locY = pictureBox_conveyor.Top + (pictureBox_conveyor.Height / 2 - box_x / 2);

   _box.boxName = panelBoxNo;
   _box.entryP = 1;
   _box.rotate = 0;
   _box.X = locX;
   _box.Y = locY;

   Panel box = new Panel();
   box.Location = new Point(locX, locY);
   box.Name = "box" + panelBoxNo;
   box.Tag = _box;
   box.Size = new Size(box_y, box_x);
   box.BackColor = boxColor;
   pbW = box.Width;
   pbH = box.Height;
   box.MouseDown += panelBox_MouseDown;
   box.MouseMove += panelBox_MouseMove;

   box.Paint += new PaintEventHandler((s, m) =>
   {

       Graphics g = m.Graphics;
       g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;]

       Product b = box.Tag as Product;

       string text = b.boxName.ToString();

       SizeF textSize = m.Graphics.MeasureString(text, Font);
       PointF locationToDraw = new PointF();
       locationToDraw.X = (pbW / 2) - (textSize.Width / 2);
       locationToDraw.Y = (pbH / 2) - (textSize.Height / 2);

       g.DrawString(text, Font, Brushes.Black, locationToDraw);
       g.DrawRectangle(new Pen(Color.Black), 0, 0, pbW - 1, pbH - 1);
       g.DrawLine(drawLine, 0, 0, 0, pbH);

   });

   product.Add(box);
   panel_pelletLayout.Controls.Add(box);
   box.BringToFront();
   label_boxNo.Text = panelBoxNo.ToString();
   panelBoxNo++;

}

private void panelBox_MouseDown(object sender, MouseEventArgs e)
    {
        Panel p = sender as Panel;

        if (e.Button == MouseButtons.Left)
        {
            xPos = e.X;
            yPos = e.Y;

            if (p != null)
            {
                activePnlBox = p.Name;
                textBox_selectedName.Text = p.Name;
                textBox_selectedX.Text = p.Left.ToString();
                textBox_selectedY.Text = p.Top.ToString();

            }
        }
    }

private void panelBox_MouseMove(object sender, MouseEventArgs e)
    {
        Panel p = sender as Panel;

        if (p != null)
        {

            if (e.Button == MouseButtons.Left)
            {

                p.Left = ((e.X + p.Left - (p.Width / 2)) / gripGap) * gripGap;
                p.Top = ((e.Y + p.Top - (p.Height / 2)) / gripGap) * gripGap;

                textBox_selectedX.Text = p.Left.ToString();
                textBox_selectedY.Text = p.Top.ToString();

            }
        }
    }

A: Your Paint event handler has to be responsible for drawing everything each time. Your code looks like it only draws one object.
When you drag something over your box, the box becomes invalid and needs to be painted from scratch which means it erases everything and calls your Paint handler.  Your Paint event handler then just draws one object.
I suspect that what you want to do is keep a data structure of each item you draw and then have a loop in your Paint event handler that will draw all the objects you add.

A: Don't use variables that you defined outside a loop, in the paint event. That might be your problem.
Try to paint ((Panel)s).Name. Does this work properly?

A: Your title has got all of us confused.. You don't draw Rectangles, you create new Panels on each ButtonClick, right?
The code for the Paint event is not quite right, though. Just like in any Paint event you should use the built-in Graphics object. And as Hans has noted, you should not destroy/dispose things you didn't create.
The main problem you describe seems to be that your boxes have to paint themselves without referring to their real numbers. You should store their numbers e.g. in their Tags..
(Or you could extract it from their Names, like you do it in the MouseDown!)
box[panelBoxNo].Name = "box" + panelBoxNo;
box[panelBoxNo].Tag =  panelBoxNo;                     // < === !!
//..

box[panelBoxNo].Paint += new PaintEventHandler((s, m) =>
{
   Graphics g = m.Graphics;                            // < === !!
   g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
   string text = box[panelBoxNo].Tag.ToString();       // < ===
   SizeF textSize = g.MeasureString(text, Font);
   PointF locationToDraw = new PointF();
   locationToDraw.X = (pbW / 2) - (textSize.Width / 2);
   locationToDraw.Y = (pbH / 2) - (textSize.Height / 2);

   g.DrawString(text, Font, Brushes.Black, locationToDraw);
   g.DrawRectangle(new Pen(Color.Black), 0, 0, pbW - 1, pbH - 1);
   g.DrawLine(drawLine, 0, 0, 0, pbH);
   //  g.Dispose();                       // < === !!

  //  m.Graphics.DrawImageUnscaled(drawBox, new Point(0, 0));         // < === !!
  // m.Dispose();                       // < === !!
});

And, as I have noted you should only use arrays if you (or the code) really knows the number of elements. In your case a List<Panel> will be flexible to hold any number of elements without changing any other part of the code, except the adding. You can access the List just like an Array. (Which it is behind the scenes..)
Update: The way I see it now, your problems all are about scope in one way or another.
Scope in its most direct meaning is the part of your code where a variable is known and accessible. In a slightly broader meaning it is also about the time when it has the value your need.
Your original problem was of the latter kind: You accessed the partNo in thr Paint event of the Panels, when it had long changed to a new, probably higher value.
Your current problem is to understand the scope of the variables in the ButtonClick event.
Usually this is no problem; looking at the pairs of braces, the scope is obvious.  But: Here we have a dynamically created Lambda event and this is completely out of the scope of the Click event!! Behind the scenes this Paint event is removed from the Click code, placed in a new event and replaced by a line that simply adds a delegate to the Paint handler just like any regular event.
So: nothing you declare in the ButtonClick is known in the Paint code!
To access these data you must place them in the Panel properties, in our case in the Tag and access them via casting from the Sender parameter s!
So you need to change this line in the Paint event
Product b = box.Tag as Product;

to something like this:
Product b = ( (Panel) s ).Tag as Product;


Q: If $\mu$ equals Haar measure on the 3-dimensional unit sphere $S^2$, then $\hat{\mu}(\varepsilon) = \dfrac{2\sin(2\pi |\varepsilon|)}{|\varepsilon|}$. If $\mu$ equals Haar measure on the 3-dimensional unit sphere $S^2$, then $\hat{\mu}(\varepsilon) = \dfrac{2\sin(2\pi |\varepsilon|)}{|\varepsilon|}$.
I am not quite sure how to start this problem. First of all, I can't figure out the formula for the $\mu$ itself, let alone computing its Fourier transform.
The only I can make sense of $\hat{\mu}$ is when I view $\mu$ as a distribution but even in that case I don't know where to begin with.
Any help is appreciated.
Answer:
Here is my attempted solution after looking at given suggestions below.
$$\hat{\mu}(\varepsilon) = \int_{S^2} e^{-i\varepsilon\cdot x}dx =4\pi \int_{S^2} e^{-2\pi i\varepsilon\cdot\gamma} d\sigma(\gamma)\, (1)$$, where $d\sigma(\gamma)$ is the surface element of $S^2$. Because $\mu$ is rotationally invariant, so is its Fourier transform. In other words, the above integral is radial in $\varepsilon$. Hence, it suffices to assume that if $|\varepsilon| = \rho$, then $\varepsilon = (0,0,\rho)$. Finally, using routine spherical coordinate transform, we see that our integral in $(1)$ equals to $${4\pi}\int_{0}^{2\pi}\int_{0}^{\pi} e^{-2\pi i\rho\cos\theta}\sin\theta d\theta d\phi = 4\pi\cdot\dfrac{1}{2}\int_{0}^{\pi}e^{-2\pi i\rho\cos\theta}\sin\theta d\theta = $$ $$2\pi\cdot\dfrac{1}{4\pi i\rho}[e^{2\pi i\rho u}]_{u=-1}^{u=1} = \dfrac{2 \sin(2\pi\rho)}{\rho}$$, as desired.

A: In this case the Haar measure is simply the Lebesgue measure.
So you have
$$
\hat \mu(\varepsilon)=\int_{S^2} e^{-i\varepsilon x}dx.
$$


Q: How can extract points which are formed a convex hull of 3 dimensions polygon in Matlab by using convexhull functions? I use different convex hull functions in Matlab to find points coordinates which are formed the convex hull. however, these functions return the matrix of triangles.
How can I specify those points?
Thanks.
Sepideh

A: I'm not sure I fully understand your question. Maybe if the following doesn't clarify things you can edit your post to include the name of the MATLAB function you are using and a snippet of code?
The convhull function in MATLAB does return the index of coordinates in the convex hull.
In the following example, (x(k), y(k)) are the coordinates. (taken straight from convhull doc)
xx = -1:.05:1; yy = abs(sqrt(xx));
[x,y] = pol2cart(xx,yy);
k = convhull(x,y);
plot(x(k),y(k),'r-',x,y,'b+')

It's the same thing if you are using convexhull instead (convexhull doc).
x = rand(10,1);
y = rand(10,1);
dt = DelaunayTri(x,y);
k = convexHull(dt);
plot(x,y, '.', 'markersize',10);
hold on;
plot(x(k), y(k), 'r');
hold off;


Q: Files content type not updating via CSOM I have created a custom content type called Certification and wish to mark my uploaded PDF as a certificate in certain circumstances.
The content type currently defaults to "Document".
This is my flow from start to finish.
First I load my content types and documents from my context.
ContentTypeCollection contentTypes = context.Web.ContentTypes;
context.Load(contentTypes);

List documents = context.Web.Lists.GetByTitle(DOCUMENTSLISTNAME);
context.Load(documents.RootFolder);

context.ExecuteQuery();

I then read in my PDF file and add it:
using (MemoryStream ms = new MemoryStream(System.IO.File.ReadAllBytes(@"blahblahpdf.pdf")))
{
       if (context.HasPendingRequest) { context.ExecuteQuery(); }

       var filename = "/blahblahpdf";

       string ServerURI = documents.RootFolder.ServerRelativeUrl;

       var filecreation = new FileCreationInformation();

       filecreation.ContentStream = ms;
       filecreation.Overwrite = true;
       filecreation.Url = ServerURI + filename;

       var file = files.Add(filecreation);

From here I set my ContentTypeId for the file:
var certType = contentTypes.FirstOrDefault(x => x.Name == "Certificate");

item["ContentTypeId"] = certType.Id.ToString();
item.Update();

context.ExecuteQuery();

My file is then uploaded, but has the Content Type of Document, not Certificate.
My certType does hold a correct result, and debugging after this point the items ContentTypeId field is correctly updated to my Certificate content types Id.
If I then obtain the new file using the context however the ContentTypeId has reverted back to that of Document.
I don't understand why my request is basically ignored. If I give an incorrect Id then no error is thrown, but I'm taking the Id directly from my ContentType collection.
Does anyone have any ideas what could be causing this issue?

A: try documents.ContentTypes as opposed to the Web.ContentTypes
See also
Site and List Content Types

When you add a site content type to a list or library, SharePoint
  Foundation makes local copies of any columns that are referenced by
  the content type and adds them to the list's fields. For more
  information, see Fields and Field References. In addition, SharePoint
  Foundation makes a local copy of the site content type and adds the
  copy to the content type collection on the list. The new list content
type is a child of the site content type. The value of the Id property
for the list content type is different from the value of the Id
property for its parent site content type, but otherwise the two
  content types are initially the same.


Q: Insert of generic values in HashMap C I have a function(create) in order to create an hashmap.
My hashmap is bigger than 11 , but this is an example and I'm searching to make code more clearly as possible.
The hashmap will contain a couple KEY-VALUE in each node. My aim is to create a generic Insert function in which I can insert int, char etc... from an array.
In my example I insert Int Insert Function takes as parameters Table t (where I insert int that i created before), two pointers to values that I must insert, the position in which I have to insert values in the hashmap and compare function passed by user, in order to compare two keys and return 1 if they are equal. The trouble is : when I try to print the hashmap (print(t)) it return in each position last couple inserted.
input
My arr[11] and arr2[11]
expected output
key: 1,val: 11
key: 2,val: 10
key: 3,val: 9
key: 4,val: 8
key: 5,val: 7
key: 6,val: 6
key: 7,val: 5
key: 8,val: 4
key: 9,val: 3
key: 10,val: 2
key: 11,val: 1

real output
key: 11, val: 1
key: 11, val: 1
key: 11, val: 1
key: 11, val: 1
key: 11, val: 1
key: 11, val: 1
key: 11, val: 1
key: 11, val: 1
key: 11, val: 1
key: 11, val: 1
key: 11, val: 1

main.c
int compare(void *key,void *key2){
    int k = *(int*)key;
    int k2 = *(int*)key2;
    if(k==k2){
        return 1;
    }else return 0;
}

int main(){

 struct table*t = create(11);
 int arr[11]={1,2,3,4,5,6,7,8,9,10,11};
 int arr2[11]={11,10,9,8,7,6,5,4,3,2,1};
    for(int p=0;p<11;p++){
        int i = arr[p];
        int *key= &i;
        int i2 = arr2[p];
        int *value= &i2;
        insert(t,key,value,p, compare);
    }
 print(t);

function.c
struct node{
    void* key;
    void* val;
    struct node *next;
    struct node *prev;
};

struct table{
    int size;
    struct node **list;
};

struct table *create(int size){
    struct table *t = (struct table*)malloc(sizeof(struct table));
    t->size = size;
    t->list = (struct node**)malloc(sizeof(struct node*)*size);
    int i;
    for(i=0;i<size;i++)
        t->list[i] = NULL;
    return t;
}

void insert(struct table *t,void* key,void* val,int pos, int(*comp)(void*, void*)){

    struct node *list = t->list[pos];
    struct node *newNode = (struct node*)malloc(sizeof(struct node));
    struct node *temp = list;
    while(temp){
        if(((*comp)(temp->key, key))==1){
            printf("%s", "key already create.");
            return;
        }
        temp = temp->next;
    }
    newNode->next = t->list[pos];
    newNode->key = key;
    newNode->val = val;
    if(list!=NULL){
        list->prev = newNode;
    }
    t->list[pos] = newNode;
    newNode->prev = NULL;
}

void print(struct table *t){
    for (int i = 0; i < t->size; ++i) {
        struct node *list = t->list[i];
        while(list){
            if(list->key!=NULL) {
                printf("key: %d, val: %d\n",*(int*)list->key, *(int*)list->val);
            }
            list = list->next;
        }
    }
}

A: you are passing the same address for all the values and key here, so by the time you reach the end, the last value is replicated in all the pointers
int i = arr[p];
int *key= &i;
int i2 = arr2[p];
int *value= &i2;

instead you can copy the number of bytes from the location like below.
//newNode->key = key;
newNode->key = malloc(sizeof(int));
memcpy(newNode->key, key,sizeof(int) );
//newNode->val = val;
newNode->val = malloc(sizeof(int));
memcpy(newNode->val, val,sizeof(int) );

NOTE: you will have to handle error checks for malloc and free the memory once done.

A: the problem came from the main function.
int i = arr[p];
int *key= &i;

Your key is a pointer to the i variable, not to the value in arr.
The right way:
int * key = &arr[p];

(same problem for the value)


Q: How to display command line arguments in a single line? I want to write a program that would display my command-line arguments in the console one after another. I found in oracle tutorials that you can surround passed arguments with "" to put them in one line, but how can I do the same with code?
I made something like this but cant keep space between two arguments.
public class Printargs {

    public static void main(String[] args) {
        for(String s: args){
            System.out.print((' ' + s).trim());
        }
    }

}

A: You can join the elements of args[] with space using String#join:
public class Main {
    public static void main(String[] args) {
        System.out.println(String.join(" ", args));
    }
}


Q: C# Custom Object Validation Design I currently have to validate custom Field Objects for my application. Simply put, each Field object consists of information about the validation for the field, as well as the value of the field.
I am validating fields in bulk, so currently, I have a validation class, that has a method for each validation. For required fields, it looks something like this:
      private void RequiredFields()
      {
            foreach (Field field in allFields)
            {
                if ((field.Required == true) && (field.Value == string.Empty))
                {
                    field.isValid = false;
                }
            }
      }

Now my problem is that I feel like I should a layer of abstraction to the validation, so instead of saying:
if ((field.Required == true) && (field.Value == string.Empty))

... I would add a validation class, to accept the values and turn it into this:
if (!validater.RequiredFields(field.Required, field.Value))

If I were to do this, it would allow me to reuse the validation class without use of the field objects, and it would also allow better unit testing... However, it seems like and unnecessary layer of abstraction and also somewhat repetitive... Keep in mind, this is the most simple of all the validation.
Suggestions?

A: Why not have make Field objects responsible for their own validation?
class Field
{
    public bool Required { get; }
    public string Value { get; set; }

    // assuming that this method is virtual here
    // if different Fields have different validation logic
    // they should probably be separate classes anyhow and
    // simply implement a common interface of inherit from a common base class.
    public override bool IsValid
    {
        get { return Required && Value != String.Empty; }
    }
}


Q: Have a method for INPUT without using FORM in PHP I'm being creative and making something new. I am wanting to use <input> without <form> but don't think it's possible to make the input a method (POST) without using <FORM>. I'm currently trying to use
if(isset($_POST['name'])) {
    // Do Something
}

but having my input <input type="button" name="name" /> does not activate the isset I have when using PHP to listen for that event.
Is there something I'm doing wrong? Is there another way I should do this? I'm really lost, and don't have no idea what to do now. I do not want to use <form> since I'm currently not interested in using that. Should the input type be "submit"? What else is there I could do?

A: This is possible with a javascript onclick or onsubmit event, using GET rather than POST, but it's definitely not best practice.  Use a form or AJAX, as recommended by other posters:
<input type="text" id="name" />
<button id="submit" onclick="javascript:window.location='http://yoururl.com/?name='+document.getElementById('name').value">Submit</button>

A: You are not able to send a form data without using <form>.
The only way to do this is to use ajax instead of a classic HTML form.

A: You can take inputs from STDIN in PHP's latest versions like:
fscanf(STDIN, "%s\n", $value);
Here $value will contain the input.


Q: Price rule for ONE free item We need a price rule so a customer can get a free item when they use the coupon code. That is simple if they just add any item within a category that is spec'd in the condition, and if they just add ONE of that item to the cart. Doing that, the coupon code works. But how do we set the condition or action to give them the one item free if they have additional items in the cart?

Currently, if they add more items to the cart, the code will not work.

A: Instead of contains switch that to equals or greater than


Q: gstreamer plugin library not linking against opencv shared object library - “undefined symbol” on CentOS I have a plugin that uses OpenCV and it works perfectly on Kubuntu. Now I am trying to run the code on CentOS but when I run the pipeline, I get:
$ gst-launch videotestsrc ! opencvelement ! ximagesink
WARNING: erroneous pipeline: no element "opencvelement"

When I run ldd in Kubuntu, I get:
    $ ldd .libs/libOPENCVELEMENT.so
    linux-gate.so.1 =>  (0x0060f000)
    libgstbase-0.10.so.0 => /usr/lib/libgstbase-0.10.so.0 (0x00a74000)
    libgstreamer-0.10.so.0 => /usr/lib/libgstreamer-0.10.so.0 (0x00474000)
    libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0x006a2000)
    libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0x00110000)
    libopencv_core.so.2.3 => /usr/local/lib/libopencv_core.so.2.3 (0x00730000)
    libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0x00209000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x002f4000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x00acd000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0x0031e000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x0033c000)
    libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0x00357000)
    libgmodule-2.0.so.0 => /usr/lib/i386-linux-gnu/libgmodule-2.0.so.0 (0x0035d000)
    libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00c9c000)
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0x00362000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x0036b000)
    libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0x00370000)
    libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0x00e52000)
    libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0x00377000)
    /lib/ld-linux.so.2 (0x00a10000)

But when I run it on CentOS, I don't see opencv
    $ ldd .libs/libOPENCVELEMENT.so
    linux-vdso.so.1 =>  (0x00007fff7a1fd000)
    libgstvideo-0.10.so.0 => /usr/lib64/libgstvideo-0.10.so.0 (0x00002ba0ac9b7000)
    libgstcontroller-0.10.so.0 => /usr/lib64/libgstcontroller-0.10.so.0 (0x00002ba0acbc4000)
    libgstbase-0.10.so.0 => /usr/lib64/libgstbase-0.10.so.0 (0x00002ba0acdeb000)
    libgstreamer-0.10.so.0 => /usr/lib64/libgstreamer-0.10.so.0 (0x00002ba0ad03c000)
    libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00002ba0ad326000)
    libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00002ba0ad569000)
    libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00002ba0ad76c000)
    librt.so.1 => /lib64/librt.so.1 (0x00002ba0ad970000)
    libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00002ba0adb7a000)
    libz.so.1 => /lib64/libz.so.1 (0x00002ba0adeb7000)
    libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00002ba0ae0cb000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002ba0ae3a8000)
    libm.so.6 => /lib64/libm.so.6 (0x00002ba0ae6a8000)
    libc.so.6 => /lib64/libc.so.6 (0x00002ba0ae92b000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002ba0aec83000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00002ba0aee91000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00002ba0af0ac000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003f6c800000)

Here is my makefile.am, which is the same on both OS
plugin_LTLIBRARIES = libOPENCVELEMENT.la

# Plugin source files:
libOPENCVELEMENT_la_SOURCES = opencv_chain.c opencv_chain.h datasetup.h
libOPENCVELEMENT_la_CFLAGS = \
    $(GST_PLUGINS_BASE_CFLAGS) \
    $(GST_CFLAGS) \
    $(OPENCV_CFLAGS)

libOPENCVELEMENT_la_CXXFLAGS = \
    $(GST_PLUGINS_BASE_CFLAGS) \
    $(GST_CFLAGS) \
    $(OPENCV_CFLAGS)

libOPENCVELEMENT_la_LIBADD = \
    $(GST_PLUGINS_BASE_LIBS) \
    $(GST_LIBS) \
    $(OPENCV_LIBS) \
    -lopencv_core \
    -lopencv_highgui

libOPENCVELEMENT_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libOPENCVELEMENT_la_LIBTOOLFLAGS = --tag=disable-static

Let me know if you need more information. Any help will be appreciated. Thank you.

A: Do you have all the opencv development files installed on centos as well. Run a:
grep  "OPENVC_" Makefile

to check what the Make variables contain. Also you can pipe the linker (undefined symbol) output through c++filt to see the real function name instead of the mangled name.

A: I was able to solve this by going to /usr/lib64/pkgconfig and modified opencv.pc to explicitly have all libraries. I also had to move the plugins from /usr/lib/gstreamer-0.10 to /usr/lib64/gstreamer-0.10


Q: Is there a way to get the local maven repository path? I have the problem that when using the windows maven under cygwin, the local repository path is not /home/user/.m2/repository, it is /cygdrive/c/Users/user/.m2/repository.
Is there a way, with some python library or Aether or something like that, to find out the path that the actual maven binary uses?


Q: How to use jQuery with in xhtml? i am using facelets,richfaces,and ajax, in XHTML
i am facing error while creating datepicker!
What is the solution for my problem?
the code is:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html   xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
      xmlns:rich="http://richfaces.ajax4jsf.org/rich">

    <head>

<a4j:loadScript src="jquery/jquery-1.4.2.min.js" />
<a4j:loadScript src="jquery/jquery-ui-1.8.5.custom.min.js" />
  </head>
  <body>
  <h:form>
  <rich:panel>
  <h:inputText id="mydate" value="" label="test" size="20"/>
  <rich:jQuery selector="#mydate" name="mydate" query="datepicker({changeMonth:true,changeYear:true})" timing="onload"/>

  </rich:panel>
  </h:form>

 </body>

</html>

error i am getting is:
 INFO: Added Library from: jar:file:/D:/WS/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/RichTest/WEB-INF/lib/richfaces-ui-3.3.3.Final.jar!/META-INF/ajax4jsf.taglib.xml
Oct 8, 2010 1:51:30 PM com.sun.facelets.FaceletViewHandler handleRenderException
SEVERE: Error Rendering View[/jquery/jquery-1.4.2.min.js]
com.sun.facelets.FaceletException: Error Parsing /jquery/jquery-1.4.2.min.js: Error Traced[line: 1] Content is not allowed in prolog.
    at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)
    at com.sun.facelets.compiler.Compiler.compile(Compiler.java:105)
    at com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:197)
    at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:144)
    at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:95)
    at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:517)
    at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
    at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
    at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
Oct 8, 2010 1:51:30 PM com.sun.faces.lifecycle.LifecycleImpl phase
WARNING: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@19e733e) threw exception
com.sun.facelets.FaceletException: Error Parsing /jquery/jquery-1.4.2.min.js: Error Traced[line: 1] Content is not allowed in prolog.
    at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:234)
    at com.sun.facelets.compiler.Compiler.compile(Compiler.java:105)
    at com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:197)
    at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:144)
    at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:95)
    at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:517)
    at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
    at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
    at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
Oct 8, 2010 1:51:30 PM org.ajax4jsf.webapp.BaseXMLFilter doXmlFilter
SEVERE: Exception in the filter chain
javax.servlet.ServletException: Error Parsing /jquery/jquery-1.4.2.min.js: Error Traced[line: 1] Content is not allowed in prolog.
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:249)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

Please tell me the reason.

A: According to http://seamframework.org/Community/HowToWriteJavaScriptInXHTML you only need to:
<a4j:loadScript src="resource://jquery.js"/>

A: My problem is :
How to use jQuery with in xhtml?
My Answer is:
1.Create an xhtml page using code given below.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html   xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
      xmlns:rich="http://richfaces.ajax4jsf.org/rich">

    <head>
    <link type="text/css" href="css/flick/jquery-ui-1.8.5.custom.css" rel="stylesheet" />
<a4j:loadScript src="resource:///jquery/jquery-1.4.2.min.js" />
<a4j:loadStyle src="/jquery/jquery-ui-1.8.5.custom.css" />
<a4j:loadScript src="resource:///jquery/jquery-ui-1.8.5.custom.min.js" />
  </head>
  <body >
  <h:form>
  <rich:panel>
  <h:inputText id="dp1" value="" label="test"  />
  <rich:jQuery  selector="#dp1" name="dp1" rendered="true" timing="onload" query="datepicker({chosendate:'01/05/2005',minYear:'-20Y',maxDate: '+1Y +1M',appendText: '(dd-mm-yyyy)',changeMonth:true,changeYear:true})" ></rich:jQuery>
  </rich:panel>
  </h:form>
 </body>
</html>

2.then try to place JQuery.xx.js & css files below order!
---WebContent
   +themes
   +....
   ...jquery-1.4.2.min.js
   ...jquery-ui-1.8.5.custom.css
   ...jquery-ui-1.8.5.custom.min.js

all these are configured in .xhtml file like above.
3.General things we need to configure for facelets, richfaces and ajax in web.xml is common,in all the way.
4.At last it worked Perfectly...
Thank You Guy's..


Q: What is the meaning of "system environment" in IntelliJ's golang plugin? I was attempting to use intellij's golang plugin, but it sais there is no GOPATH defined.

*

*the plugin allows you to configure some sort of "GO Libraries" window, however

*Its not clear what the configuration is meant to do, and there are no tool tips regarding what should be entered.

*There are "global libraries", "project libraries", and so on defined.

In my case, I simply want to use a GOPATH.
Screenshot attached:  The primary question here: How and where should I set GOPATH when using intellij's Golang plugin?
Some context: I don't mind setting gopath globally on my mac, but it seems that is a heavy-handed approach for an IDE to use**

A: the Go plugin currently uses the term Go Libraries for different GOPATH values.
If you have a single GOPATH that you'd like to use for all the projects, then you can add it to the "Global Libraries". For example, my $GOPATH is /home/florin/golang and in the plugin I've set the Global Libraries from the Go Libraries setting to reflect that (see this screenshot).

If the plugin can automatically detect the GOPATH, and you have the check box ticked for that, then the plugin will try and use that value as the GOPATH value, see the next screenshot

Also, the plugin has three different types of GOPATH values right now:

*

*the Global Libraries -> you should set GOPATH entries here for GOPATH values that you want to share between different projects (most use-cases)

*Project Libraries -> you should set the GOPATH entries here for GOPATH values that are specific to the current project only (when you want to have a single GOPATH per project approach)

*Module Libraries -> this is a very specific setting, it's only used in case you have different modules in your project and you want to have a different GOPATH configuration for each of the modules. The module in this case is a specific logical grouping of the source code in the IDE, not in the packages that the Go project uses (think of the ability to have a Python module, a Go module and an Android module all in the same project).

There's a ticket that plans to simplify this further and your input will be included.
Hope it helps.


Q: how i can access session in route.php in codeigniter 3.0 how i can access session in route.php in codeigniter 3.0
my application is multi language support so i can used session for language change my application data , lable,static captions language change
now i want to extend my application
means when language change that time url also change means
for example
http://localhost/test/en/controller/method

when change language in spainsh that time url change like below
http://localhost/test/es/controller/method

so how i can do this
please help me thanks

A: You always can access to the $_SESSION variable. However, I'm not sure if it's compatible with CodeIgniter Session library.
session_start();

if(isset($_SESSION['lang']))
{
   // define your routing here
}

A: Upto the level I understand,You're using Codeigniter's session data as an identity to indicate lang and its associated data..?
Codeigniter uses similar way of superglobal session maintainence like using session_start() and $_SESSION.
But It is advised not to use session data anywhere else than that of controllers.
Try writing a Super-controller which extends to all of your controllers.
            class SuperController extends MY_Controller
        {

            public function __construct()
             {
                // Ensure you run parent constructor
                parent::__construct();
                $this->checkSess();
             }

            public function checkSess()
           {
              //Your session check and its associated redirects
              //eg. if $this->session->en==1 redirect to eng lang controller

            }

        }

    Class YourController extends SuperController{
    //Your code

}

Or You can use multilang suppport in Codeigniter as of in Codexworld
Or If you want to still use session in routes.php . You can try as of in a standard PHP way as Alexander said.But I doubt whether it works properly.

A: Initialize session in autoload.php like:
$autoload['libraries'] = array('session');

and then in routes.php you can access the sessions as:
session_start();
print_r($_SESSION);


Q: Using Lightning Out for external apps is beta right now, does it mean we cannot use it in production? Using Lightning Out for external apps is beta right now. However considering that using Lightning Out for Visualforce page is allowed in production org therefore technically we can use lightning out for external app as well in production. Kindly let me know is there any technical limitation for not being able to use Lightning Out in production as of now.

A: Lightning out for visual force is not in beta so you are fine to use it
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_visualforce.htm
Lightning out for any app outside salesforce is in beta and technically should not be packaged
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/lightning_out.htm
You mention VF in your question as a supporting fact so not sure which you are asking about.


Q: Loading image while form loads php script to an iframe I have a form which submits a php file to an iframe.
Here is the form:
<form action="del.php" method="post" target="output"  >
Server: <input type="text" name="server_id" value="" />
Name:<input type="text" name="name" value="" />
Password:<input type="password" name="password" value="" />

Create Log? <input type="checkbox" name="log" value="" />
Output list of files? <input type="checkbox" name="out" value="" />

<input type="submit" name="delete" value="Delete FTP!" />

del.php deletes files on a romote ftp. That recursive funcion takes a while.
Now I want to show a loading image by loading the del.php to the iframe.

A: I hope this answer helps you or anyone else looking for a solution. This one worked for me.
I'm trying to do the same. I have a page that calculates shipping on an iframe and i want it to show a loading gif image while the shipping cost loads as an xml from my shipping provider.
The IFRAME is covered with a DIV where the loading image (or any image) is found. The image is at the center of the DIV area and its size can be up to 950x633 pixels. When the IFRAME page is loaded, the loading image will be hidden.
What you need to change is the image URL for your site. You might also want to change the DIV background color (currently set to #FFF).

This worked for me. It shows a loading Gif animation before the page is loaded in my iframe box. :)


Q: How I can leave the counter code? My Problem:
I don't know, how I can leave my counter-code (CountDownTimer), IF the user click the imageButton within the counter of 2 seconds
My Code:
final ImageButton avatarScroll = (ImageButton) findViewById(R.id.imgBtnAvatarback);

avatarScroll.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ursprungAvatar = !ursprungAvatar;
            if(ursprungAvatar) {
                //image change with arrow
                ImageButton avatarScroll = (ImageButton) findViewById(R.id.imgBtnAvatarback);
                avatarScroll.setImageResource(R.drawable.avatarback_pfeil);
                new CountDownTimer(2000, 1000) {
                    public void onTick(long millisUntilFinished) {
                        //
                    }
                    public void onFinish() {
                        //image change without arrow
                        ImageButton avatarScroll = (ImageButton) findViewById(R.id.imgBtnAvatarback);
                        avatarScroll.setImageResource(R.drawable.avatarback);
                        ursprungAvatar = !ursprungAvatar;
                    }
                }.start();

            } else {
                //image change without arrow
                ImageButton avatarScroll_ursprung = (ImageButton) findViewById(R.id.imgBtnAvatarback);
                avatarScroll_ursprung.setImageResource(R.drawable.avatarback);
            }

    }
});

A: If I get the behavour right, all you need to do, is adding timer.cancel() in the else case and keep a reference to the created timer  (eg make it a field).


Q: Trash won't empty, and duplicates files (with one copy remaining in trash) when moved back to desktop I'm having a problem with Yosemite. It started when I attempted to move items to recycle bin, and was asked for my password. I entered it, and the items were moved to the bin. When I tried secure empty trash, it worked for a minute then froze. So I halted the trash. I then tried to move the folders back to the desktop to see if I could get the trash down to only a few files that weren't in folders (these files hadn't asked for my password to move to recycle). That didn't work, because when I restored the folders to desktop, the computer copied them instead of just restoring them: one copy of each folder remained in the trash, another copy now on desktop. When I moved those folders back to trash from desktop, they were then in duplicate. Now I have over 150 GB in the trash and it won't empty. Help!

A: Have you tried secure-delete? When you go to empty trash hold down the command key. This has helped me empty the trash when it was stubborn for whatever reason.

A: See this answer: Can't empty the trash after deleting user account
sudo rm -rf ~/.Trash/

As you no longer have access to the drive that the files were sent to Trash from, you may have to force empty the Trash.  Be careful, this is a delicate operation.  Anytime you see sudo beware that you are treading in dangerous ground.

DESCRIPTION
sudo allows a permitted user to execute a command as the superuser or
         another user, as specified by the sudoers file.
DESCRIPTION
       The rm utility attempts to remove the non-directory type files specified on the command line.

A: Same issue. Solved by changing Finder preferences from empty secure trash to just empty trash. Everything worked beautifully in seconds. Just sayin'


Q: accordion, tab menus, assign select class for both I have two menus: the Accordion menu and Tab menu, for the Tab menu, there is an assigned class selected to a link that is opened, I want to assign the class (for example) open_menu, in the same way for the accordion menu. actually if the class open_menu will be given from the condiotion that in its ul there is an A link with class Selected, it would be much better, because the class selected given to a link is taken from the cookies, and even if the page is refreshed it comes to this link Selected. Anyway, u can see all the source here: http://jsfiddle.net/bq6tA/6/
actually the end product i want, after the refresh of the page, there will be opened the accordion's tab, as well as the Tab's menu link selected that is in this accordion's tab

A: See a working demo of the following code here.
I've modified your initMenu function to add the open_menu class to the appropriate accordion (and added a CSS class to indicate that it was added by changing the background to green):
function initMenu() {
    // SNIP ...
    $('#menu li a').click(function() {
        // SNIP ...
        if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
            $('#menu ul:visible').slideUp('normal')
                                 .siblings('a').removeClass('open_menu');
            checkElement.slideDown('normal')
                        .siblings('a').addClass('open_menu');
            return false;
        }
    });
}

I then created a function to be called after initMenu that will trigger a click on the accordion with the same rel as the id of the currently selected item:
function showCurrentTab() {
    var curId = $('.tabcontent:visible')[0].id,
        $curLink = $('a[rel="'+curId+'"]');

    $curLink.closest('ul')
            .parent('li')
            .children('a').click();
}

To figure out what's going on here, see the API docs for closest, parent and children and relate that to your HTML structure.


Q: Calculating roller coaster loops - how to get x and y in terms of s? In this video, the author presents a method to calculate shapes of roller coaster loops. At 13:20, three differential equations are presented to plot the shape of a loop providing a constant force $G$ for an initial velocity $v_0$:
$\begin{align}
\frac{\partial\theta}{\partial s} &= \frac{G-g\cos\left(\theta\right)}{v_0^2-2gy} \\
\frac{\partial x}{\partial s} &= \cos\theta \\
\frac{\partial y}{\partial s} &= \sin\theta
\end{align}$
where $g$ is acceleration due to gravity, $9.80665~\text{m}/\text{s}^2$.
I would like to eliminate the need for the $\frac{\partial\theta}{\partial s}$ term. Do I integrate both sides of all these equations with respect to $s$ and then substitute $\theta$ in for the $x$ and $y$ equations, or am I stuck with three equations?
Another problem is that the first equation has $\theta$ and $y$ on the right side, so how would I proceed?

A: if you use $\delta s = \delta y \sqrt{1+(\tan \theta)^{-2}}$ that changes first equation to
$$\frac{\partial\theta}{\partial y} = \frac{G-g\cos\left(\theta\right)}{(v_0^2-2gy)\sqrt{1+(\tan \theta)^{-2}}}$$
this allows you to separate all theta terms to one size and all y terms to the other
$$\partial\theta\frac{ 2\csc \theta }{\cos\theta-G/g} = \frac{\partial y}{(y-v_0^2/2g)}$$
now you integrate
$$2\int_0^{\theta} \frac{ \csc \phi}{\cos\phi-G/g} d\phi = \int_0^y\frac{dz}{(z-v_0^2/2g)}$$
RHS is $$\ln\left((1-\frac{2gy}{v_0^2})\right)$$
and LHS comes out to be
$$\ln \left[ \left(1-\cos \theta \right)^\frac{1}{1-G/g}  \left( \cos \theta +1 \right) ^\frac{1}{1+G/g} \left( \cos \theta - G/g \right) ^ {\frac{2}{(G/g)^2-1}}\right]$$
exponentiation of both sides
$$ y=v_0^2 /2g\left[1-\left(1-\cos \theta \right)^\frac{1}{1-G/g}  \left( \cos \theta +1 \right) ^\frac{1}{1+G/g} \left( \cos \theta - G/g \right) ^ {\frac{2}{(G/g)^2-1}}\right]$$


Q: What methodology/process/tools support remote and "on the bench" development? I work for an IT services company that develops products as enablers for further services consulting. We have technical consultants/developers that need to be able to develop remotely and when back in the office "on the bench".
What methodology/process/tools support development by consultants when they are remote, or "on the bench", in particular how to support the management of the deliverables.
I have looked at DVCS systems, along with KanBan board tools, but I'd like to get opinions in the best way to handle this style of product development when it's not a traditional back room development situation.

A: There are several leaders in the ALM space, including VersionOne, Rally, ThoughtWorks Studios Mingle + Go + Twist, Jira Greenhopper, and others. These are all fundamentally iterative in nature, supporting Scrum+XP. There is a new crop of tools coming up that support Kanban, if that's your preference.
The key, though, is to decide what approach you plan to take. Iterative or flow?
Beyond that, if you're using a continuous integration server - whether open source like Jenkins or commercial like Go - then that combined with an SCM system (git, for instance) gives you visibility into what's been produced and the ability to distribute that work.
Back to your specific challenge, it seems to me that iterative wouldn't suit you, since you have people coming and going as they enter and leave the bench. Mingle supports this quite nicely, as do a few of the others. In fact, I'd suggest that the leading methodologies don't really lend themselves to your situation, as you will have neither iterations nor flow, most likely.

A: Here's my TFS pitch.
Your developers/consultants need to be able to work in house, remotely or offline. That means local workspaces. TFS 2012 has that.
With the high rate of turnover, you need managers to be able to easily and quickly assign specific tasks to developers. With TFS you can create work items, break them into subtasks and easily assign them to any team member. When the developer begins working, you'll be able to see it and any check ins can be quickly associated (semi-automatically) with the subtask. So you'll know who did what task, and be able to see the exact code they implemented to accomplish it.
If you have managers maintaining the product backlog, all a developer needs to do is select one of the tasks assigned to him, get the latest from the source and start developing. Minimal overhead for him/her.
With Web Access you can see/edit your entire product backlog, get burndown charts (and other reports), see who completed what and when, assign tasks to team members, change team members, etc. All without VS installed, so no need to have a license for a manager if they don't develop.
Finally, fully integrated automated builds will allow you to ensure that consultants don't break your source. Gated check ins are great for this kind of team. The changeset is stored, and a build is ran. If the changeset would break the build, the check in is denied. You can also automate builds on the other side, post check in.
Any file created outside of VS can be easily added to source control. Once the file is added, TFS monitors the file for changes and you can easily add the changes to a changeset. Once in source control, its fully in source control and available to everyone.
You never really mentioned any database requirements, but the new SSDT is awesome for declarative SQL development. So far, I've not had to write a single ALTER script, which makes me very happy.
There is also fully integrated support for code reviews, build verification tests, automated deployments, architecture tools (with rules that can be enforced) and more. The rabbit hole goes pretty deep, but if you don't need it, none of it is forced on you.
So, the methodology I would suggest is a KanBan style set up, with managers pushing tasks rather than developers pulling them. This way you can reduce the impact of your high turnover rates without overly micromanaging your consultants. You'll be able to easily give them a task, let them accomplish it, and have complete visibility of the work they perform. I'm not sure how you gather your requirements, and how much input in the dev process your customers have, so its hard to go into more detail. TFS supports storyboards associated with work items, so you can give detailed specs to your developers. Also the Feedback Manager can facilitate in getting feedback on working software from product owners.
You could go Scrum with defined sprints, but I think a lot of the overhead of sprint reviews and sprint planning may be a waste for you, if you consultant turnover rate is high, and/or you don't need/want a lot of input from your consultants on user story breakdowns/requirements gathering.


Q: Magento 2 - How to have a custom "add to cart" button in CMS page? So I am trying to add "Add to Cart" button in my CMS page. In one CMS page, I will have one item and multiple "Add to Cart" buttons. I'm wondering how can I do this?
All the existing examples, they user objectManager in .phtml file which is not a good practice. I'm wondering if there is another way.
This is what I have done so far:
1.) Create a CMS page through the admin panel
2.) Create  .phtml file in app/design/frontend/{Vendor Theme}/{Theme name}/Magento_Catalog/templates/add-to-cart-custom.phtml
3.) Call the block in CMS page {{block class="Magento\Framework\View\Element\Template" template="Magento_Catalog::add-to-cart-custom.phtml" product-sku="VVXL10"}}
I want to pass product-sku and display the buttons using the product-sku, how can I achieve this?
Thank you.

A: Create a module by following steps:

*

*app/code/M2Expert/CmsAddtocart/registration.php

with below code:
<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'M2Expert_CmsAddtocart',
    __DIR__
);

*app/code/M2Expert/CmsAddtocart/etc/module.xml

with below code:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="M2Expert_CmsAddtocart" setup_version="0.0.1">
        <sequence>
            <module name="Magento_Backend"/>
             <module name="Magento_Sales"/>
            <module name="Magento_Quote"/>
            <module name="Magento_Checkout"/>
            <module name="Magento_Cms"/>
            <module name="Magento_Catalog"/>
        </sequence>
    </module>
</config>

*app/code/M2Expert/CmsAddtocart/Block/CmsCart.php

with below code:
<?php
namespace M2Expert\CmsAddtocart\Block;

class CmsCart extends \Magento\Framework\View\Element\Template
{
    protected $productRepository;

    protected $listProductBlock;

    protected $scopeConfig;

    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Catalog\Model\ProductRepository $productRepository,
        \Magento\Catalog\Block\Product\ListProduct $listProductBlock,
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
    ) {
        $this->productRepository = $productRepository;
        $this->listProductBlock = $listProductBlock;
        $this->scopeConfig = $scopeConfig;
        parent::__construct($context);
    }

    public function getAddToCartUrl()
    {
        if ($_product = $this->getProduct()) {
            return $this->listProductBlock->getAddToCartPostParams($_product);
        }

        return '#';
    }

    public function getProduct()
    {
        if ($product_id = $this->getProductId()) {
            $_product = $this->productRepository->getById($product_id);
            if ($_product) {
                return $_product;
            }
        }

        return false;
    }
}

*app/code/M2Expert/CmsAddtocart/view/frontend/templates/cms/addtocart.phtml

with below code:
<?php $postParams = $block->getAddToCartUrl(); ?>
<?php $buttonText = $block->getButtontext(); ?>

<form data-role="tocart-form" action="<?php /* @escapeNotVerified */ echo $postParams['action']; ?>" method="post">
    <input type="hidden" name="product" value="<?php /* @escapeNotVerified */ echo $postParams['data']['product']; ?>">
    <input type="hidden" name="uenc" value="<?php /* @escapeNotVerified */ echo $postParams['data']['uenc']; ?>">
    <?php echo $block->getBlockHtml('formkey')?>
    <button type="submit"
        title="Add to Cart"
        class="action tocart primary">
        <?= ($buttonText)? $buttonText : __('Add to Cart') ?>
    </button>
 </form>

Done!!
You can now use that on cms page or cms block like below:
{{block class='M2Expert\CmsAddtocart\Block\CmsCart' product_id=2 buttontext="Add to
Cart from CMS" template='M2Expert_CmsAddtocart::cms/addtocart.phtml'}}


Q: Is it true that: $\| a \| \| b \| \cos \alpha = \langle a,b\rangle$ Let $a , b \in \mathbb{R}^n$ and let $\alpha$ be the angle formed between $a$ and $b$. Is it true that:
$$ \| a \| \| b \| \cos \alpha = \langle a,b\rangle $$
($\langle\cdot,\cdot\rangle$ being the dot product)
If so why?

A: That's taken as the definition of $\cos \alpha$ in order to define the angle between two vectors in $\mathbb R^n$. Note that it is well defined since $|<a,b>| \le ||a|| ||b||$ by C-S inequality.


Q: AS3 & XML - How do I construct xml data in as3? I am playing around with saving .xml files from data in my game. I know how to convert an xml object to a ByteArray and write that to a FileReference. What I need to know now is how to go from an empty xml object (using var xml:XML = new XML()) to a fully populated xml object.
Can someone show me what functions to use to add nodes and values? Specifically I need to know how to make several of the same type of node. Here's a sample of what the final xml should look like:
<data>
    <player>
        <money>15831</money>
        <shipType>1</shipType>
        <ship>
            <fuelCur>450</fuelCur>
            <energyCur>160</energyCur>
            <shieldCur>100</shieldCur>
            <armorCur>40</armorCur>
            <structCur>15</structCur>
        </ship>
    </player>
    <currentSystem>3</currentSystem>
    <currentPlanet>3</currentPlanet>
    <date>
        <year>2012</year>
        <month>10</month>
        <day>15</day>
    </date>
    <missionFlag>true</missionFlag>
    <planet id="0">
            <population>0</population>
    </planet>
    <planet id="1">
            <population>29827632</population>
    </planet>
    <planet id="2">
            <population>0</population>
    </planet>
</data>

It might be useful to know how to remove and how to alter nodes and values, too.
Also, do I need to import something from the flash library to do this with XML? I'm using FlashDevelop, but when I type xml., FlashDevelop doesn't bring up suggestions like it normally does.

A: Editing XML in AS3 is actually pretty easy and pretty basic - it's a core part of AS3. AS3 automatically adds nodes as you call them, like so:
var xml:XML = <data />;
xml.player.money = 15831;
xml.player.shiptype = 1;
xml.player.ship.fuelCur = 450;

Will result in:
<data>
    <player>
        <money>15831</money>
        <shiptype>1</shiptype>
        <ship>
            <fuelCur>450</fuelCur>
        </ship>
    </player>
</data>

Then to add multiples of the same node, just start a new XML object of the type you want, and append it to the XML object you're working on. Or skip the separate xml object entirely. Repeat as many times as needed:
var segment:XML = <planet />;
xml.appendChild(segment); // xml.planet[0]
xml.appendChild(segment); // xml.planet[1]
xml.appendChild(<planet />); // xml.planet[2]
//etc...

Then you can add values to them by their indexes.
//Assuming this is the 4th planet you've added...
xml.planet[3].population = 29827632;

A: In FlashDevelop, try creating a separate XML file entirely.  That will give you better code prompting.
For XML, though, I have found that Adobe's rudimentary docs on their XML class has a wealth of useful examples and tools for creating and using XML objects.


Q: Program that would ask for min, hours , AM and PM I would like to create a Program that would ask for min, hours , AM and PM but what I want it  to do is add one to the current entered mint when it it displaying the curent time. For example : I will enter the hour: 5, enter the minute: 23 enter AM or PM: AM and gives me the new time as 5:24 AM, I also would like it to change the time and AM or PM if entered some thing lik this, enter the hour: 11 enter the minute: 59 enter AM or PM: AM
The new time is 12 00 PM . Also changing the time If I got to 12:59AM to 1:00AM.
This is what I have done so far but have no Idea how to make time loop around. I also would like to make this with out any classes. This thing is frustrating me and going no where .
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
    int hr = hr;
        int min = min;
            int period = period;
            currentTime

            int time;
                    time = hr * 60 + min + 1;
                    hr = time / 60;
                    min = time % 60;
                    currentTime = currentTime(5, 59, "AM");
                    cout<<currentTime .hr +" : "+currentTime .min +" "+currentTime .period;
                             cin>>hrs;

}

A: I think this code, would produce a similar output to what you're looking for, but without the loop you wanted to create, because I'm sure that would require a fair few if statements.
I was curious as what this line was doing currentTime because it doesn't look to me like it would do anything at all.
#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
    int hr, min;
    char period;

    cout << "Enter Hour" << endl;
    cin >> hr;

    cout << "Enter Minute" << endl;
    cin >> min;
    min++;

    cout << "Enter Period (A or P)" << endl;
    cin >> period;

    cout << "Current Time: " <<  hr << ":" << min << " " << period << "M" << endl;

    _getch();

}

A: Here is an idea of how to accomplish this in C#.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            double hrs=0;
            double mins=0;
            DateTime dt = new DateTime(2013, 10, 20, 3, 59, 00);

            //dt = DateTime.Now;

            Console.WriteLine(dt.ToShortTimeString());

            Console.WriteLine("Enter hours:");
            hrs = Convert.ToDouble(Console.ReadLine());
            dt = dt.AddHours(hrs);

            Console.WriteLine("Enter minutes:");
            mins = Convert.ToDouble(Console.ReadLine());
            dt = dt.AddMinutes(mins);

            if (dt.Minute == 59)
                dt = dt.AddMinutes(1);

            Console.WriteLine(dt.ToShortTimeString());
            Console.ReadLine();
        }
    }
}


Q: Perform a task after all UI tasks are done As written in the title, I'm trying to write a piece of code that executes after all UI tasks. I've tried to use the Dispatcher with no success, and ended up using a BackgroundWorker with Thread.Sleep(1000) which feels risky to me.
Code snippet - using BackgroundWorker:
BackgroundWorker bw2 = new BackgroundWorker();
bw2.DoWork += (o, e) => Thread.Sleep(1000);
bw2.RunWorkerCompleted += (o, e) => MyMethod();
bw2.RunWorkerAsync();

Code snippet - using Dispatcher (which is not executed when I want it to):
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() => MyMethod()));

I also tried to use DispatcherPriority.Background


Q: Google tag manager events not appearing in google analytics A client has requested that we implement google tag manager on to track submission of all the forms on his website. We have set up all of the tags and triggers per the instructions that we found online but it appears that only 1 tag is actually working. We the Solids Conveying Case Studies event appear in the behavior > events> overview screen of analytics but not in the Real Time screen. All other tags do not appear to fire at all. We did view the preview/debug mode and see what appears to be a glimpse of a tag after the form submits and the page reloads. Also during our debugging process we tried setting the action to trigger on the form id, and we tried checking Wait for Tags. Any assistance would be greatly appreciated.
Here is a link to the website: https://foxvalve.com
Here is an example of a tag that we set up.
Tag Type: Universal Analytics
Track Type: Event
Category: Air Gas Ejectors (Different Depending on the Form)
Action: Submit
Label: Form
Value: empty
Non-Interaction Hit: True
Google Analytics Settings: Google Analytics Variable
Trigger Configuration
Trigger Type: Form Submission
Trigger Fires On Page URL equals (the page URL of the form)


Q: How to automatically run a VB6 compiled software as Administrator and in Compatibility mode We have an ERP application which is built in VB6 and it was running just fine till a few of our customer upgraded all their systems to Win7.
This software is programmed in such a way that it registers a few plugins (found in plugin folder) which are COM based at runtime. Now when the software is run by user without setting Compatibility Mode and Run as Administrator setting it fails and crashes.
I know we can manually set both Compatibility Mode as well as Run a Administrator by right clicking on program executable and then going to its properties. But this looks very unprofessional.
I think there will be some way to tell Win 7 to automatically run a software in Compatibility Mode and Run as Administrator.
Please help me.

A: Compatibility is an administrative function, not a development or deployment function.  It is better to fix the application where possible, especially to remove any requirement for elevation.
There are plenty of tools for investigating the issues so you can correct them.  However globally registering "plug ins" at runtime is a nasty one.  VB6 component self-registration is always global unless registry virtualization can redirect it.  Why not create installers for the plug-ins that can run elevated once during installation?
There are ways to set compatibility less manually, even as part of installation - though Microsoft discourages this.  Maybe take a look at:
Compatibility Fix Database Management Strategies and Deployment
However the effort required might be better spent on remediating the problem.  Support costs will be less over time.

A: As the other answers have said, you shouldn't need to run all the time elevated.
If you want to register the plugins after its started (as a normal user), you can use ShellExecute() with the "runas" verb to run regsvr32.exe, or use COM elevation which has been discussed many times before.

A: You can indicate that an application must run as admin by specifying it in the Application Manifest, which in an xml file that you can either embed or deploy with your application.
Once your application is running with admin rights it should be able to register and load the plugins.  You should not need to run in compatibility mode to access the COM plugins.


Q: How to render parts of form from ActionListener in JSF I have a simple file upload mechanism in one of my jsf pages. Once the file has been uploaded, I have an ActionListener that fires. At this point, I have access to the name of the file that the user uploaded, and I want to add this to an outputText component. How can I re-render the form from java code so that the file is displayed? Can I call some ajax function?
/**
 * Called when a file is uploaded
 * @param event The FileUploadEvent that contains info on the file uploaded
 */
public void handleFileUpload(FileUploadEvent event){
    data = event.getFile().getContents();
    name = event.getFile().getFileName();
}

Above is the code that runs once the file has been uploaded. You can see I get the name of the file. I need now to re-render the outputText so that the name is displayed.

A: This is usually to be declared in the view side.
Even though you didn't mention anything about it (which is bad; you should always mention in the question which JSF implementation and component libraries exactly you're using and for sure not overgeneralize everything as "standard JSF"), the listener method code which you've there is recognizeable as the one specific to PrimeFaces <p:fileUpload>.
In that case, you should actually be using component's own update attribute which should reference the (relative) client ID of the component you'd like to update on complete of the ajax request.
<p:fileUpload ... update="text" />
...
<h:outputText id="text" value="#{bean.text}" />

That's all. You'd in this particular example just have to assign the filename to the text property.
See also:

*

*<p:fileUpload> VDL documentation — lists all available attribtues.


Q: How to prevent replacement annotation from changing position and text size? I'm using iTextSharp to replace Typewriter annotations with Textboxes that have the same content and position, but some of the resulting Textboxes end up in different positions with different text sizes, despite seemingly having exactly the same data in their hashMap.
The problem is that when I create these new annotations on this sample PDF, and then view the PDF in Adobe Acrobat XI, the new Textboxes have the following problems:

*

*They have moved from their original positions (adjacent to the arrows) to lower on the page

*The text has changed in size

*There is no Properties available when the new Textbox is right-clicked
I suspect that all 3 problems are due to a single underlying issue with how I'm creating the new Textbox.
When I check the /Rect key in the hashMap for annot, it has the same rectangle coordinates in the same order as the original freeTextAnnot, so I don't understand why some of the annotations end up displaced.
Here's my code for creating the new Textboxes with the existing Typewriter annotation data.  Note that you'll need to set inputPath and outputPath to the actual location of the PDF and its destination path:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using iTextSharp;
using iTextSharp.text.pdf;
using System.IO;

namespace PDFConverterTester
{
    public class PdfModifierTester
    {
        public void testWithPaths()
        {
            //set to location of test PDF
            string inputPath = @"C:\InputPath\Before Conversion Dummy.pdf";
            //set to destination of new PDF
            string outputPath = @"C:\OutputPath\Before Conversion Dummy.pdf";
            test(inputPath, outputPath);
        }

        public void test(string inputPath, string outputPath)
        {
            PdfReader pdfReader = new PdfReader(inputPath);
            PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(outputPath, FileMode.Create));
            //get the PdfDictionary of the 1st page
            PdfDictionary pageDict = pdfReader.GetPageN(1);
            //get annotation array
            PdfArray annotArray = pageDict.GetAsArray(PdfName.ANNOTS);
            //iterate through annotation array
            int size = annotArray.Size;
            for (int i = size - 1; i >= 0; i--)
            {
                PdfDictionary dict = annotArray.GetAsDict(i);
                PdfName ITName = dict.GetAsName(new PdfName("IT"));
                if (ITName != null)
                {
                    if (ITName.Equals(new PdfName("FreeTextTypewriter")))
                    {
                        PdfAnnotation annot = copyToNewAnnotation_SSCCE(dict,pdfStamper);
                        pdfStamper.AddAnnotation(annot, 1);
                        annotArray.Remove(i);
                    }
                }
            }
            pdfStamper.Close();
            pdfReader.Close();
        }

        private PdfAnnotation copyToNewAnnotation_SSCCE(PdfDictionary freeTextAnnot,PdfStamper pdfStamper)
        {

            //need Rectangle for CreateFreeText()
            iTextSharp.text.Rectangle rect;
            PdfArray rectArray = freeTextAnnot.GetAsArray(PdfName.RECT);
            if (rectArray == null)
            {
                rect = null;
            }
            else
            {
                rect = new iTextSharp.text.Rectangle(getFloat(rectArray, 0),
                                                                          getFloat(rectArray, 1),
                                                                          getFloat(rectArray, 2),
                                                                          getFloat(rectArray, 3));
            }
            //create new annotation
            PdfContentByte pcb = new PdfContentByte(pdfStamper.Writer);
            PdfAnnotation annot = PdfAnnotation.CreateFreeText(pdfStamper.Writer, rect, "", pcb);
            //make array of all possible PdfName keys in dictionary for freeTextAnnot
            string pdfNames = "AP,BS,C,CA,CL,CONTENTS,CREATIONDATE,DA,DS,F,IT,LE,M,NM,P,POPUP,Q,RC,RD,ROTATE,SUBJ,SUBTYPE,T,TYPE";
            string[] pdfNameArray = pdfNames.Split(',');
            //iterate through key array copying key-value pairs to new annotation
            foreach (string pdfName in pdfNameArray)
            {
                //get value for this PdfName
                PdfName key = new PdfName(pdfName);
                PdfObject obj = freeTextAnnot.Get(key);
                //if returned value is null, maybe key is case-sensitive
                if (obj == null)
                {
                    //try with first letter only capitalized, e.g. "Contents" instead of "CONTENTS"
                    string firstCappdfName = char.ToUpper(pdfName[0]) + pdfName.Substring(1);
                    key = new PdfName(firstCappdfName);
                    obj = freeTextAnnot.Get(key);
                }
                //set key-value pair in new annotation
                annot.Put(key, obj);
            }
            //change annotation type to Textbox
            annot.Put(PdfName.SUBTYPE, PdfName.FREETEXT);
            annot.Put(new PdfName("Subj"), new PdfString("Textbox"));

            //set a default blank border
            annot.Put(PdfName.BORDER, new PdfBorderArray(0, 0, 0));

            return annot;

        }

        private float getFloat(PdfArray arr, int index)
        {
            return float.Parse(arr[index].ToString());
        }
    }
}

EDIT: It seems that part of the problem may be in the call to pdfStamper.AddAnnotation(annot,1), because annot's values for the /Rect key change after this call is made. E.g.:
before AddAnnotation() call:
{[2401, 408.56, 2445.64, 693]}

after call:
{[1899, 2445.64, 2183.44, 2401]}

So maybe the following code from PdfStamper.AddAnnotation() (link to source), lines 1463-1493, is responsible, I'm currently investigating this possibility:
if (!annot.IsUsed()) {
                        PdfRectangle rect = (PdfRectangle)annot.Get(PdfName.RECT);
                        if (rect != null && (rect.Left != 0 || rect.Right != 0 || rect.Top != 0 || rect.Bottom != 0)) {
                            int rotation = reader.GetPageRotation(pageN);
                            Rectangle pageSize = reader.GetPageSizeWithRotation(pageN);
                            switch (rotation) {
                                case 90:
                                    annot.Put(PdfName.RECT, new PdfRectangle(
                                        pageSize.Top - rect.Top,
                                        rect.Right,
                                        pageSize.Top - rect.Bottom,
                                        rect.Left));
                                    break;
                                case 180:
                                    annot.Put(PdfName.RECT, new PdfRectangle(
                                        pageSize.Right - rect.Left,
                                        pageSize.Top - rect.Bottom,
                                        pageSize.Right - rect.Right,
                                        pageSize.Top - rect.Top));
                                    break;
                                case 270:
                                    annot.Put(PdfName.RECT, new PdfRectangle(
                                        rect.Bottom,
                                        pageSize.Right - rect.Left,
                                        rect.Top,
                                        pageSize.Right - rect.Right));
                                    break;
                            }
                        }
                    }
                }

A: The cause
You have yourself found the cause for the change of position and dimension of the annotation:

It seems that part of the problem may be in the call to pdfStamper.AddAnnotation(annot,1), because annot's values for the /Rect key change after this call is made.
... code from PdfStamper.AddAnnotation() (link to source), lines 1463-1493, is responsible

Indeed, that code changes the annotation rectangle if the page is rotated.
The rationale behind this is that for rotated pages iText attempts to lift the burden of adding the rotation and translation to page content required to draw upright text and have the coordinate system origin in the lower left of the page of the users' shoulders, so that the users don't have to deal with page rotation at all. Consequently, it also does so for annotations.
For page content there is a PdfStamper property RotateContents defaulting to true which allows to switch this off if one explicitly does not want this rotation and translation. Unfortunately there isn't a similar property for annotations, their positions and sizes always get "corrected", i.e. rotated and translated.
A work-around
As the page rotation is the trigger for iText to rotate and translate the rectangle, one can simply remove the page rotation before manipulating the annotations and add it again later:
PdfDictionary pageDict = pdfReader.GetPageN(1);
// hide the page rotation
PdfNumber rotation = pageDict.GetAsNumber(PdfName.ROTATE);
pageDict.Remove(PdfName.ROTATE);
//get annotation array
PdfArray annotArray = pageDict.GetAsArray(PdfName.ANNOTS);
//iterate through annotation array
int size = annotArray.Size;
for (int i = size - 1; i >= 0; i--)
{
    ...
}
// add page rotation again if required
if (rotation != null)
    pageDict.Put(PdfName.ROTATE, rotation);
pdfStamper.Close();

With this addition the annotations stay in place.
The missing Properties
You also observed:

There is no Properties available when the new Textbox is right-clicked

This is because you have not changed the intent (IT) entry, so they still contained FreeTextTypewriter, so Adobe Reader is not sure what kind of object that is and, therefore, offers no Properties dialog. If you also change the intent:
//change annotation type to Textbox
annot.Put(PdfName.SUBTYPE, PdfName.FREETEXT);
annot.Put(new PdfName("IT"), PdfName.FREETEXT); // <======
annot.Put(new PdfName("Subj"), new PdfString("Textbox"));

you'll get the Properties dialog.
As an aside
Your method getFloat first caused weirdest changes in coordinate systems for me because my locale does not use dots as decimal separator.
I changed it to this to make it locale-independent:
private float getFloat(PdfArray arr, int index)
{
    return arr.GetAsNumber(index).FloatValue;
}

An alternative approach
Is there a specific reason why you replace the original annotation instead of simply editing it? E.g.:
public void AlternativeReplaceFreetextByTextbox(string InputPath, string OutputPath)
{
    PdfName IT = new PdfName("IT");
    PdfName FREETEXTTYPEWRITER = new PdfName("FreeTextTypewriter");
    using (PdfReader Reader = new PdfReader(InputPath))
    {
        PdfDictionary Page = Reader.GetPageN(1);
        PdfArray Annotations = Page.GetAsArray(PdfName.ANNOTS);
        foreach (PdfObject Object in Annotations)
        {
            PdfDictionary Annotation = (PdfDictionary)PdfReader.GetPdfObject(Object);
            PdfName Intent = Annotation.GetAsName(IT);
            if (FREETEXTTYPEWRITER.Equals(Intent))
            {
                // change annotation type to Textbox
                Annotation.Put(IT, PdfName.FREETEXT);
            }
        }

        using (PdfStamper Stamper = new PdfStamper(Reader, new FileStream(OutputPath, FileMode.Create)))
        { }
    }

}


Q: Action of the center of an enriched category on a module as an enriched functor If $M$ is a left-module over a ring $R$, then $M$ carries an action of $Z(R)$, the center of $R$, since it is a subring of $R$, by restriction of scalars. Since $Z(R)$ is commutative we may view this as a left or right action. Similarly, if $M$ is a right $R$-module and $N$ is a left $R$-module, while one usually defines $M\otimes_R N$ as just an abelian with no action, it actually carries an action of $Z(R)$.
Categorifying this picture horizontally, let $C$ be any category enriched over $\mathcal{V}$, let $M\colon C^\text{op}\to \mathcal{V}$ and $N\colon C\to\mathcal{V}$ be contravariant and covariant $\mathcal{V}$-enriched functors, which we view as right- and left-modules, respectively. Then we define the center to be $Z(C)=\hom(1_C,1_C),$ the endonatural transformations of the identity functor on $C$. We can define $\mathcal{V}$-natural transformations as elements $I\to\hom(x,x)$, for $x\in C$ and where $I$ is the unit of the monoidal structure on $\mathcal{V}$. In this case, $Z(C)$ is a set and it is easy to see how elements act on modules. As Martin points out in the comments, for $\alpha$ any natural transformation in $Z(C)$, $M\alpha$ is a natural transformation $M\to M$.
However it is more natural for $Z(C)$ to retain the structure of an object of $\mathcal{V}$, (the center of a ring is a ring, for example). Hence we should define $Z(C)$ to be the end $\int_{x\in C}\hom_C(x,x)$. This is an object of $\mathcal{V}$, hence is not a set, and we may not speak of its elements. We might consider the set of generalized elements, morphisms $I\to\hom_C(x,x)$, which are the $\mathcal{V}$-natural transformations. But these do not constitute an object of $\mathcal{V}$, and hence do not give an action on $M$ (which, remember, is defined as a $\mathcal{V}$-enriched functor).
So how do we construct this action as an enriched functor, from the functor $M$? How should we think about this generally? Like any endomorphism hom-object, $Z(C)$ must be a monoid object in $\mathcal{V}$. Does a functor out of a category somehow induce a functor on the delooping of this monoid of endomorphisms of the identity functor on the category?

A: I think I was confused by the module language. I was looking for a functor from $Z(C)$ to $\mathcal{V}$. But an action of a category $C$ on a module $M$ is just morphisms $C(a,b)\otimes M(a)\to M(b)$. So an action isn't a functor, although a functor is a thing which always has an action. And then we can loosen the notion of action to be any collection $\{C_a\}_{a\in C}$ of $\mathcal{V}$-objects indexed by objects of $C$ with morphisms $C_a\otimes M(a)\to M(a)$, and the center $Z(C)$ has an action of this form by virtue of the components of the end $\int_C\hom(1,1)\to\hom(a,a)\to\hom(Ma,Ma).$ Basically the center acts because it maps to the hom-objects of the category, so we have something like "restriction of scalars" of the module $M$. And this of course agrees with the obvious action by multiplication in the set-enriched case.


Q: Bioconductor package development S3 vs S4 I'm working with a lab developing a package for consideration submission to Bioconductor.
Currently, it uses S3 class objects. Everything that I've seen so far in bioncoductor uses S4. Before we attempt to submit, we are wondering if the S3 would disqualify the package. Looking for advice.


Q: D3 - How to bind the same data to multiple object? I am trying to draw multiple shapes using the same data in a selection, so let's say I have:
myData = [
    {
        shape: 'rect',
        attr: { width: 100, height: 100, x: 100, y:100 }
    } , {
        shape: 'circle',
        attr: {cx, cy, etc...}
    }
]

node.selectAll('*').data([myData]);

myData.obj.forEach(function(obj) {
    // Append different shapes based on data
    var shape = node.enter().append(obj.shape);
    Object.keys(obj.attrs).forEach(function(attr) {
        // Bind attrs to shapes based on data
        shape.attr(attr, obj.attrs[attr]);
    });
});

Here node is a 'g' element, myData is a single data object. My goal is to modify the child shapes inside the g based on myData, so later if I bind another myData and call this function again, they can be updated. But I believe somehow myData is only bound to the first appended shape. Is there a way to easily bind the same data to multiple shapes?

A: I would create a g element for entry in myData:
groups = d3.select('body').append('svg')
           .selectAll('g').data(myData).enter()
           .append('g');

and append shapes to those group elements individually:
groups.append('rect')
groups.append('circle')

A: Perhaps, what you want here is the .datum() function in d3. One of it's specific use-cases is to bind the same datum to multiple DOM elments (i.e. bind one datum to an entire d3 selection).
For example, d3.selectAll('div').datum({foo: 'bar'}) would bind the same object {foo: 'bar'} to all of the <div>...</div> elements currently existing on the document.
Quoting directly from https://github.com/mbostock/d3/wiki/Selections#datum

selection.datum([value])...If value is specified, sets the element's
  bound data to the specified value on all selected elements. If value
  is a constant, all elements are given the same data [sic]

(Somewhat ironically, he refers to the constant datum as "data" in the explanation of the .datum() function!)
However, this is a literal answer to your question; there may be a more design-oriented answer to your question which might explain the "conventional" d3-way of handling your overall objective... In which case, you should probably consult some tutorials like
http://mbostock.github.io/d3/tutorial/circle.html

A: TLDR;
Use Selection.data "key" argument function.

A key function may be specified to control which datum is assigned to which element
  «This function is evaluated for each selected element, in order, […] The key function is then also evaluated for each new datum in data, […] the returned string is the datum’s key.

(Search «If a key function is not specified…» paragraph)
More details …
D3 binds data to elements. By default is uses the «join-by-index» method (first found element maps to datum at index 0 and so forth…). If join-by-index is not enough to appropriately identify elements, Selection.data "key" should be used in order for D3 to appropriately synchronise input dataset during rendering phases: "update" (result of data() method call), "creation" enter selection, "removal" (exit selection).
Let's say we need to draw some legend, given the following dataset …
const dataSet = [
  [ 15, "#440154" ]
  [ 238.58, "#414487" ]
  // ...
]

we first decide to draw the coloured square using <rect> element.
const updateSelection = d3.select('rect').data(dataSet);
// join-by-index strategy is enough here so there is no need to supply the key fn arg
// Key function could be `d => d[0]` (given data source cannot produce two entries
// with value at index 0 being the same, uniqness is garanteed)

updateSelection.enter()
    .append('rect')
    .attr('width', 15).attr('height', 15)
    .merge(updateSelection)
    .style('fill', d => d[1])
;

// Dispose outdated elements
updateSelection.exit().remove();

We now need a <text> element to be drawn for each given datum to visually expose numeric values. Keeping join-by-index (default) strategy would cause D3 to first draw both rect and text elements but since there can only be a single element bound to a specific datum key, only the first found element will be considered upon update phase and any other element having same datum key will end up in the exit selection and removed from the DOM as soon as the Selection remove method is called.

… If multiple elements have the same key, the duplicate elements are put into the exit selection …

A solution is to concatenate the numeric value with the element nodeName.
// Notice how the selector has changed
const updateSelection = d3.select('rect, text').data(dataSet, function(d) {
      // Concatenate the numeric value with the element nodeName
      return `${d[0]}:${this.nodeName}`;
  })
  , enterSelection = updateSelection.enter()
;

// Add rect element
enterSelection
    .append('rect').attr('width', 15).attr('height', 15)
    .merge(updateSelection)
    .style('fill', d => d[1])
;

// Add text label
enterSelection
    .append('text')
    .merge(updateSelection)
    .text(d => d[0])
;

// Dispose outdated elements
updateSelection.exit().remove();


Q: How to prevent updating/deleting a MySQL record when not using a primary key? I have a MySQL table containing information about songs, which has a primary key and a secondary unique key.  In my web-application the song's primary key is not 'sent' to the client, but a secondary unique key is that is not displayed by the browser, so that the web-app can update and delete each of the songs, one at a time.
Is there a way, possibly using a delete trigger and/or a stored procedure, to prevent a song's data row from being updated/deleted except when both the primary key AND the secondary unique key are specified in the MySQL command?
In my web-app the user can update/delete a song's data row, but they should only do this by 'posting' a request to the server that contains a command parameter with the values 'update' or 'delete' and the secondary unique key of the song to be deleted, plus any other necessary data in the case of an update.  Then the server looks up the song's primary key and performs the update/delete, which is 'caught' by the update/delete trigger, and only allowed to perform the actual update/delete when both the primary and  secondary keys are specified, sort of a 'two-factor' protection mechanism.
This way a malicious user who tries to perform some sort of SQL injection attack to change or delete a song's data records won't likely be able to do so because they won't know both of the required keys, where as injecting SQL commands with a guessed primary keys might otherwise get past the SQL injection prevention code.
It's either this or a switch that must be turned on before deletes or updates of the song data are permitted, which also rely on update/delete triggers.
I know about using prepared SQL statements and not letting using the user entered data be used directly in a SQL update/delete command as a means to protect against SQL injection attacks, but I'm not sure that these always work and the song data is so critical that I want to extra protection against malicious changes/deletes in case a user tries to update/delete song data without using the permitted means provided by the web-app.
Thanks


Q: Is there a (cheap) way to check if a entity exists? I have some keys and the only thing I want to know is if there is a matching entity in datastore. currently I'm doing:
entities = db.get(keys)
for entity in entities:
     if entity:
           # some stuff
     else:
           # some other stuff

While this works, I just need a boolean to be passed, not the entier object. Is there a way to make this bit of code a bit cheaper?

A: Compare the speed of what you're doing now against querying the keys one-at-a-time using a keys-only query. If there isn't a clear winner, take the keys-only query, since it costs less.


Q: Controller's Post method always has null property values on parameter (ASP.Net Core WebAPI & F#: ) My Controller's Post method always has null property values on parameter when triggered.
Environment:

I'm using ASP.Net Core WebAPI with F#.

Attempt:
I tried to apply a suggestion from this link to my Startup.fs file:
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver <-
        Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()

However, GlobalConfiguration is an unrecognized type.
Here's a larger view of my attempt:
type Startup private () =
    new (configuration: IConfiguration) as this =
        Startup() then
        this.Configuration <- configuration

        // *** I INSERTED THIS BELOW *** //
        GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver <-
            Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()

Similar questions:
I did review this link. However, nothing worked.
HTTP Post:
This is the Post method where I keep observing null property values on my parameter:
[<HttpPost>]
member x.Post(request:DataTransfer.Request) = (* "request" parameter is always null *)

    request |> Query.carriers
            |> function
               | Error _     -> x.StatusCode(500) :> IActionResult
               | Ok carriers -> x.Ok(carriers)    :> IActionResult

The actual type is defined here:
[<CLIMutable>]
type Request = {
    RequestId : string
    Customer  : Customer
    ItemQtys  : ItemQty seq
}

Client:
My client app makes the following call:
let client   = WebGateway.httpClient APIBaseAddress
let response = client.PostAsJsonAsync("carriers", request) |> toResult

Here's the request type on the client:
[<CLIMutable>]
type Request = {
    RequestId : string
    Customer  : Customer
    ItemQtys  : ItemQty seq
}

UPDATE:
I then attempted to apply a suggestion from this link and also using this reference. It didn't work though.
member this.ConfigureServices(services: IServiceCollection) =
    // Add framework services.
    services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
            .AddJsonOptions(fun opt ->

                               let resolver = Newtonsoft.Json.Serialization.DefaultContractResolver()
                               resolver.NamingStrategy <- null
                               opt.SerializerSettings.ContractResolver <- resolver

                           ) |> ignore

Postman:

Screenshots:

Partial Success:
The following seems promising:

Hence, the code above results in actual values sent from the client. However, I haven't found a way to convert the object into the data transfer type that I need.

A: You don't need to mess with Contract Resolvers in ASP.NET Core to use camel-case and F# record types, as you did with ASP.NET.  I would take all of that out, or try creating a simple test project to get it working, then go back and make the appropriate changes to your real project.  With no additional configuration, you should be able to get something working just by following these steps:

*

*Run dotnet new webapi -lang F#

*Add the following type to ValuesController.fs:

    [<CLIMutable>]
    type Request =
    {
        Name: string
        Value: string
    }

*Change the Post method to be something like this:

    [<HttpPost>]
    member this.Post([<FromBody>] request:Request) =
        this.Created(sprintf "/%s" request.Name, request)

*Debug the service to validate that it works by sending the following request in PostMan:

    {
        "name": "test",
        "value": "abc"
    }

You should see the request object echoed back with a 201 response.


Q: Project '' is not up to date. Input file '' is modified after output file '' I'm creating a typescript project (Project type - Web Application with Typescript), that includes typescript, javascript and other static files.
I'm using the Visual Studio 2015 build environment, and the Microsoft.TypeScript.MSBuild.1.8.11 nuget package for the actual compilation (i.e. not using tsconfig.json).
I have a Post-build event task which has the side effect of 'touch'ing some of these static files. When I subsequently trigger another build, I get a warning in the output*:
Project '<project name>' is not up to date.
Input file '<static file>' is modified after output file ''.`

and the project is forced to rebuild.
Can anyone think how I can work out what VS2015 is referring to when it talks about "output file ''"?

*

*I've got MSBuild set to output Diagnostic information in the Tools->Options->Build And Run settings.

A: To answer my own question - in the hope that it assists someone else.
The file VS reports as "output file ''", appears to relate to the output dll/pdb files in the bin folder, but also to the obj/$(Configuration) files that get built during the compilation process.
So, if I perform:
touch obj\Debug\myProj.dll obj\Debug\myProj.pdb
touch bin\myProj.dll bin\myProj.pdb

within my post-build task, then this seems to solve the problem and gets the compiler back to what I'd expect:
 ========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

A: I just deleted .vs folder & cleaned solution then worked fine.