Html data attribute array of hash format [closed] - html

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 months ago.
Improve this question
Which format do you recommand for passing an array of hash in a Html data attribute.
For instance:
<button data-products="[{
id='1',
name='A Product Name',
value='1000',
},{
id='2',
name='A Second Product Name',
value='2000',
}]">
I don't find any convention for that.

JSON format, example with ruby and html languages:
<% result = {a: 'a', b: 'b'} %>
<button data-example="<%= result.to_json %>">Lorem</button>
Inside your javascript, use JSON.parse().

Related

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

I want to link each page by a different game_review_id by querystring but it gives me the in any link [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 7 years ago.
Improve this question
This is in the source:
html.Append("<a href = 'http://localhost:50303/WebSite1/previewgamereview.aspx?id=game_review_id'>");
In the second file I wrote:
string id = Request.QueryString["id"];
html.Append("<a href = 'http://localhost:50303/WebSite1/previewgamereview.aspx?id=" + game_review_id + "'>");
In the second file:
if (Request.QueryString["id"] != null)
string id = Request.QueryString["id"].ToString();

mysql : find upper case Alphabets in like clause [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 8 years ago.
Improve this question
Need suggestion regarding finding all testimonial List contains link like http://www.example.com/UPPER CASE Letter
select * from testimonial3 where detail_text like '%http://www.example.com/Hind-global'
select * from testimonial3 where detail_text like '%http://www.example.com/Apple'
SELECT * FROM testimonial3 WHERE detail_text REGEXP BINARY 'http://www.example.com/[A-Z]{1}';

How to Show input type(hidden) in a form [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 9 years ago.
Improve this question
In a form with 3 buttons(view,copy and edit) and other kinds of information already visibled I want to show an input text when I press the edit button. How to do it?
Try this:
<button onClick="document.getElementById('field1').type = 'text'">Edit</button>
<input type="hidden" id="field1">
Fiddle