.htaccess URL rewriting - pages are opening with URL and without URL rewriting even if URL rewriting rules are present i
Date : March 29 2020, 07:55 AM
it helps some times If search engines indexed your site with the old URLs and you have since changed them to keyword rich URLs, then the correct way to let them know to use the new ones is to 301 redirect requests for the old URLs to the new ones. Edit your current .htaccess file and place the section to redirect the old URLs to the new ones just after the showing item rule, as below. ## For showig item
RewriteRule ^(.*)/(.*)/(.*).html$ show.php?cat=$1&sub_cat=$2&img=$3&rewrite=true [L]
## this section should be inserted just after the showing item rule above
#if the query string has cat, sub_cat and Img
RewriteCond %{QUERY_STRING} ^cat=(.+)&sub_cat=(.+)&img=(.+)$ [NC]
#and it is for resource show.php, then 301 redirect to Keyword rich URL
RewriteRule ^show\.php$ http://www.mysite.net/%1/%2/%3.html? [NC,L,R=301]
|
Rewriting .each() loop as for loop to optimize, how to replicate $(this).attr()
Date : March 29 2020, 07:55 AM
I wish this helpful for you You need existing.eq() to get jQuery object, existing[] gives you DOM object. The function attr() should be called with jQuery object but not with DOM (javascript) object. var existing = $('#existing');
for(var i = 0;i < existing.length;i++)
{
console.log(existing.eq(i).attr('id'));
}
existing.each(function(index, item){
alert(index);
alert(item);
});
|
Rewriting this loop
Date : March 29 2020, 07:55 AM
it helps some times Assuming there's a member variable my_qualityPoints, and I also assume my_credits is as well. Not sure why you were doing a loop there; you are on the right track with the my_credits increment. void student::completedCourse(double credits, double numericGrade)
{
my_credits += credits;
my_qualityPoints += credits * numericGrade;
}
|
JavaScript Loop(Make sure my loop isn't rewriting)
Date : March 29 2020, 07:55 AM
may help you . I believe your issue is you are resetting the innerHTML in the function call. I assume this function is called every time files are uploaded? function handleFileSelect(e) {
if (!e.target.files) return;
selDiv.innerHTML = ""; // <--- this will empty the div
var files = e.target.files;
for (var i = 0; i < files.length; i++) {
var f = files[i];
selDiv.innerHTML += f.name + "<br/>";
}
}
|
C - Rewriting a 2 for loop into a 1 for loop for copying arrays.
Tag : c , By : inquiringmind
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I think that you have already done more than the original question asked.
|