The meaning of the ampersand - ampersand

In this line:
var dataString = 'name='+ name + '&email=' + email + '&subject=' + subject + '&msg=' + msg;
What does the ampersand(&) mean?

I think the ampersands are meant for query string separation from each other
var dataString = 'name='+ name + '&email=' + email + '&subject=' + subject + '&msg=' + msg;
becomes
var dataString = 'name=John Doe&email=johndoe#gmail.com&subject=some email subject&msg=hey activate your account';
This can then be appended to your Url
var finalUrl = "http://mysite.com?" + dataString;

Related

Need to give cell value when mail has been sent with time and date in google script code [duplicate]

I want to give last cell value of col no. 20 when mail has been sent with time and date in the below script. and using this code when more than one rows are added at a time then "sent" value is being added to the last row only and remaining rows are left blank. when new other row is added since value is not equal to sent those values are also been attached So, when mail sent complete column need to be given value as sent. Once please check this
function sendEmail() {
//setup function
var ActiveSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet2");
var StartRow = 2;
var RowRange = ActiveSheet.getLastRow() - StartRow + 1;
var WholeRange = ActiveSheet.getRange(StartRow,1,RowRange,16);
var AllValues = WholeRange.getValues();
var message = "";
//iterate loop
for (i in AllValues) {
//set current row
var CurrentRow = AllValues[i];
//define column to check if sent (starts from "0" not "1")
var EmailSent = CurrentRow[14];
var caseworker = CurrentRow[7];
//if row has been sent, then continue to next iteration
if (EmailSent == "sent")
continue;
//set HTML template for information
message +=
"<p><b>Bank: </b>" + CurrentRow[1] + "</p>" +
"<p><b>Branch: </b>" + CurrentRow[2] + "</p>" +
"<p><b>Region: </b>" + CurrentRow[3] + "</p>" +
"<p><b>Lan Number: </b>" + CurrentRow[4] + "</p>" +
"<p><b>Customer Name: </b>" + CurrentRow[5] + "</p>" +
"<p><b>Loan Type: </b>" + CurrentRow[6] + "</p>" +
"<p><b>Case Worker: </b>" + CurrentRow[7] + "</p>" +
"<p><b>Site Visit Status: </b>" + CurrentRow[8] + "</p>" +
"<p><b>Site Visit Done By: </b>" + CurrentRow[9] + "</p>" +
"<p><b>Document recieved: </b>" + CurrentRow[11] + "</p>" +
"<p><b>File Upload: </b>" + CurrentRow[12] + "</p>" +
"<p><b>Remarks: </b>" + CurrentRow[10] + "</p><br><br>";
//set the row to look at
var setRow = parseInt(i) + StartRow;
//mark row as "sent"
ActiveSheet.getRange(setRow, 15).setValue("sent");
}
//define who to send grants to
var SendTo = "########gmail.com" + "," + "##########gmail.com" + "," + " ##########gmail.com";
//set subject line
var Subject = "New case initiated to Shirisha";
//send the actual email
MailApp.sendEmail({
to: SendTo,
cc: "##########gmail.com",
subject: Subject,
htmlBody: message,
});
}

Asp.net , to_date Function

I want to update record in oracle db. But it gives me error "date format picture ends before converting..." I uses to_date function. datatype of column is DATE.
Here is my query
var updateddate = DateTime.Now;
var testing= this.hidvalue.Value;
var idrow = id.Text;
var anserrow = lblanswer.Text;
var weightpwd = lblweighted.Text;
var solvetimerow =lblsolvetime.Text;
var updatedby = Session["Name"];
string queryDuppass = "Update ADU.QAT_DATA set Question='" + idrow + "',Answer='" + anserrow + "', Question_Weighted='" + weightpwd + "', Resolve_Estimated_Time='" + solvetimerow + "', Updated_By='" + updatedby + "', Updated_Date= to_date('" + updateddate + "','mm-dd-yyyy hh12:mi:ss'" + ")" + " where ID='" + testing + "'";

Data from Firebase in Browser shows fine but in html page shows as undefined

I have data downloaded from firebase DB and the data is fine but when this data is loaded into HTML all table TD shows undefined, not able to understand why been check a whole lot of codes not able to understand whats wrong here.
Thank You
var registration = firebase.database().ref("REGISTRATION")
dataRef = firebase.database().ref().child("REGISTRATION");
dataRef.on("value", rData);
function rData(data){
console.log(data.val());
var gData = data.val();
for (gDatarow in gData)
{
alert(email);
var email = gDatarow.email;
var name = gDatarow.name;
var gender = gDatarow.gender;
var date = gDatarow.date;
var phone = gDatarow.phone;
var state = gDatarow.state;
var school = gDatarow.school;
var clas = gDatarow.clas;
var classname = gDatarow.classname;
$("#reData").append("<tr><td>" + email + "</td></td>" + name + "</td><td>" + gender + "</td></td>" + date + "</td><td>" + phone + "</td></td>" + state + "</td><td>" + school + "</td></td>" + clas + "</td><td>" + classname + "</td></tr>");
}
}
enter image description here
This is what worked in my case :
dataRef.on("child_added", function(data) {
var rData = data.val();
$("#reData").append("<tr><td>" + rData.email + "</td><td>" + rData.name + "</td><td>" + rData.gender + "</td><td>" + rData.birthdate + "</td><td>" + rData.phone + "</td><td>" + rData.state + "</td><td>" + rData.school + "</td><td>" + rData.class + "</td><td>" + rData.classname + "</td></tr>");
});
Thanks to all for their time.

Regarding word search and lucene.net c#

i will use lucene.net first time so couple of confusion arising in mind when see the line of code. i got a sample code for searching word with lucene and few line are not clear to me.here is sample code below.
Question 1
ListBox1.Items.Clear();
var searcher = new Lucene.Net.Search.IndexSearcher(MapPath("~/searchlucene/"));
var oParser = new Lucene.Net.QueryParsers.QueryParser("content", new StandardAnalyzer());
string sHeader = " OR (header:" + TextBox1.Text + ")";
string sType = " OR (type:" + TextBox1.Text + ")";
string sSearchQuery = "(" + TextBox1.Text + sHeader + sType + ")";
var oHitColl = searcher.Search(oParser.Parse(sSearchQuery));
for (int i = 0; i < oHitColl.Length(); i++)
{
Document oDoc = oHitColl.Doc(i);
ListBox1.Items.Add(new ListItem(oDoc.Get("header") + oDoc.Get("type") + oDoc.Get("content")));
}
searcher.Close();
Question 2
this below lines not clear what is going on...!! please discuss the objective of each line below.
string sHeader = " OR (header:" + TextBox1.Text + ")";
string sType = " OR (type:" + TextBox1.Text + ")";
string sSearchQuery = "(" + TextBox1.Text + sHeader + sType + ")";
var oHitColl = searcher.Search(oParser.Parse(sSearchQuery));
for (int i = 0; i < oHitColl.Length(); i++)
{
Document oDoc = oHitColl.Doc(i);
ListBox1.Items.Add(new ListItem(oDoc.Get("header") + oDoc.Get("type") + oDoc.Get("content")));
}
Question 3
what is header:
what is type:
why heade & type concatinated after search keyword like string
sSearchQuery = "(" + TextBox1.Text + sHeader + sType + ")";
Question 4
why content is missing in searchquery content
what would be the result if i write like
string sHeader = " OR (header:" + TextBox1.Text + ")";
string sType = " OR (type:" + TextBox1.Text + ")";
string sContent = " OR (content:" + TextBox1.Text + ")";
string sSearchQuery = "(" + TextBox1.Text + sHeader + sType + sContent ")";
why header, type & content is reading....what for??
*oDoc.Get("header") + oDoc.Get("type") + oDoc.Get("content")*
why i need to read header,type & content like
oDoc.Get("header") + oDoc.Get("type") + oDoc.Get("content")
we can read content only....why type & header is also required??
The first code builds a query that searches several fields, assuming that the input in TextBox1 does not mess with the query (like containing parentheses or whitespaces). Building a search query with string concatenation is often hard to get right, I would use the MultiFieldQueryParser instead.
var fields = new[] { "content", "header", "type" };
var analyzer = new StandardAnalyzer(Version.LUCENE_30);
var queryParser = new MultiFieldQueryParser(Version.LUCENE_30, fields, analyzer);
var query = queryParser.Parse(TextBox1.Text);
var result = searcher.Search(query, 25); /* find 25 best matches */
Your for-loop iterates through the result and reads the values of the stored fields and add them to a listbox. This requires that the fields where indexed with Field.Store.YES to work.

Ajax call in wordpress returns -1 & no code is run from the functions.php file

I have to insert values into database table wp_ratings table using ajax in wordpress but it is not working. Below is the code i am using:
Ajax call:
$(function(){
$('#submit').click(function(){
var rating_allowed=document.getElementById("rating_allowed").value;
var product_id=document.getElementById("product_id").value;
var user_id=document.getElementById("user_id").value;
var pc_ip=document.getElementById("pc_ip").value;
var performance_input=document.getElementById("performance_input").value;
var features_input=document.getElementById("features_input").value;
var battery_input=document.getElementById("battery_input").value;
var overall_input=document.getElementById("overall_input").value;
var rating_cat_count=document.getElementById("rating_cat_count").value;
var rate_1_name_find=document.getElementById("rate_1_name_find").value;
var rate_2_name_find=document.getElementById("rate_2_name_find").value;
var rate_3_name_find=document.getElementById("rate_3_name_find").value;
var rate_4_name_find=document.getElementById("rate_4_name_find").value;
var pros=document.getElementById("pros").value;
var cons=document.getElementById("cons").value;
alert("g");
alert("action=updateRating&product_id=" + product_id + "&user_id=" + user_id + "&pc_ip=" + pc_ip + "&performance_input=" + performance_input + "&features_input=" + features_input + "&battery_input=" + battery_input + "&overall_input=" + overall_input + "&rating_cat_count=" + rating_cat_count +"&rate_1_name_find=" + rate_1_name_find + "&rate_2_name_find=" + rate_2_name_find + "&rate_3_name_find=" + rate_3_name_find + "&rate_4_name_find=" + rate_4_name_find + "&pros=" + pros + "&cons=" + cons);
$.ajax({
url:"/wp-admin/admin-ajax.php",
type:'POST',
data:"action=updateRating&product_id=" + product_id + "&user_id=" + user_id + "&pc_ip=" + pc_ip + "&performance_input=" + performance_input + "&features_input=" + features_input + "&battery_input=" + battery_input + "&overall_input=" + overall_input + "&rating_cat_count=" + rating_cat_count +"&rate_1_name_find=" + rate_1_name_find + "&rate_2_name_find=" + rate_2_name_find + "&rate_3_name_find=" + rate_3_name_find + "&rate_4_name_find=" + rate_4_name_find + "&pros=" + pros + "&cons=" + cons,
success:function(results)
{
alert(results);
}
});
}
);
});
in functions.php file:
function implement_ajax_updateRating()
{
$p_id = mysql_real_escape_string(htmlentities(trim($_POST['product_id'])));
$user_id = mysql_real_escape_string(htmlentities(trim($_POST['user_id'])));
$pc_ip = mysql_real_escape_string(htmlentities(trim($_POST['pc_ip'])));
$rate_1 = mysql_real_escape_string(htmlentities(trim($_POST['performance_input'])));
$rate_2 = mysql_real_escape_string(htmlentities(trim($_POST['features_input'])));
$rate_3 = mysql_real_escape_string(htmlentities(trim($_POST['battery_input'])));
$rate_4 = mysql_real_escape_string(htmlentities(trim($_POST['overall_input'])));
$rating_cat_numbers = mysql_real_escape_string(htmlentities(trim($_POST['rating_cat_count'])));
$rate_1_find = mysql_real_escape_string(htmlentities(trim($_POST['rate_1_name_find'])));
$rate_2_find = mysql_real_escape_string(htmlentities(trim($_POST['rate_2_name_find'])));
$rate_3_find = mysql_real_escape_string(htmlentities(trim($_POST['rate_3_name_find'])));
$rate_4_find = mysql_real_escape_string(htmlentities(trim($_POST['rate_4_name_find'])));
$pros = mysql_real_escape_string(htmlentities(trim($_POST['pros'])));
$cons = mysql_real_escape_string(htmlentities(trim($_POST['cons'])));
//add_post_meta('17', 'ff_value', "ff", true);
$rating_insert = mysql_query("INSERT INTO wp_rating (post_id, rating_1, rating_2,rating_3,rating_4,user_id,comment_id,pc_ip,pros,cons)
VALUES (".$p_id.", ".$rate_1.", ".$rate_2.",".$rate_3.",".$rate_4.",".$user_id.",".$comment_id.",'".$pc_ip."','".$pros."','".$cons."')");
//$multi_in = multiRatingWidth($p_id, $rating_cat_numbers, $rate_1_find, $rate_2_find, $rate_3_find, $rate_4_find);
die();
}
add_action('wp_ajax_updateRating', 'implement_ajax_updateRating');
add_action('wp_ajax_nopriv_updateRating', 'implement_ajax_updateRating');
But alert is returning -1 & nothing is saved in database.

Resources