Edit 1: I am trying to fetch using this below query but problem is that the end div is not taken the occurrence after the start Point i.e
select ID, post_title, substr(post_content,instr(post_content,'<div style="position:absolute') + 0, instr(post_content,'</div>')) as temp from wp_posts where post_content LIKE '%mySpamFilter Text%' LIMIT 10
One of my Blog has been attacked by spammers, I have around 100+ posts which have the unwanted links or messages which was fused by spammers. I want to know how can I replace the string between two strings.
Start string = '<div style="position:absolute;'
End String = '</div>' (This End div should be the first end div after the above Start string)
I tried all the options which is available on Stack overflow but no luck so far. Please advice whats the best approach to go ahead. below is content of post_content column from one of the post from wp_posts table
You can see after the word Paneer there is a lot of spam between a div class. I want to get rid of this from my database. I don't how I became victim of this attack but for now I just want to delete these.
<p>Hey Foodies,</p>
<p>Biryani, the pride of Hyderabad, is definitely one dish which everyone knows to cook in their very own ways and styles. Biryani is one such thing which totally distinguishes itself with the plain rice we eat daily and the regular pulao. Biryani is the BIRYANI. So, lets look into the detailed procedure of the much loved Hyderabadi delicacy, the vegetarian version. Oh yes, this is the Hyderabadi Dum Veg Biryani!</p>
<p>This recipe would take 380-400 grams of uncooked Basmati rice which would serve 6.</p>
<div class="easyrecipe">
<link itemprop="image" href="http://mywebsite.in/wp-content/uploads/2013/09/Biryani-300x225.jpg">
<div class="item ERName">Hyderabadi Veg Dum Biryani</div>
<div class="ERClear"></div>
<div class="ERHead"><span class="xlate">Recipe Type</span>: <span class="type">Main Course</span></div>
<div class="ERHead">Cuisine: <span class="cuisine">Indian</span></div>
<div class="ERHead">Prep time: <time itemprop="prepTime" datetime="PT30M">30 mins</time></div>
<div class="ERHead">Cook time: <time itemprop="cookTime" datetime="PT1H15M">1 hour 15 mins</time></div>
<div class="ERHead">Total time: <time itemprop="totalTime" datetime="PT1H45M">1 hour 45 mins</time></div>
<div class="ERHead">Serves: <span class="yield">6</span></div>
<div class="ERIngredients">
<div class="ERIngredientsHeader">Ingredients</div>
<ul class="ingredients">
<li class="ingredient">For Vegetables: Carrot - 1 medium</li>
<li class="ingredient">Potatoes - 1 medium</li>
<li class="ingredient">Paneer ***<div style="position:absolute; left:-3905px; top:-3984px;">Gloves fast it natural viagra foods recently! Like as daily cialis the purchase 1 pad generic viagra cheap and matte easy blue pills me many. Content but 10 mg cialis the as the helps Amazon http://www.mordellgardens.com/saha/cheap-viagra-canada.html . And baths etc would. I've brand cialis Appears dollars hands still shop October a smell http://www.hilobereans.com/buy-real-viagra/ in have. Of better cheap generic cialis it smelled to and <a rel="nofollow" href="http://www.goprorestoration.com/best-price-viagra">best price viagra</a> t customer anything been viagra online reviews 5 supply time "here" the product what buy levitra biological by cream!</div>*** - 1/2 cup</li>
<li class="ingredient">Cauliflower - 1/2 cup</li>
<li class="ingredient">Green peas - 1 tbsp.</li>
<li class="ingredient">Yogurt - 1/2 cup</li>
<li class="ingredient">Mint - 1 tbsp.</li>
<li class="ingredient">Coriander - 1 tbsp.</li>
<li class="ingredient">Ginger-Garlic paste - 1 tsp.</li>
<li class="ingredient">Green chili - 4 to 5</li>
<li class="ingredient">Oil - 2 tbsp</li>
<li class="ingredient">Salt - As per taste</li>
<li class="ingredient">Biryani Masala - 1 and 1/2 tbsp.</li>
<li class="ingredient">Red Chili Powder - 1/2 tsp.</li>
<li class="ingredient">Garam Masala Powder - 1/4 tsp.</li>
<li class="ingredient">Whole Garam Masala - Custom or readymade</li>
<li class="ingredient">For Rice: Basmati Rice(soaked for 1 hour) - 380 gms</li>
<li class="ingredient">Water - 6-8 cups</li>
<li class="ingredient">Oil - 1-2 Tbsp.</li>
<li class="ingredient">Whole Garam masala - Custom or readymade</li>
<li class="ingredient">Salt - 3 Tsp.</li>
<li class="ingredient">For Dum(Bringing together): Yogurt - 1/2 cup</li>
<li class="ingredient">Saffron strands - dipped in milk, a few</li>
<li class="ingredient">Chopped Nuts - As desired</li>
<li class="ingredient">Mint and Coriander - two handfuls</li>
<li class="ingredient">Fried onions - two handfuls</li>
<li class="ingredient">Green chili - 4-5 slits</li>
<li class="ingredient">Water - 1/4 cup</li>
</ul>
</div>
<div class="ERInstructions">
<div class="ERInstructionsHeader">Instructions</div>
<div class="instructions">
<ol>
<li class="instruction">For Veggies: In a kadhai add oil. Now add whole garam masala, ginger-garlic paste. Saute for a minute. Now add carrot, potatoes, cauliflower, peas and salt. Saute until they are lightly cooked.</li>
<li class="instruction">After the veggies are a bit cooked, add in biryani masala, red chili powder, garam masala powder and gradually add yogurt stirring well to prevent curdling of curd.</li>
<li class="instruction">Now add mint, coriander, paneer. Cook until the moisture gets dried out which was caused due to adding yogurt. This would take approx 5 minutes. Veggies should not be cooked completely as we will dum it later on. It should 70% cooked.</li>
<li class="instruction">After the moisture is dried, add some fried onions and transfer to a bowl.</li>
<li class="instruction">For Rice: Boil water. Add oil, whole garam masala, salt. Boil until roaring boil. Add the soaked rice. In about 3-4 minutes in high flame rice will be 70% done. Test by eating some if it has a bite but its tastes like cooked or press between ur fingers. If breaks into 2 parts its ready. Strain it and spread on a big plate.</li>
<li class="instruction">For Dum: Take a cooker, add half of the vegetables, yogurt, green chilli, a pinch of salt and some nuts. Let it heat. Now add a handful of mint coriander. Now top it off with a good layer of rice.</li>
<li class="instruction">Next add the remaining vegetables, remaining mint-coriander(leave 1 tsp. for top), fried onions and the rice. Spread the rice and add the saffron mixture with a bit of mint-coriander, fried onion.</li>
<li class="instruction">Now sprinkle 1/4 cup of water over it, Cover and cook for 2 minutes in lowest flame.</li>
<li class="instruction">Transfer the cooker to a big pot with some water. This water bath prevents the dum to get burnt.. In about 30-35 minutes the Biryani is ready to make you dig into it.</li>
</ol>
</div>
</div>
<div class="ERNutrition"></div>
<div>
<div class="ERNotesHeader">Notes</div>
<div class="ERNotes">Cut vegetables in a uniform size.[br]Veggies are less, but the rice is used more for Biryanis.[br]You could use raw chopped nuts or saute them in oil and add.[br]Make sure to soak rice for atleast 1 hour.</div>
</div>
<div class="endeasyrecipe" style="display: none;">3.2.1255</div>
</div>
<p> </p>
<p><img class=" wp-image-411 alignright" alt="Biryani-2" src="http://mywebsite.in.cp-25.webhostbox.net/wp-content/uploads/2013/09/Biryani-2.jpg" width="189" height="142"></p>
<p>Recipe Ingredients are lengthy.. But it looks only onscreen.. Once you start preparing them they does not seem long or more.. Basic Ingredients, Easy Recipe and Traditional Hyderabadi Taste.. Dont forget to try it, I am sure you'll love it and make it again and again!!!</p>
<p>Do Subscribe on YouTube</p>
<p>Like us on FB</p>
<p> </p>
<p>Video Recipe:</p>
<p><iframe src="//www.youtube.com/embed/zf0_AJfp5AA" height="500" width="835" allowfullscreen="" frameborder="0"></iframe></p>
the answer is variation of the following:
update wp_posts
set post_content = CONCAT(LEFT(post_content, LOCATE('div style=', post_content)-1),
SUBSTRING(post_content, LOCATE('</div>', post_content)+7))
where LOCATE('div style=', post_content) > 0
Changing the "div style" to whatever beginning that works.
Your query is close, but you need to use LOCATE as well as INSTR to find the end of the embedded string:
select
ID,
post_title,
substr(post_content,
instr(post_content,'<div style="position:absolute'),
LOCATE('</div>',post_content,instr(post_content,'<div style="position:absolute')+30)-instr(post_content,'<div style="position:absolute')
+6) as temp
from wp_posts
where post_content LIKE '%<div style="position:absolute%'
LIMIT 10
See example here: http://sqlfiddle.com/#!2/d0cf2f/13
You can use the following query for this replacement:
UPDATE Customer SET address = REPLACE(address, substring_index(substring_index(address, 'prefixString', -1), 'postfixString', 1), '') WHERE address IS NOT NULL;
For Example:
address: Black booster deer street
replace booster with an empty string.
UPDATE Customer SET address = REPLACE(address, substring_index(substring_index(address, 'Black', -1), 'deer', 1), ' ') WHERE address IS NOT NULL;
Related
I am building an app that formulates how much CBD needs to be put into a product to meet certain requirements. I have included instructions and required materials that are needed to make each recipe. When the user prints the recipe, ideally I would like to not show the instructions or required materials on the sheet.
I have managed to hide all of the required materials and instructions but when the page is set to be printed, it prints a blank page (I'm assuming because the content is spilling over to the next page even though it is hidden) and I do not want this to happen. Here is the HTML for the required materials and instructions:
<div class="noprint">
<hr>
<h1 id="centered">Instructions</h1><br>
<h3 id="centered">Required Materials</h3>
<div class="row">
<div class="column">
<h5 id="centered">Items</h5>
<ul>
<li>1 Aluminum Mixing Bowl</li>
<li>1 Metal Measuring Cup</li>
<li>1 Glass Measuring Cup</li>
<li>1 Small Scale</li>
</ul>
</div>
<div class="column">
<h5 id="centered">Items</h5>
<ul>
<li>1 250 mL Beaker</li>
<li>1 Funnel</li>
<li>1 Plastic Pipet</li>
<li>Cleaning Supplies & PPE</li>
</ul>
</div>
</div>
<h3 id="centered">Steps for Creation</h3>
<div class="instructions">
<ol>
<li>Always begin by washing and sanitizing hands. Then proceed to sanitize all material with rubbing alcohol
and paper towels.
</li>
<li>Measure out the correct amount of either the Dead Sea Salt, Epson Salt, or Baking Soda. Do so by using the
metal measuring cup and scooping the raw goods into the glass measuring cup. Put the raw material into the
aluminum mixing bowl.
</li>
<li>
Repeat Step 2 with both the other two materials not used in Step 1.
</li>
<li>
Measure out the correct amount of CBD tincture with the aide of the 250 mL beaker. Mix in the tincture slowly,
preferably in thirds of the total amount of tincture needed.
</li>
<li>
Use the plastic pipet to measure out the correct amount of milliliters of Grosso E.O. Mix in the Grosso E.O with
the rest of the mixture. Continue to mix until the solution is as homeogeneous as possible.
</li>
<li>
Put aluminum foil over the top of the mixing bowl, write the batch number on top, and store the finished product
in a freezer one day before bottling.
</li>
</ol>
</div>
</div>
And here is the CSS for the "noprint" class:
/* Do not print */
.noprint {
visibility: hidden;
}
Any help is greatly appreciated. Thank you!
I found the solution. Here is the code that I added to my print styles sheet.
html, body {
border: 1px solid white;
height: 99%;
page-break-after: avoid;
page-break-before: avoid;
}
I'm working on a basic bootstrap project.
I used a span tag to style certain words in my list. Like this:
<li>The agile feline <span class="text-info" style="font-size:30px"><strong> squeezed through</strong></span> the fence</li><br>
and in doing so, it shifted my other bullet list(on right hand side) and empty middle column down to the next row. It's supposed to go:
List ------ Empty middle column ------- List
But instead looks like this:
List
Empty middle column ------ List (<---with these ones on the next line; they should all be on same line)
Altogether, that section looks like this:
<div class="row bullet" style="margin-top:15px">
<div class="col-md-4 text-left">
<ul class="bg-success">
<li>Water is a<span class="text-info" style="font-size:30px"><strong> sacred element </strong></span> and the fundamental building block of ALL life</li><br>
<li><span class="text-info" style="font-size:30px"><strong>Water</span> in its purist form, <span class="text-info" style="font-size:30px"><strong>cleanses</span>; both externally and <span class="text-info" style="font-size:30px"><strong> spiritually</span></li><br>
<li><span class="text-info" style="font-size:30px"><strong>Preservation</span> of streams, springs and rivers <span class="text-info" style="font-size:30px"><strong>is vital</span></li><br>
<li>Approximately <span class="text-info" style="font-size:30px"><strong>400 billion gallons</span> of water are used every day in the United States</li><br>
<li>By 2025, half of the world’s population will be living in water-stressed areas.</li><br>
</ul>
</div><!--left list-->
<div class="col-md-4 text-center bg-danger"></div><!--empty mid column-->
<div class="col-md-4">
<ul class="bg-warning">
<li class="right">844 million people in the world- one in ten- do not have access to an improved source of drinking water</li><br>
<li class="right">Every minute a newborn baby dies from infection caused by a lack of clean water and an unclean environment. </li><br>
<li class="right">Collectively, South African women and children walk a daily distance equivalent to 16 trips to the moon and back to fetch water</li><br>
<li class="right">Globally, at least 2 billion people use a drinking-water source contaminated with feces</li><br>
</ul>
</div><!--right list-->
Everything was laid out as it was supposed to be until I styled certain words using the span tag. I've done searches upon searches and haven't been able to find clear information to assist me through this. And I can't find any documentation of this specific issue either. I also came across the usage of span inside of a div like: div class="span".....
Now I'm confused if it should be inside of another div or its own tag??...
I have an ordered list with specific values to the "list number".
I have seen solutions for a list that increments the value, however my values need to be specific and cannot change.
HTML
<td class="list">
<ol class="junkfood">
<li value="2">Cookies®</li>
<li value="1">Chocolate</li>
<li value="2">Brownies</li>
<li value="10">Ice cream sandwich</li>
</ol>
</td>
Right now it prints out as
2. Cookies
1. Chocolate
2. Brownies
10. Ice cream sandwich
I need the numbers to print out as 'values'
2 Cookies
1 Chocolate
2 Brownies
10 Ice cream sandwich
You don't want an ordered list then, you want an unordered list (ul)
<ul>
<li value="2">2 Cookies®</li>
<li value="1">1 Chocolate</li>
<li value="2">2 Brownies</li>
<li value="10">10 Ice cream sandwich</li>
</ul>
I included the value in the list item itself as your example shows.
2 Cookies
1 Chocolate
2 Brownies
10 Ice cream sandwich
HTH,
Eric
What you want is perfectly possible with CSS if you use data attributes:
ol {
list-style:none;
}
li:before {
content:attr(data-value) ' ';
}
<ol class="junkfood">
<li data-value="2">Cookies®</li>
<li data-value="1">Chocolate</li>
<li data-value="2">Brownies</li>
<li data-value="10">Ice cream sandwich</li>
</ol>
It is however also a rather weird use of HTML this way, as you're using an ordered list to represent unordered data. Therefore you should replace <ol> with <ul> in my sample to be semantically correct. The same CSS applies just fine this way, that's just presentational.
As you can see here:
My content has a large white space. My content HTML is below. Not sure why it isn't aligning properly and has a large whitespace. Makes no sense. I'm using col-lg-6 an col-md-6, so it should do half & half all the time.
Any ideas?
<div class="tab-pane active" id="specification">
<ul class="productinfo">
<div class="col-lg-6 col-md-6">
<h3>Specs</h3>
<ul class="unstyled listoption5"><li>Single bag holds approx. 20 gallons of water. </li><li>Fits mininum 1 inch tree trunk up to a maximum 4 inch tree trunk (Zip 2 bags together to water 5 to 8 inch trees/2 bags=about 40 gallon setup) </li><li>Made of green polyethylene with nylon webbing, black polypro straps and green nylon zippers. </li><li>UV treated to withstand exposure to sunlight. </li><li>2 drip hole locations per bag-Standard drip time of 5 to 9 hours. </li><li>Fill opening fits up to 3" diameter hose.</li><li>Filled with water: 30" Tall x 18" Wide (at base)</li></ul>
</div>
<div class="col-lg-6 col-md-6">
<h3>Product Features</h3>
<ul class="unstyled listoption5">DIRECTIONS FOR USE: <li>Place on tree trunk, with the zippers on the uphill side of the tree. </li><li>Wrap both sides around trunk (1" to 4" dia. trunk*) until zippers meet. </li><li>Two 20 gal. bags zipped together back-to-back - Fits 5 to 8" dia. trunk </li><li>Zip sides of bag together from bottom to top. </li><li>Lift tag to expose fill opening at top of bag. </li><li>Insert hose into fill opening and begin filling with water. </li><li>Fill bag to 1/4 capacity, then gently lift up on straps at top of bag to
</li></ul></div>
<div class="col-lg-6 col-md-6">
<h3>Product Benefits</h3>
<ul class="unstyled listoption5"><li>No more guess work- Provides a professional watering every time. </li><li>Reduces watering frequency-Fill just once a week for most new tree plantings. </li><li>Reduces the amount of time spent at tree- Setup and fill in less than 5 minutes. </li><li>Saves water resources- 100% water absorption with little or no run-off. </li><li>Deep water penetration with each application- Promotes deep root growth and reduces transplant shock.</li></ul>
</div>
<div class="col-lg-6 col-md-6">
<h3>Warranty</h3>
5 Year limited manufacturer warranty from the date of purchase against defects in materials and workmanship.
</div>
<div class="col-lg-6 col-md-6">
<h3>Links</h3>
<a target="_blank" href="http://www.treegator.com/products/specs/TreegatorOrig_SpecSheet.pdf">Spec Sheet</a><br>Additional Product Specifications & Handling Precautions<br><a target="_blank" href="http://www.treegator.com/products/original/index.html">Double Bag Set Up</a>
</div>
<div class="col-lg-6 col-md-6">
<h3>Application Rates</h3>
Failure to Follow Handling Procedures May Void Manufacturer's Warranty - Do not hang and/or suspend bag from straps. - Before use, remove all sharp objects from area to be irrigated. - Use clean water only. If necessary, filter water through cotton cloth on hose end. - Do not unzip bag when full. - Do not tear or rip fill opening. - Treegator® is not a toy - Keep away from children. - If using water soluble fertilizers, be sure to pre-mix in a separate container before adding mixture to bag. - Treegator® is designed for use on mulch. Failure to do so can result in clogging of drip holes.
</div>
</ul>
</div>
Use the following code around every 2 columns:
<div class="row">...</div>
This will fix the layout, example: http://www.bootply.com/t8m0BopAkO
I'm the webmaster for smctheatre.com. We're a community theatre that puts on a handful of plays each year. I'm adding to my toolbox with learning structured data. Microformat, microdata, or RDFa, I don't have any strong preference for one over another. I do like the syntax of RDFa Lite and microfomat over microdata and full-blown RDFa.
The only thing I haven't been able to get an answer to is how to mark up an event that occurs on multiple dates, and sometimes at different times.
Here's a trimmed down snippet from the site:
<article>
<header>
<h1>Play Name</h1>
<div class="addthis_toolbox">...</div>
</header>
<aside>
<h2>Dates</h2>
<ul>
<li>May</li>
<li>Fridays 17 & 24</li>
<li>Saturdays 18 & 25</li>
<li>Sundays 19 & 26</li>
<li>Monday 27</li>
<li>All shows start at 7:30 PM</li>
</ul>
<h2>Tickets</h2>
<ul>
<li>Adult $8.00</li>
<li>Child (5-17) $5.00</li>
</ul>
<h2>Directed By</h2>
<ul>
<li>Director Name</li>
</ul>
</aside>
<div>
<p>Summary of a theatre play....</p>
</div>
</article>
Duration of plays are typically two hours, but given that these are live performances, there's no hard and fast ending time.
How do I mark up the content to indicate the dates and times?
Seriously doubt there's an example of exactly what you want, but microformats are flexible and I think I've found enough to get you started:
<div class="vevent">
<a class="url" href="http://conferences.oreillynet.com/pub/w/40/program.html">
http://conferences.oreillynet.com/pub/w/40/program.html
</a>
<span class="summary">Web 2.0 Conference</span>:
<abbr class="dtstart" title="2005-10-05">October 5</abbr>-
<abbr class="dtend" title="2005-10-07">7</abbr>,
at the <span class="location">Argent Hotel, San Francisco, CA</span>
</div>
The example below uses multiple dates at the same venue; swap out the div for your article and looks like you're in business. easily make your header the summary, and put the description class on your p for summary...even though that sounds backwards, it's what you want.
How much further you want to take it is really up to you. I see where you could work start times, possibly a url....and also more microformats, to get even more goodness out of them. You should check out the wiki, it's full of great info, and examples from which you can and should pilfer.
http://microformats.org/wiki/hcalendar