how to get the contents of a list in a webpage - list

I want to get the content of a list in a webpage from below
http://www.alzgene.org/default.asp
like select gene, there are some genes list, I want to get all the genes from this list, is there any way to do this?
I am not sure I should contact the administrator since it stopped update since april 2011
Thanks

If you know how to run a script in the browser console here is the JS that will give you what you want:
var options = document.getElementById('genesDDDiv').getElementsByTagName('option'),
result = "Options: ";
for(var i = 1; i < options.length; i++) {
result += options[i].innerHTML.replace(/<(\/)?option>/, options[i]) + ",";
}
console.log(result);
Results:
A2M,A2MP,ABCA1,ABCA12,ABCA2,ABCA7,ABCB1,ABCC2,ABCC8,ABCC9,ABCG1,ABCG4,ABCG5,ACAD8,ACAN,ACAT2,ACE,ACF,ACHE,ACO2,ACSL4,ACTA2,ADAM10,ADAM12,ADAM17,ADAM9,ADCYAP1R1,ADORA2A,ADORA2B,ADRA1A,ADRA2A,ADRB1,ADRB2,ADRB3,AGER,AGPAT1,AGT,AHR,AHSG,AKAP8,AKT2,ALB,ALDH18A1,ALDH2,ALOX5,ALOX5AP,ANK3,ANXA8,AP3M1,APBA1,APBB1,APBB1IP,APBB2,APEX1,APH1A,APH1B,APOA1,APOA1BP,APOA2,APOA4,APOA5,APOB,APOBEC1,APOBEC2,APOC1,APOC1P1,APOC2,APOC3,APOC4,APOD,APOE,APOE_e2/3/4,APOM,APP,AR,ARID4A,ARID5B,ARL5B,ARMS2,ARSB,ART3,ATF7,ATP6V0A4,ATXN1,ATXN8OS,AVPR1A,BACE1,BACE2,BAG3,BAT1,BCAM,BCHE,BCL2,BCL3,BCR,BDNF,BICC1,BIN1,BIRC3,BLMH,C10orf112,C12orf41,C1R,C2,C21orf55,C21orf63,C4A,C4B,CACNB2,CALHM1,CALHM2,CALHM3,CAMK1G,CAMK2G,CAND1,CARD8,CASP3,CASP4,CASP6,CASP8,CAST,CAT,CAV1,CAV3,CBLC,CBS,CCDC134,CCL2,CCL3,CCL5,CCL8,CCNT1,CCR2,CCR5,CD14,CD2AP,CD33,CD36,CD40,CDC2,CDK5,CDK5R1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CG1,PLG,PMVK,PNLIPRP1,PNMT,POMT1,POMT2,PON1,PON2,PON3,POU2F1,PPARA,PPARD,PPARG,PPARGC1A,PPIL2,PPM1H,PPP1CC,PPP1R10,PPP1R3A,PPP1R3C,PPP2R1A,PPP2R2B,PPP3CB,PRDX6,PRG1,PRKAA1,PRKAB2,PRND,PRNP,PRSS11,PRSS7,PRUNE2,PSAP,PSEN1,PSEN2,PSENEN,PSMB7,PSMB9,PTEN,PTENP1,PTGS2,PTPLA,PVRL2,PYY,PZP,RASSF4,RELN,REN,RFC1,RFTN1,RGS4,RGS6,RPS15,RPS6KA2,RTN3,RUNX1,RXRA,RXRB,RXRG,S100B,SAMSN1,SAR1A,SCARB1,SCD,SEC24C,SEL1L,SEMA4D,SEPT3,SERPINA1,SERPINA3,SERPINE1,SERPINF2,SFRP5,SGPL1,SGPP1,SH3PXD2A,SIRT1,SLC11A1,SLC11A2,SLC18A3,SLC2A2,SLC6A3,SLC6A4,SLIT1,SLK,SMAD3,SNCA,SNCAIP,SNCG,SOAT1,SOD2,SORCS1,SORCS2,SORCS3,SORL1,SORT1,SOS1,SOS2,SREBF1,SRP72,SST,STH,SUPV3L1,SYN3,TACR2,TANC2,TANK,TAP1,TAP2,TAPBPL,TARDBP,TBP,TCF2,TCF7L2,TCN1,TCN2,TET1,TF,TFAM,TFCP2,TGFB1,TGM4,THRA,TIMP1,TLL2,TLR4,TM4SF5,TMC5,TMED8,TMEM132C,TMEM63C,TNF,TNFRSF14,TNFRSF1A,TNFRSF1B,TNFRSF4,TNFRSF8,TNK1,TNMD,TOMM40,TP53,TP63,TP73,TPH1,TRAF2,TRAK2,TREM2,TRPC4AP,TSPAN15,TTR,TUBB,UBD,UBE2D1,UBE2I,UBQLN1,UCHL1,UCP2,USF1,USF2,VCL,VCP,VDR,VEGF,VLDLR,VPS26A,VPS35,VR22,WNT8B,WRN,WWC1,XRCC1,YWHAZ,ZAP128,ZNF202,ZNF292,ZWINT

Related

Google App Script IF function checking only one row, and applying the result to all rows

I seem to be going quite wrong somewhere.
I'm writing a script that will automatically send out a reminder email if a Google sheet cell turns to "Yes".
The problem is my script seems to read it as:
if the second row has a "yes" it will return true for all rows and send out an email to everyone, regardless of the other rows saying "yes" or "no".
if any other row has a yes, then it seems to be completely ignored.
Defining the range to check:
//looping through all of the rows
for (var i = 0; i < data.length; ++i) {
var row = data[i];
// Creating where the if statement is check
var ss = SpreadsheetApp.getActiveSheet();
var thisQuarter = ss.getRange("H2:H50").getValue();
The IF statement to check against:
// checking for this quarter
if (
thisQuarter == "Yes") {
var subject =
'Your BCP is due to expire this quarter: ';
MailApp.sendEmail(emailAddress, subject, message,);
Logger.log('this quarter');
}
}
}
If anyone could give me a couple pointers as to where I'm going wrong, that would be greatly appreciated.
Thank you,
Ideally post a view only copy of the sheet. I believe the problem is this section of code:
// checking for this quarter
if (
thisQuarter == "Yes") {
var subject =
'Your BCP is due to expire this quarter: ';
MailApp.sendEmail(emailAddress, subject, message,);
Logger.log('this quarter');
}
thisQuarter is assigned here:
var thisQuarter = ss.getRange("H2:H50").getValue();
change that line to this:
var thisQuarter = ss.getRange("H2:H50").getValues();
so thisQuarter is an array of values from the range specified
change the if statement to this and see if it helps:
for (i = 0; i < thisQuarter.length; i++) {
if (thisQuarter[i][0] == "Yes" {
// send email
}
}

Insert list item into a specific Table of google doc

This is the point.
I've followed the suggest linked here More efficient way to append a list item after some text in Google Docs ,whose very helpfull tom me. But i have the problem mentioned at the bottom.
My placeholder is inside a known table within a google doc.
I've tried several ways to figure it out, but i didn't achieve.
Here below there is the portion of code of interest.
Note:
"CarattCentralGas1" is an array of values;
"DescrizioneCentralGas" is another array of values;
My intent is to insert a list, created if the if condition is true, at the placeholder place and than remove it.
Any ideas would be great!`
for (var i=0; i < CarattCentraleGas1.length; ++i)
{ var ValueToTest = CarattCentraleGas1[i][0];
Logger.log(ValueToTest)
if (ValueToTest ==='Presente')
{ var valueToextract = DescrizioniCentraleGas[i][0];
var search = '%Placeholder%';
var Table1 = body.getTables()[0];
var found = Table1.findText(search);
while (found) {
var elem = found.getElement().getParent().getParent();
var index = Table1.getChildIndex(elem);
Table1.insertListItem(index+1, valueToextract+';');
found = Table1.findText(search, found);}
Logger.log(valueToextract)}
}
var Table1Text = Table1.editAsText().replaceText('%CarattCentrale1%',"");
`
this is the template document I want to edit with the script.

Spreadsheet Script, match with wildcard and different cases

I am having trouble executing the Spreadsheet script below.
I think there are two mistakes but I do not know how to fix.
Could anyone help it to fix it?
1:Wildcard
if(original_date=='....-..-..')
2:if synteax
if(original_date=='....-..-..')
{condition="matched"}
Detail
On the spreadsheet, there are two columns.
The first columns have dates in a format as YYYY-MM-DD such as 2020-04-21.
But sometimes, they have different formats such as 04/21/2020.
The second columns are empty.
Only when the first column cell has the "YYYY-MM-DD" format, I want to copy the cell into the second cell in the second column.
*They have 10 rows.
Here is the script.
var sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1')
for(let i=1; i<=10; i++)
{
original_date_range = sheet.getRange(i, 1);
original_date = original_date_range.getValue();
cleaned_date_range = sheet.getRange(i, 2);
var condition = "";
if(original_date=='....-..-..')
{condition="matched"}
switch(condition)
{
case "matched":
cleaned_date_range.setValue(original_date);
case "":
cleaned_date_range.setValue("");
break;
}
}
I found the solution by myself.
1.Wildcard
The date "2020-04-25" can be written as /\d{4}.\d{2}.\d{2}/
2.If syntax
(Wildcard).test(string to check) is going to give you true/false output
In summary,
if you want to execute different tasks through the verification of date format such as 2020-04-25,
var sheet1 = SpreadsheetApp.getActive().getSheetByName('Sheet1')
var limit = sheet1.getLastRow()
for(let i=4; i<=10; i++) //You can add more rows if you have
{
var orignal_date_cell = sheet1.getRange(i, 1);
var orignal_date_cell_value = orignal_date_cell.getValue();
var target_date_cell = sheet1.getRange(i,2);
if ((/\d{4}.\d{2}.\d{2}/).test(orignal_date_cell_value))
{
target_date_cell.setValue(orignal_date_cell_value);
}
}

facebook messenger chat bot with Watson conversation api Context variable manipulation

I am facing a problem with Facebook meseger chat- bot ,problem is with Context variable storing and update .
My code is divided in two parts
_________**********_________
part 1:
var index = 0;
Facebookcontexts.forEach(function(value) {
console.log(value.From);
if (value.From == sender_psid) {
FacebookContext.context = value.FacebookContext;
console.log("Inside foreach "+JSON.stringify(FacebookContext.context));
contextIndex = index;
}
index = index + 1;
});
Here I have created an array named Facebookcontexts to store contexts for different users.This is where I am getting position of the user in a Facebookcontexts array which is used for later .
_________**************_____________
part 2:
if((FacebookContext.context==null)||(Facebookcontexts.find(v=>v.From==sender_psid)==undefined)){
Facebookcontexts.push({"From":sender_psid,"FacebookContext":response.context})
console.log("I am where sender is unknmown"+JSON.stringify(Facebookcontexts)+"\n"+Facebookcontexts.length);
}
else if(Facebookcontexts.find(v=>v.From==sender_psid)!=undefined){
Facebookcontexts[contextIndex].FacebookContext=response.context;
console.log("I am at where I know the sender"+JSON.stringify(Facebookcontexts)+"\n"+Facebookcontexts.length);
}
I am deciding to create a new record or update old one in if and else
Issue:
My Issue is every time if((FacebookContext.context==null)||(Facebookcontexts.find(v=>v.From==sender_psid)==undefined)) is getting checked and for that array length is 1 all the time
I will look for some help from you guys.
Thanks ins advance

Linq query not matching hrefs

I'm trying to write out all matches found using a regex with the code below:
var source = "<Content><link><a xlink:href=\"tcm:363-48948\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">Read more</a></link><links xlink:href=\"tcm:362-65596\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"/></Content>";
var tridionHref = new Regex("tcm:([^\"]*)");
var elem = XElement.Parse(source);
XNamespace xlink = "http://www.w3.org/1999/xlink";
if (tridionHref.IsMatch(elem.ToString()))
{
foreach (var Id in elem.Elements().Where(x => x.Attribute(xlink + "href") != null))
{
Console.WriteLine(Id.Attribute(xlink + "href").Value); //For testing
Id.Attribute(xlink + "href").Value = Id.Attribute(xlink + "href").Value.Replace("value1", "value2"); //Just to show you an example
}
}
My console window outputs tcm:362-65596 but not tcm:363-48948. It looks like the code doesn't see the value of xlink:href inside my <a> tag as an attribute? Can anyone point me in the right direction? I need to match ALL instances of tcm:([^\"]*).
The problem is you are not looking in the right place. Your elem.Elements is looking at the link element and the links element. Only one of these has the attribute that you are looking for. You'll need to select the elements you want to check more precisely before looking for the right attribute.
I've got it working. I didn't need a regex I just needed to get the Descendants instead inside my for loop. foreach (var Id in elem.Descendants().Where(x => x.Attribute(xlink + "href") != null))