|
Hi all. I cam having trouble finding any info on the google workbox project and the specific issue I am having with trying to publish updates.
I started on WorkBox 4 and have recently upgraded to the release candidate of version 5 to see if that helps and it did not.
My route is setup as
workbox.routing.registerRoute(
/.*/,
new workbox.strategies.StaleWhileRevalidate({
plugins: [
new workbox.broadcastUpdate.BroadcastUpdatePlugin({
channelName: 'app-update-reload'
})
]
})
);
and, my index.html is supposed to catch the broadcasts using the following code but it never gets called by workbox:
<script>
const updateChannel = new BroadcastChannel('app-update-reload');
updateChannel.addEventListener('message', async (event) => {
console.log(">>>>>>>>>>>>>>>>>> A new update is available!!!!!!!!!!");
});
</script>
So, my problem is that the message event in my index.html never gets called by workbox when there is an update. I can see that the files are being updated when the manifest changes in the browser but the broadcast never happens.
I can manually broadcast from the service worker to test that the index.html is catching the event and it works. however, no matter what I've tried I can't get the StaleWhileRevalidate strategy to broadcast the update and I am pulling my hair out.
I verified that the caching strategy is indeed working and I can't figure out why it won't broadcast.
Any help would be GREATLY appreciated. Thanks!
|
|
|
|
|
Hello!
I´m creating a WP site. In the homepage, i´m getting an error:
Quote: Warning: Invalid argument supplied for foreach() in /home2/siilverp/public_html/wp-content/themes/mts_steadyincome/page-home.php on line 108
This is the code of page-home.php:
<?php if(!empty($mts_options['mts_featured_posts']) && !empty($mts_options['mts_featured_post_cat'])) { ?>
<div class="home_article">
<?php
foreach ( $mts_options['mts_featured_post_cat'] as $cat_id ) {
$featured_query = new WP_Query( apply_filters( 'steadyincome_featured_posts_query', array(
'cat' => $cat_id,
'posts_per_page' => 1
) ) );
Now, I found that I have to type var_dump. Then, this appears:
Quote: array(84) { ["mts_logo"]=> string(0) "" ["mts_favicon"]=> string(0) "" ["mts_touch_icon"]=> string(0) "" ["mts_metro_icon"]=> string(0) "" ["mts_twitter_username"]=> string(0) "" ["mts_feedburner"]=> string(0) "" ["mts_header_code"]=> string(0) "" ["mts_analytics_code"]=> string(0) "" ["mts_ajax_search"]=> string(1) "0" ["mts_responsive"]=> string(1) "1" ["mts_rtl"]=> string(1) "0" ["mts_shop_products"]=> string(1) "9" ["mts_prefetching"]=> string(1) "0" ["mts_lazy_load"]=> string(1) "0" ["mts_lazy_load_thumbs"]=> string(1) "0" ["mts_lazy_load_content"]=> string(1) "0" ["mts_async_js"]=> string(1) "1" ["mts_remove_ver_params"]=> string(1) "1" ["mts_optimize_wc"]=> string(1) "1" ["mts_color_scheme"]=> string(7) "#3fc5a4" ["mts_layout"]=> string(8) "cslayout" ["mts_background"]=> array(10) { ["color"]=> string(7) "#ffffff" ["use"]=> string(7) "pattern" ["image_pattern"]=> string(4) "nobg" ["image_upload"]=> string(0) "" ["repeat"]=> string(6) "repeat" ["attachment"]=> string(6) "scroll" ["position"]=> string(8) "left top" ["size"]=> string(5) "cover" ["gradient"]=> array(3) { ["from"]=> string(7) "#ffffff" ["to"]=> string(7) "#000000" ["direction"]=> string(10) "horizontal" } ["parallax"]=> string(1) "0" } ["mts_custom_css"]=> string(0) "" ["mts_lightbox"]=> string(1) "0" ["mts_sticky_nav"]=> string(1) "0" ["mts_show_primary_nav"]=> string(1) "1" ["mts_show_footer_nav"]=> string(1) "1" ["mts_header_section2"]=> string(1) "1" ["mts_header_bottom_text"]=> string(17) "Download my Ebook" ["mts_header_bottom_button_text"]=> string(20) "Start Earning Today!" ["mts_header_bottom_button_link"]=> string(1) "#" ["mts_banner_show"]=> string(1) "1" ["mts_banner_image"]=> string(81) "https://seiscifrasonline.com/wp-content/themes/mts_steadyincome/images/header.jpg" ["mts_banner_title"]=> string(34) "Start Earning Steady Income Today!" ["mts_banner_texts"]=> string(156) "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi at nisl lorem, vel porttitor justo. Nunc non mauris elit. Nam enim massa commodo ut placerat." ["mts_button_text"]=> string(16) "Get Started Here" ["mts_banner_button_bg"]=> string(7) "#FF9742" ["mts_arrow_image"]=> string(80) "https://seiscifrasonline.com/wp-content/themes/mts_steadyincome/images/arrow.png" ["mts_form_image"]=> string(80) "https://seiscifrasonline.com/wp-content/themes/mts_steadyincome/images/money.png" ["mts_ribbon_show"]=> string(1) "1" ["mts_banner2_show"]=> string(1) "1" ["mts_social_title"]=> string(66) "Join Over 100,000 People in Our Online Community!" ["mts_banner_social"]=> array(5) { ["facebook"]=> array(5) { ["group_title"]=> string(8) "Facebook" ["group_sort"]=> string(1) "1" ["mts_banner_icon_title"]=> string(8) "Facebook" ["mts_banner_icon"]=> string(8) "facebook" ["mts_banner_icon_link"]=> string(1) "#" } ["twitter"]=> array(5) { ["group_title"]=> string(7) "Twitter" ["group_sort"]=> string(1) "2" ["mts_banner_icon_title"]=> string(7) "Twitter" ["mts_banner_icon"]=> string(7) "twitter" ["mts_banner_icon_link"]=> string(1) "#" } ["gplus"]=> array(5) { ["group_title"]=> string(11) "Google Plus" ["group_sort"]=> string(1) "3" ["mts_banner_icon_title"]=> string(11) "Google Plus" ["mts_banner_icon"]=> string(11) "google-plus" ["mts_banner_icon_link"]=> string(1) "#" } ["youtube"]=> array(5) { ["group_title"]=> string(7) "YouTube" ["group_sort"]=> string(1) "4" ["mts_banner_icon_title"]=> string(7) "YouTube" ["mts_banner_icon"]=> string(12) "youtube-play" ["mts_banner_icon_link"]=> string(1) "#" } ["rss"]=> array(5) { ["group_title"]=> string(3) "RSS" ["group_sort"]=> string(1) "5" ["mts_banner_icon_title"]=> string(3) "RSS" ["mts_banner_icon"]=> string(3) "rss" ["mts_banner_icon_link"]=> string(1) "#" } } ["mts_books_title"]=> string(51) "Recommended readings by John Smith" ["mts_books_image"]=> string(0) "" ["mts_more_book_link"]=> string(1) "#" ["mts_more_book_text"]=> string(10) "More Books" ["mts_featured_posts"]=> string(1) "1" ["mts_featured_post_cat"]=> string(1) "1" ["mts_featured_post_dedup"]=> string(1) "0" ["mts_first_footer"]=> string(1) "0" ["mts_first_footer_num"]=> string(1) "4" ["mts_footer_slider"]=> string(0) "" ["mts_copyrights"]=> string(73) "Theme by MyThemeShop" ["mts_home_post_layout"]=> string(8) "layout-1" ["mts_full_posts"]=> string(1) "0" ["mts_pagenavigation_type"]=> string(1) "1" ["mts_home_headline_meta_info"]=> array(2) { ["enabled"]=> array(3) { ["author"]=> string(11) "Author Name" ["date"]=> string(4) "Date" ["comment"]=> string(13) "Comment Count" } ["disabled"]=> array(0) { } } ["mts_single_post_layout"]=> string(0) "" ["mts_single_headline_meta_info"]=> array(2) { ["enabled"]=> array(4) { ["author"]=> string(11) "Author Name" ["date"]=> string(4) "Date" ["category"]=> string(10) "Categories" ["comment"]=> string(13) "Comment Count" } ["disabled"]=> array(0) { } } ["mts_breadcrumb"]=> string(1) "1" ["mts_author_comment"]=> string(1) "1" ["mts_comment_date"]=> string(1) "1" ["mts_home_social_buttons"]=> string(1) "1" ["mts_social_button_position"]=> string(3) "top" ["mts_social_buttons"]=> array(2) { ["enabled"]=> array(5) { ["facebookshare"]=> string(14) "Facebook Share" ["facebook"]=> string(13) "Facebook Like" ["twitter"]=> string(7) "Twitter" ["gplus"]=> string(11) "Google Plus" ["pinterest"]=> string(9) "Pinterest" } ["disabled"]=> array(2) { ["linkedin"]=> string(8) "LinkedIn" ["stumble"]=> string(11) "StumbleUpon" } } ["mts_posttop_adcode"]=> string(0) "" ["mts_posttop_adcode_time"]=> string(1) "0" ["mts_postend_adcode"]=> string(0) "" ["mts_postend_adcode_time"]=> string(1) "0" ["mts_custom_sidebars"]=> string(0) "" ["mts_sidebar_for_home"]=> string(0) "" ["mts_sidebar_for_post"]=> string(0) "" ["mts_sidebar_for_page"]=> string(0) "" ["mts_sidebar_for_archive"]=> string(0) "" ["mts_sidebar_for_category"]=> string(0) "" ["mts_sidebar_for_tag"]=> string(0) "" ["mts_sidebar_for_date"]=> string(0) "" ["mts_sidebar_for_author"]=> string(0) "" ["mts_sidebar_for_search"]=> string(0) "" ["mts_sidebar_for_notfound"]=> string(0) "" ["mts_sidebar_for_shop"]=> string(12) "shop-sidebar" ["mts_sidebar_for_product"]=> string(15) "product-sidebar" ["last_tab"]=> int(0) } Warning: Invalid argument supplied for foreach() in /home2/siilverp/public_html/wp-content/themes/mts_steadyincome/page-home.php on line 108
And from there, I dont know what to do. Please, note that I dont know anything about programming, and I don't know who to turn to either, so I came to this forum, I hope that you can help me.
Thanks you so much.
|
|
|
|
|
foreach ( $mts_options['mts_featured_post_cat'] as $cat_id ) {
The error message means that the value returned in $mts_options['mts_featured_post_cat'] is not valid for some reason. You need to find out what value(s) is being returned from that reference.
|
|
|
|
|
Member 14647122 wrote: Warning: Invalid argument supplied for foreach() in /home2/siilverp/public_html/wp-content/themes/mts_steadyincome/page-home.php on line 108
Did you alter the code in the code block you posted?
I checked the array and it contains the records being checked first. Not sure which is line 108 however.
["mts_featured_posts"]=> string(1) "1"
["mts_featured_post_cat"]=> string(1) "1"
I'm not a WordPress guy and haven't written a line of PHP in 4 years, but I suspect you altered the code to make it do something else and need to restore the page code from the original. Or the data in the array is corrupt or your missing something in the original setup of the pages.
WordPress was designed for non programmers to be able to setup a fast website blog. There is no need to edit code, except for the initial setup of passwords and crypt pass phrases. You just run the program and use the system to enter your blogs.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
i want to develop final project allocation and management system for computing college of my university and how can i avoid plagiarism of my project based on project documentation or project title
|
|
|
|
|
You can avoid plagiarism by submitting only your own original work, and not copying from other people. However this has nothing to do with software development.
|
|
|
|
|
So initially when I call my view it pulls the files from the database which users have uploaded and it allows users to delete those files if they don't need them anymore , this is done by when they click on the specific Actionlink, it calls a jquery function which calls my ajax which calls my Remove() Function in my controller , when the files are deleted I append the new list back to the customer.
My Issue: When the new list is appended back, the jquery function is no longer called and it goes directly to the method in my controller. I checked my html anchor-tag in my developer tools of both the appended files and the originally uploaded files and they are identical , I am not sure what is causing this issue, and help will be greatly appreciated.
Here is the anchor tags that work initially when the page is loaded:
<div class="portlet-body form " id="attachments">
@if (ViewBag.file != null)
{
foreach (var x in ViewBag.file)
{
if (string.IsNullOrWhiteSpace(x.FileName))
{
continue;
}
@Html.ActionLink(" ", "Remove", "Chargeback", new { name = (string)x.FileName, filePath = (string)x.FilePath }, new { @class = "fas fa-trash-alt", @id = "uploadsGif" })
@Html.ActionLink((string)x.FileName, "DownloadFile", "Chargeback", new { name = (string)x.FileName, id = "uploads" }, null)
DateTime.Now.ToString("MM/dd/yyyy");
}
}
</div>
Here is my jquery function which is appending my achor-tag/ActionLink:
$("#uploadsGif").click(function () {
debugger;
...
debugger;
$.ajax({
type: 'POST',
url: "/Chargeback/Remove",
dataType: 'json',
data: {
name: name,
filePath: filePath
},
success: function (data) {
debugger;
$("#lblresponce").append("File has been successfully removed");
setTimeout(function () {
$("#lblresponce").empty();
}, 5000)
debugger;
$("#attachments").empty();
$.each(data, function (i, item) {
$("#attachments").append('<a class="fas fa-trash-alt" href=/Chargeback/Remove?name=' + data[0].FileName + ';filePath=' + data[0].FilePath + 'id="uploadsGif"'+'>' + '</a>'); --> ISSUE $("#attachments").append('<a href=/Chargeback/DownloadFile/uploads?name=' + data[0].FileName +'>' + data[0].FileName + '</a>');
});
},
error: function (data) {
}
});
debugger;
return false;
})
|
|
|
|
|
|
Thank you so much, I originally doing it this way ("#uploadsGif").on("click",function(){
})
.
|
|
|
|
|
When appending elements dynamically you have to attach the event to a static parent element, and supply a filter which you wish to delegate events to, like this:
This was my solution:
$("#mainDiv").on('click', '.interested', function(){
alert("working");
});
|
|
|
|
|
how to create the login page using php and html code and how i get the information?
|
|
|
|
|
Google for "login php" and you will find many examples.
|
|
|
|
|
I have an ActionLink:
@Html.ActionLink(" ", "Remove", "Chargeback", new { name = (string)x.FileName, filePath = (string)x.FilePath}, new { @class = "fas fa-trash-alt" , @id = "uploadsGif" })
is there a way to grab the name and filepath with jquery?
|
|
|
|
|
Yes, look at the actual hmtl generated and you can find how to parse it with jquery.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Im kind of new to Jquery, here is the code genereted:
Are you able to provide how I would actually do that?
<a class="fas fa-trash-alt" href="/Chargeback/Remove?name=Working.xlsx&filePath=C%3A%5CCbUploads%5C7.xlsx" id="uploadsGif"> </a><a href="/Chargeback/DownloadFile/uploads?name=Working.xlsx">Working.xlsx</a> <br />
|
|
|
|
|
If you're using a modern browser - basically, anything except Internet Explorer - you can use the built-in URLSearchParams[^] class.
let link = document.getElementById("uploadsGif");
let query = link.href.substr(link.href.indexOf("?"));
let qs = new URLSearchParams(query);
let name = qs.get("name");
let filePath = qs.get("filePath"); If you need to support Internet Explorer, you could use a library like URI.js[^]. Or, you could use a simple function to extract the variable - for example: Get Query String Parameters with JavaScript[^]
function getUrlParameter(search, name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
...
var link = document.getElementById("uploadsGif");
var query = link.href.substr(link.href.indexOf("?"));
var name = getUrlParameter(query, "name");
var filePath = getUrlParameter(query, "filePath");
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you , you are a life saver.
|
|
|
|
|
I have both a standard ASP.Net Web PI running, as well as a SignalR API, running in IIS.
- For the web API, I have been making a call to the API's Test Controller's Test Method. If it succeeds, then I assume it's working, if not, then I assume the site isn't running.
- For the SignalR API, I call a method called 'Connect()' via the hub and wait for ConnectionStateChanged to indicated Connection State = Connected. Problem is, this response may never come.
So, what's the right way to test if both of these APIs are running?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Hi to all,
I am having live web application, which some times log out due to post back in firefox only.
At that time Session become null and Log Out.
In Other browsers working fine. I am using Firefox 69.0.2 (Latest) version.
Log Out happnes into Live Clients or in Production server only. In web developement working fine.
I am having Old Web Application around 12 years old web site (Product) and successfully using 150+ clients.
Some clients facing this issue. I have checked at my end. Issue still persist in some pages of web site.
Any one faced same issue?
Is there any thing that i can check that issue in otherway ?
Thank You
|
|
|
|
|
Siddharth Chudasama wrote: which some times log out due to post back What does that mean? How does a postback cause a session timeout?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Currently I want to grab the name of my uploaded file in Ajax and pass it to my APIController and pass it to my parameter.
1.Here is my controller :
public class ApiSampleUploadController : ApiController
{
[HttpPost]
public string Test(HttpPostedFileBase file )
{
return "Success";
}
}
2.Here is my view:
@using (Html.BeginForm("Submit"))
{
<div>
<input type="file" name="file" id="uploadFile" />
</div>
}
3.Here is my ajax
$('#uploadFile').on("change", function () {
var formdata = new FormData($('form').get(0));
CallUpload(formdata);
});
function CallUpload(file) {
console.log(file);
$.ajax({
url: '/api/ApiSampleUpload/Test',
type: 'POST',
data: 'file=' + file ,
cache: false,
processData: false,
contentType: 'application/json',
success: function () {
alert('Success');
},
error: function () {
alert('Error occured');
}
});
}
|
|
|
|
|
Two problems:
1) You're missing the enctype on the form:
@using (Html.BeginForm("Test", "ApiSampleUpload", FormMethod.Post, new { enctype = "multipart/form-data" }))
2) You're converting the FormData to a string, so you're submitted data will be file=[object FormData] .
You need to pass the FormData directly to the data parameter instead.
You're also specifying the wrong content type for the upload.
function CallUpload(file) {
console.log(file);
$.ajax({
url: '/api/ApiSampleUpload/Test',
type: 'POST',
data: file,
cache: false,
processData: false,
contentType: false,
success: function () {
alert('Success');
},
error: function () {
alert('Error occured');
}
});
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
1.So should data be like : data: 'file=' + new FormData($('form').get(0))
2.When setting contentType:false I get a 415 (Unsupported Media Type)
|
|
|
|
|
KGr28 wrote: 1.So should data be like : data: 'file=' + new FormData($('form').get(0))
No, it needs to be the FormData object, not a string representation of it:
data: new FormData($('form').get(0)) But in the code you posted, you've already created that FormData object and passed it in as a parameter, so you should just re-use that:
data: file
KGr28 wrote: 2.When setting contentType:false I get a 415 (Unsupported Media Type)
Try explicitly setting it to multipart/form-data then:
contentType: 'multipart/form-data',
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
still get the same error.
|
|
|
|
|