How can I create bulk Hyperlinks (Parts 1 - 100) [closed] - html

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am currently creating a website and I have come across the problem of having over 100 links and I don't know how to Hyperlink every single one.
Lets say I wanted to structure it like
<a href="link.com/1-5JKFKS" target="_blank">Part 1</>
<a href="link.com/2-5KWMAS" target="_blank">Part 2</>
<a href="link.com/3-42JNSL" target="_blank">Part 3</>
How would one go about creating 106 links formatted like this. I'm not exactly sure what I am looking for or even what is required to do this. So I'm sorry for how broad the question is.
I created a program in C# to create it for me. If anyone ever needs it I can give out the source code.
https://i.imgur.com/7csfx3V.gifv

I don't quite understand what you're asking for, but this would work as far as I can tell:
var nOfLinks = 100;
for (var i = 1; i <= nOfLinks; i++) {
document.getElementById("links").innerHTML += "<a href=\"link.com/" + i + "\" target=\"_blank\">Part " + i + "</><br/>"
}
<div id="links">
</div>

If you can use Emmet in the code editor you're using you can do it with something like this:
a[href="link.com/$" target="_blank"]{Part $}*106
With Emmet you just write this and usually press the tab key to expand the code into the full HTML.
That will output the links correctly.

Related

Can I attach an HTML file to a variable in Google Script? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I currently make a variable string for the body of an email using this code.
var body = "Hello " + driverArray[i] + "," + "<br><br>Attached is your pay stub for the week of " + date + " and the subsequent schedule(s).<br><br>" + teamMessage + "<br><br>Thank you, <br>Elizabeth";}
I would like to replace the ending with a signature that I have saved in an HTML file. I am not sure if I can just add an HTML file to the end of this string though. How would I go about attaching the whole signature to the end of this string?
If it helps I use that variable string later like so
if(htmlbody){
mailOptions.htmlBody = htmlbody;
}
if(email){
GmailApp.createDraft(email, subject,"",mailOptions);
where htmlbody is just that variable. Could I attach the HTML file here?
Yes, you need to get the HTML file as string content.
var myHtmlFileString = HtmlService.createHtmlOutputFromFile(filename).getContent();

Regular expression to replace same patterns with another string [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have a string below that I want to replace all /data/.*/www with /www.
StackTrace::getCurrent() at
/data/users/eaminz/www/flib/intern/scripts/insights/msis/workflows/messaging/MSISWorkFlowLoggerSingleton.php:102#r0\nMSISWorkFlowLoggerSingleton::errorWrongConfig()
at
/data/users/eaminz/www/flib/intern/insights/simplification/ads/codegen/api/business_insights/BusinessInsightsAPIMetricCodegen.php:89#r0\nBusinessInsightsAPIMetricCodegen::generateStorageCode()
at
/data/users/eaminz/www/flib/intern/insights/simplification/ads/codegen/api/business_insights/BusinessInsightsAPIMetricCodegen.php:40#r0\nBusinessInsightsAPIMetricCodegen::generateCode()
at
/data/users/eaminz/www/flib/intern/scripts/insights/msis/codegen/InsightsAPIMetricSimplificationScriptController.php:380#r0\nInsightsAPIMetricSimplificationScriptController->generateProductSpecificStorageCode()
at
/data/users/eaminz/www/flib/intern/scripts/insights/msis/codegen/InsightsAPIMetricSimplificationScriptController.php:285#r0\nInsightsAPIMetricSimplificationScriptController->genMetricCode()
at
/data/users/eaminz/www/flib/intern/scripts/insights/msis/codegen/InsightsAPIMetricSimplificationScriptController.php:200#r0\nInsightsAPIMetricSimplificationScriptController->genRunImpl()
at
/data/users/eaminz/www/flib/intern/scripts/insights/msis/codegen/InsightsAPIMetricSimplificationScriptController.php:113#r0\nInsightsAPIMetricSimplificationScriptController->genRun()
at
/data/users/eaminz/www/flib/intern/scripts/controller/ScriptController.php:189#r0\nScriptController->__genRunWithCommandLineArgs()
at
/data/users/eaminz/www/flib/intern/scripts/controller/ScriptController.php:111#r0\nScriptController::__genDispatch()
at
/data/users/eaminz/www/scripts/bin/phps_init.php:23#r0\nphps_init_entrypoint()
at :0#r0\nClosure$__SystemLib\enter_async_entry_point() at
:0#r0\nHH\Asio\join() at :0#r0\n__SystemLib\enter_async_entry_point()
at :0#r0
So it should become something like the following:
StackTrace::getCurrent() at
/www/flib/intern/scripts/insights/msis/workflows/messaging/MSISWorkFlowLoggerSingleton.php:102#r0\nMSISWorkFlowLoggerSingleton::errorWrongConfig()
at
/www/flib/intern/insights/simplification/ads/codegen/api/business_insights/BusinessInsightsAPIMetricCodegen.php:89#r0\nBusinessInsightsAPIMetricCodegen::generateStorageCode()
at
I tried /data/.*[^/]www/ to find all the patterns but no use. Could someone please help? Thank you!
Try this:
\/data\/.*?\/www
Demo

how to get first JSONs elements using python [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
The public API respond me with JSON which has the next format
{"ABCD-EFG":
{"param1":"0.1234",
"param2":"0.123456",
"param3":"0.12334254"},
"HIG-KLMN":
{"param1":"0.3456",
"param2":"0.05710"
"param3":"0.004903"
... }
How can i get the List of the names (in this examle ABCD-EFG, HIG-KLMN) using Python3 ?
They can make changes in it every API get request sending
If it was like 'name' : 'ABCD-EFG', it would be easy. But it's not like that.
There are a few ways, here's one:
x = {
"ABCD-EFG": {
"param1":"0.1234",
"param2":"0.123456",
"param3":"0.12334254"
},
"HIG-KLMN": {
"param1":"0.3456",
"param2":"0.05710",
"param3":"0.004903"
}
}
y = list(x.keys())
print(y)
for key in x.keys():
print(key)
gives:
['ABCD-EFG', 'HIG-KLMN']
ABCD-EFG
HIG-KLMN

How to insert <p> tag in textfield when user hits "Enter" or "Return"? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
In my app, a user can fill out certain information about him on his profile. For example I have an about section, where the user can write a paragraph about his life. Right now, if the user types anything and saves the input, it is shown as one paragraph. I want it so that if the user hits enter, it should add a <p> tag when it is displaying the content.
Update
Just look at this question for example. When I type a question and hit enter
this text appeared on a new line
this is what I want!
You dont have to handle enter key.
Lets assume you are getting textarea value as a string str.
when you display it, just wrap every line with <p>
//`str` is textarea value
var str = document.getElementById("myTextarea").value;
var lines = str.split(/\r?\n/);
// create html
var html="";
for(var i=0;i<lines.length;i++){
html+='<p>'+lines[i]+'</p>';
}
// use html here showing inside some div
var divEl = document.getElementById("myDiv");
divEL.innerHTML = html;
I don't know what you are exactly asking for, but you can intercept the Enter key on inputs by doing such (with jquery).
$(".yourinputid").keyup(function (e) {
if (e.keyCode == 13) {
// Manipulate the DOM
}
});
I'm a bit confused about the <p> tag part. What do you want exactly to do?
Use nl2br() on POST value server-side (if on PHP; equivalents in other languages should be avaliable) or String.replace() on the textarea value client-side.

What are some useful or interesting infinite generators? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What are some clever uses for infinite generators? I've seen lots of seemingly trivial examples like "list all even numbers", but I assume there must be others that have more applicability to real-world scenarios. Concrete examples (in any language that support generators) appreciated!
I'll give a trivial sample as an answer.
Look at the Haskell code on http://rosettacode.org/wiki/Hamming_numbers#Haskell; that uses lazy lists (which are somewhat like generators) in a creative way to list all Hamming numbers.
A random generator might be considered clever use.
Trivial example: yield Fibonacci numbers one at a time (sans overflow checking, in C#):
public static IEnumerable<double> Fibonacci()
{
double n_minus2 = 1;
double n_minus1 = 1;
yield return n_minus2;
yield return n_minus1;
while(true)
{
double n = n_minus2 + n_minus1;
yield return n;
n_minus2 = n_minus1;
n_minus1 = n;
}
}