I need help about Title in sweetalert - sweetalert2

I have an error (or nothing shows) on put a Text with quotes when I refer to inches ( " or ´´)
swal({
text: ' Product X 10" '
})
or
swal({
text: ' Product X 10' '
})
What might be the cause of this?

Related

cypress use value outside .then() block

i have a case where i enter a searchTerm to a search field. Then I want to count the results shown to randomly select one of the entries. But I cannot realize it with cypress
let countOfElements = "";
cy.get(this.SEARCH_RESULT + ' > a').then($elements => {
countOfElements = $elements.length;
cy.log(countOfElements)
cy.log("Found " + countOfElements + " results for search term + " + searchTerm)
});
cy.get(this.SEARCH_RESULT + ' > a').invoke('val').as('searchEntries')
//This is obviosly not working, but I don't get how to fix this.
let randomNumber = this.getRandomNumberBetweenTwoValues(0, cy.get('#searchEntries')));
cy.get(this.SEARCH_RESULT + ' > a').eq(randomNumber).click()
I tried different things, like storing the value with .as() but I never seem to have access to the value outside a .then() block. So how I can use the value in my "getRandomNumber..." function to decide with entry in the result list shall be selected?
Pls help. thx
let countOfElements = "";
cy.get(this.SEARCH_RESULT + ' > a').then($elements => {
countOfElements = $elements.length;
cy.log(countOfElements)
cy.log("Found " + countOfElements + " results for search term + " + searchTerm)
});
cy.get(this.SEARCH_RESULT + ' > a').invoke('val').as('searchEntries')
//This is obviosly not working, but I don't get how to fix this.
let randomNumber = getRandomNumberBetweenTwoValues(0, this.searchEntries);
cy.get(this.SEARCH_RESULT + ' > a').eq(randomNumber).click()
Something like this could work. If this.searchEntries give undefined error then make the block function(){} instead of ()=>{}

each_with_index duplicated records

first of all, excuse me if my english is not always very good.
I have a problem with the each_with_index... When I show a project, I display the offers for this project. I have to make appear a banner in third position of offers, so I use each_with_index for that.
The problem is that: if I have sixteen offers on a project, I have sixteen times the entirely list of offers, and I don't know why.
This is my code:
- #offers.each_with_index do |offer, index|
- if !user_signed_in? && (#project.published? || #project.pending_attribution?)
- if #offers.size >= 3 && index == 3
= render 'offer_cta'
- contact_bloc = user_contact_bloc(offer.user, viewer: current_user, display_contact_info: offer.display_contact_info?)
.card.offer-card.mt-4[offer]{ class: offer_class(offer) }
.card-header.d-flex.justify-content-between.align-items-center.border-bottom-0
.offer-date
%span.text-muted
Offer filed on
= l(offer.created_at, format: '%d/%m/%Y à %Hh%M')
- if user_signed_in? && current_user.admin? && !offer.user.suspended_at.nil?
... exctera
Also, if I try this in my console, I don't have any problem...
Have you ever had this problem?
Don't hesitate to ask me if you need more information.
EDIT :
This is the code in my render 'offer_cta', a very basic code:
.row
.col-md-12
.project-cta.p-5.mb-2.text-center
%h5
%strong
blabla
%p.text-muted blablabla
%p.m-0
= link_to "Send a quote", "", class: "btn btn-primary px-3", data: { toggle: 'modal', target: '#modal-sign' }, onclick: "ga('send', 'event', 'button', 'Clic', 'Sign up');", tabindex: -1
#offers initialization:
#offers = #project.offers_accessible_by(current_ability, current_user)
#offers.mark_as_read_for(current_user)
#offers = #offers.includes(:offer_interactions, user: [:user_profile, :user_subscription, :user_contact])

How to remove defalult text when using RAF eg(Ad 1 of 1)

I am working on RAF(Roku Advertising Framework) using bright script.
On above image we seeing (Ad 1 of 1) when playing ads.
Please give me suggestions to solve this issue, Any help much appreciated.
In the current version of RAF (1.9.6) there is no way of doing this.
Nas is correct to a certain limit. The Roku checklist will want to have the "Feedback UI" enabled if you're watching ads (this is the "Ad 1 of 1")
Now, it is possible to create your own roVideoPlayer to play the ads. It requires more work to do...
'handle this else where (like the construct):
function main
'm._raf = Roku_Ads()
'm._raf.setDebugOutput(true)
'm._raf.setAdPrefs(false, 2)
'm._raf.setAdUrl(url)
'playAds()
end function
function playAds()
' sleep for half a second
sleep(500)
' setup some variables we'll be using
canvas = createObject("roImageCanvas")
' get the ads from the url
adPods = m._raf.getAds()
if adPods <> invalid and adPods.Count() > 0 then
' quick display for us to know how many ads we're playing
print "playing " adPods.Count() " ads"
' loop through each ad pod
for each adPod in adPods
' handle any top level logic here
' loop through each ad within the adPod now
for each ad in adPod.ads
' default ad rendering by raf: m._raf.showAds(adPods)
' start playing the ad
adVideoPlayer = playVideoContent(ad.streams)
playingAd = true
' custom event loop for the ad video player
while playingAd
videoMsg = wait(500, adVideoPlayer.getMessagePort())
if type(videoMsg) = "roVideoPlayerEvent" then
if videoMsg.isStreamStarted() then
canvas.clearLayer(2) ' clear buffering layer
canvas.setLayer(1, [{ color: "#00000000", CompositionMode: "Source" }])
canvas.show()
else if videoMsg.isPlaybackPosition() then
' loop through all trackers to see if we need to trigger any of them
for each tracker in ad.tracking
' make sure its not triggered first and that the tracker has a "time" property
if not tracker.triggered and tracker.time <> invalid then
print "* ad position: " videoMsg.getIndex() " / " adVideoPlayer.getPlaybackDuration()
if (int(videoMsg.getIndex()) + 1) >= int(tracker.time) then
print "triggering ad event " tracker.event ", triggered at position " tracker.time
m._raf.fireTrackingEvents(ad, {type: tracker.event})
tracker.triggered = true
end if
end if
end for
end if
if videoMsg.isStatusMessage() then
status = videoMsg.getMessage()
if status = "startup progress" then
' handle loading bar or anything else here
else if status = "start of play" then
' we should be playing the video, nuke the buffering layer and set layer 1 to a black background
canvas.clearLayer(2) ' clear buffering layer
canvas.setLayer(1, [{ color: "#00000000", CompositionMode: "Source" }])
canvas.show()
else
print "ad status: " status
end if
' roVideoPlayer sends "end of stream" last for all exit conditions
if status = "playback stopped" or status = "end of playlist" or status = "end of stream" then
print "done playing ads"
playingAd = false
end if ' end status check
end if ' end isStatusMessage
end if ' end type(videoMsg)
end while
if type(adVideoPlayer) = "roVideoPlayer" then
print "stop the ad video player"
adVideoPlayer.stop()
end if
end for
end for
else
print "no ads to play"
end if
end function

how to display text in ckeditor status bar?

I just want to know how to display text in the ckeditor status bar.
At the bottom of the ckeditor displays the elements path I just want to display text in that elements path like status bar.
Foe example, when the user finds and replaces a text in the editor, I want to display to the user the number of instances replaced in the text.
Any help is useful, thanks in advance.
You can disable the elementspath plugin:
config.removePlugins = 'elementspath';
Then make a custom plugin by copying _source/plugins/elementspath to plugins/elementspath.
Then rename the directory to your custom name and change line 33 of the plugin.js file to use the new name (the CkEditor styleguide calls for all lowercase letters for plugin names):
CKEDITOR.plugins.add( 'newname',
Then add the new plugin in your config:
config.extraPlugins = 'newname';
The editor.on( 'selectionChange', function( ev ) section is where the majority of the work is done to create the content for that line. The main section is this:
html.unshift(
'<a' +
' id="', idBase, index, '"' +
' href="javascript:void(\'', name, '\')"' +
' tabindex="-1"' +
' title="', label, '"' +
( ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ?
' onfocus="event.preventBubble();"' : '' ) +
' hidefocus="true" ' +
' onkeydown="return CKEDITOR.tools.callFunction(', onKeyDownHandler, ',', index, ', event );"' +
extra ,
' onclick="CKEDITOR.tools.callFunction('+ onClickHanlder, ',', index, '); return false;"',
' role="button" aria-labelledby="' + idBase + index + '_label">',
name,
'<span id="', idBase, index, '_label" class="cke_label">eee' + label + '</span>',
'rrrr</a>' );
You can modify it to display whatever content you like.
You'll need to look through the rest of the code to understand everything that's happening and make any other changes needed for your specific goals.

Error getting too many character literals

var query = from s in bv.baParticularHeaders
from v in bv.baPlanColumnStructures
where x.Contains(s.Particular_Num)
select new LevelList
{
Value = 'Level ' + LTRIM(Rtrim(Convert(Char,P.Level_Num))) + ' - ',
id = 'Column ' + LTRIM(Rtrim(Convert(Char,P.Column_Num))) + ' ',
Text = v.Column_Description
};
return query.Distinct().OrderBy(o => o.Value).AsQueryable<LevelList>();
Error getting this both lines of code.
Value = 'Level ' + LTRIM(Rtrim(Convert(Char,P.Level_Num))) + ' - ',
id = 'Column ' + LTRIM(Rtrim(Convert(Char,P.Column_Num))) + ' ',
Can any body help me out how to convert this in LINQ?
Thanks
You can't just cut and paste SQL, rearrange it and hope to get a valid LINQ query. The aim is to write the appropriate C# code, which is translated into SQL. In this case I suspect you want:
var query = from s in bv.baParticularHeaders
from v in bv.baPlanColumnStructures
where x.Contains(s.Particular_Num)
select new LevelList
{
Value = "Level " + P.Level_Num + " - ";
id = "Column " + p.Column_Num + " ",
Text = v.Column_Description
};
return query.Distinct().OrderBy(o => o.Value).AsQueryable();
Note the string literals - "Level " not 'Level '. The code has to be valid C# first.
(Assuming Level_Num and Column_Num are numbers, I can't see why it would make sense to trim them.)

Resources