using jquery $.ajax to call a PHP function

using jquery $.ajax to call a PHP function

This may be a simple answer, but I'm using jQuery's $.ajax to call a PHP script. What I want to do is basically put that PHP script inside a function and call the PHP function from javascript. <?php if(isset($_POST['something'] { //do so

Replicate each row of data.frame and specify the number of replications for each row

Replicate each row of data.frame and specify the number of replications for each row

df <- data.frame(var1=c('a', 'b', 'c'), var2=c('d', 'e', 'f'), freq=1:3)What is the simplest way to expand the first two columns of the data.frame above, so thateach row appears the number of times specified in the column 'freq'?In other wo

Simple way to transpose columns and rows in Sql?

Simple way to transpose columns and rows in Sql?

How do I simply switch columns with rows in SQL?Is there any simple command to transpose?ie turn this result: Paul | John | Tim | EricRed 1 5 1 3Green 8 4 3 5Blue 2 2 9

Insert into … values ( SELECT … FROM … )

Insert into … values ( SELECT … FROM … )

I am trying to INSERT INTO a table using the input from another table. Although this is entirely feasible for many database engines, I always seem to struggle to remember the correct syntax for the SQL engine of the day (MySQL, Oracle, SQL

Is there any difference between 'valid xml' and 'well formed xml'?

Is there any difference between 'valid xml' and 'well formed xml'?

I wasn't aware of a difference, but a coworker says there is, although he can't back it up. What's the difference if any? 1:There is a difference, yes. Xml that adheres to the xml standard is considered well formed, while xml that adhere

Javascript: Do I need to put this.var for every variable in an object?

Javascript: Do I need to put this.var for every variable in an object?

In C++, the language I'm most comfortable with, usually one declares an object like this:class foo{public: int bar; int getBar() { return bar; }}Calling getBar() works fine (ignoring the fact that bar might be uninitialized). The vari

What's the difference between JavaScript and Java?

What's the difference between JavaScript and Java?

What's the difference between JavaScript and Java? 1:Java and Javascript are similar like Car and Carpet are similar. 2:One is essentially a toy, designed for writing small pieces of code, and traditionally used and abused by inexperi

What is the difference between #include  and #include “filename”?

What is the difference between #include and #include “filename”?

In the C and C++ programming languages, what is the difference between using angle brackets and using quotes in an include statement, as follows?#include #include "filename" 1:In practice, the difference is in the location whe

How can I obfuscate (protect) JavaScript? [closed]

How can I obfuscate (protect) JavaScript? [closed]

I want to make a JavaScript application that's not open source, and thus I wish to learn how to can obfuscate my JS code? Is this possible? 1:Obfuscation:Try YUI Compressor. It's a very popular tool, built, enhanced and maintained by th

Reference: What is variable scope, which variables are accessible from where and what are “undefined

Reference: What is variable scope, which variables are accessible from where and what are “undefined

Note: This is a reference question for dealing with variable scope in PHP. Please close any of the many questions fitting this pattern as duplicate of this one.What is "variable scope" in PHP? Are variables from one .php file accessible in

How to emulate a BEFORE INSERT trigger in T-SQL / SQL Server for super/subtype (Inheritance) entitie

How to emulate a BEFORE INSERT trigger in T-SQL / SQL Server for super/subtype (Inheritance) entitie

This is on Azure.I have a supertype entity and several subtype entities, the latter of which needs to obtain their foreign keys from the primary key of the super type entity on each insert. In Oracle, I use a BEFORE INSERT trigger to accomp

How do you use JsHint “.jshintrc” file with Visual Studio 2013 Web Essentials extension?

How do you use JsHint “.jshintrc” file with Visual Studio 2013 Web Essentials extension?

I have installed the "Web Essentials" extension into Visual Studio 2013. I am now getting JSHint warnings appearing in my "Error List" window under the Messages section. However, it is complaining about some global variables that it think

Naming convention and structure for utility classes and methods

Naming convention and structure for utility classes and methods

Do you have any input on how to organize and name utility classes?Whenever I run in to some code-duplication, could be just a couple of code lines, I move them to a utility class. After a while, I tend to get a lot of small static classes,

Missing makecert.exe

Missing makecert.exe

For some reason I am missing makecert.exe on my system. I searched the whole hard drive and it's not there. In particular, it's not in C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin where I believe it's supposed to be. I haven't found an

How do you remove the column name row from a pandas DataFrame?

How do you remove the column name row from a pandas DataFrame?

Say I import the following excel spreadsheet into a dfVal1 Val2 Val31 2 3 5 6 7 9 1 2How do I delete the column name row (in this case Val1, Val2, Val3) so that I can export a csv with no column names, just the data?I h

Return elements of list as independent objects in global environment

Return elements of list as independent objects in global environment

I have a list, and would like to break the elements of the list into seperate objects in the global environment. For example, I would like the list: obj to be three seperate objects a, b, and c. I tried to achieve this with: lapply(obj, FUN

Iterate over enum?

Iterate over enum?

I'm trying to iterate over an enum, and call a method using each of its values as a parameter. There has to be a better way to do it than what I have now:foreach (string gameObjectType in Enum.GetNames(typeof(GameObjectType))){ GameObje

Maximum length of a MIME Content-Type header field?

Maximum length of a MIME Content-Type header field?

I'm just designing the schema for a database table which will hold details of email attachments - their size in bytes, filename and content-type (i.e. "image/jpg", "audio/mp3", etc).Does anybody know the maximum length that I can expect a c

How do you override the class name in the form_for helper?

How do you override the class name in the form_for helper?

I need to add some class names to my form. I'm using Rails' form_for helper to do this. I've tried adding { :class => 'classname' } to no avail. How can I add classes to this Rails helper output? 1:Try this:form_for @order, :html => {:cl

Rd file name conflict when extending a S4 method of some other package

Rd file name conflict when extending a S4 method of some other package

Actual questionHow do I avoid Rd file name conflicts when a S4 generic and its method(s) are not necessarily all defined in the same package (package containing (some of) the custom method(s) depends on the package containing the generic) a

R: Interaction Plot with a continuous and a categorical variable for a GLMM (lme4)

R: Interaction Plot with a continuous and a categorical variable for a GLMM (lme4)

I would like to make an interaction plot to visually display the difference or similarity in slopes of interaction of a categorical variable (4 levels) and a standardized continuous variable from the results of a regression model.with(GLMMo

Saving a list of plots by their names()

Saving a list of plots by their names()

Let's say I have a list of plots that I've created. library(ggplot2)plots Now, I would like to save all of these, labelling each with their respective names(plots) element. lapply(plots, function(x) { ggsave(filename=paste(.

plotting list object using ggplot [closed]

plotting list object using ggplot [closed]

I'm running some simulations that I was wondering to plot the outcomes in a beautiful ggplot, but it seems that ggplot can't deal with list objects. Does anyone knows how to paste the results into ggplot chart? N Ugly solution: names(p

Loops with captions with knitr

Loops with captions with knitr

I am wondering if there is an easy way to produce a bunch of tables or graphics with variable captions in knitr. The only way I know is this: (simplified from https://github.com/yihui/knitr-examples/blob/master/075-knit-expand.Rnw). But it

Custom Wrapper Codec Integration into Android

Custom Wrapper Codec Integration into Android

I need to develop a custom 'wrapper' video codec and integrate it into android (JB for now, ICS later). We want to use some custom decryption keys from the SIM (don't ask!). The best method (that would allow it to work alongside other non