w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How can I get a div content in php which not have class and id
For this kind of task you can use regular extensions Useful functions: preg_filter — Perform a regular expression search and replace preg_grep — Return array entries that match the pattern preg_last_error — Returns the error code of the last PCRE regex execution preg_match_all — Perform a global regular expression match preg_match — Perform a regular expression match preg_quote — Quote regular expression characters preg_replace_callback — Perform a regular expression search and replace using a callback preg_replace — Perform a regular expression search and replace preg_split — Split string by a regular expression

Categories : PHP

preg_match get div content with class
Use DOMDocument - I've written the code into functions in case you want to perform similar operations again: function DOMinnerHTML(DOMNode $element) { $innerHTML = ""; $children = $element->childNodes; foreach ($children as $child) { $innerHTML .= $element->ownerDocument->saveHTML($child); } return $innerHTML; } function getElContentsByTagClass($html,$tag,$class) { $doc = new DOMDocument(); $doc->loadHTML($html);//Turn the $html string into a DOM document $els = $doc->getElementsByTagName($tag); //Find the elements matching our tag name ("div" in this example) foreach($els as $el) { //for each element, get the class, and if it matches return it's contents $classAttr = $el->getAttribute("class");

Categories : PHP

Prepend the content of a class into an id?
$("#v65-productdetail-action-wrapper").prepend($(".PageText_L483n").first()); To remove $(".PageText_L483n").first().html(""); Or $(".PageText_L483n").first().remove(); Both should work. What you will have to do for the break is append a to the class and the prepend it to the id. $("#v65-productdetail-action-wrapper").prepend($(".PageText_L483n").first().append("<br>")); Should do it.

Categories : Javascript

Add class to parent div based on content of certain div
use $(this) .closest() $('.teaser-text').each(function() { var teasertext = $(this).text().replace(/ /g,"_").toLowerCase(); $(this).closest('.boxgrid').addClass(teasertext); });

Categories : Javascript

Change all divs with class to fit div with most content
Simply loop through all div's, collect the widest width and after all set it to your class: var maxWidth = 0; $('.yourclass').each(function() { maxWidth = Math.max(maxWidth, $(this).width()); }).width(maxWidth);

Categories : Javascript

sorting class content according to few parameters
You should let you class implements Comparable, it has a compareTo method just like String does. So your custom comparator could look like this: public class CustomComparator implements Comparator<Item> { @Override public int compare(Item i1, Item i2) { return i1.compareTo(i2); } } (The compare() method must return an int, so you couldn't directly return a boolean.) Than you need to overwrite the CompareTo Method in your Item class, where you define what properties should be compared. Because you want to sort on different options you need mutliple compare methods, and multiple comparators. Than you just need to call them how you need. Your sorting code would be just about like this: Collections.sort(YourObejctList, new CustomComparator());

Categories : Java

Get content of special HTML tag by class name
You can use XPath to accomplish that. Change your code to this: $html = file_get_contents('http://www.q8ping.com/49352.html'); $doc = new DOMDocument(); libxml_use_internal_errors(true); $doc->loadHTML($html); $finder = new DomXPath($doc); $node = $finder->query("//*[contains(@class, 'post-inner')]"); print_r($doc->saveHTML($node->item(0))); You might want to check first though if an element was found.

Categories : PHP

Including JAR within a JAR makes class don't see jar content
The Java Launcher$AppClassLoader does not know how to load classes from a Jar inside a Jar. What you need is a custom classloader that knows how to load classes and resources from a jars inside an archive, instead of from jars in the filesystem. You can take a look on one-jar, it lets you package a Java application together with its dependency Jars into a single executable Jar file. JarClassLoader can also load classes, native libraries and resources from the top JAR and from JARs inside the top JAR. Another solution (The very ugly one) would be to explode JAR contents inside your jar.

Categories : Java

How to set a css class based on content in rails
Not sure if this is what you are looking for, but you can do something like this: content_tag(:td, '', :class => (@obj == 'x' ? 'something' : 'somethingElse')) If your condition testing is complicated, yes, I would use a helper method. Then you could do something like: content_tag(:td, '', :class => name_of_helper_method(@obj)) where the helper method returns a string for the class name you want to set. Edit: this might be what you are looking for: <td><span class="label <%= order.state == 'Created' ? 'label-success' : 'label-warning' %>"></span></td>

Categories : CSS

jQuery: If class exists hide content
There is no .exists() method. You have to check that length of the resulting jQuery object is nonzero: if ($(".inner").filter(':contains("OTHER SIMILAR PACKAGES:")').length > 0) {

Categories : Jquery

jQuery remove class that hides content
You're assign function to element that doesn't exist on page. You can write into first line: <button class="btn btn-default" onclick="$('#newThread').removeClass('hide')">

Categories : Jquery

Applying a show/hide class div to every div with different content
With multiple selector $(document).ready(function () { $('.red, .blue').hover(function () { $(".tooltip").fadeIn(250); }, function () { $(".tooltip").fadeOut(250); }); }); Demo Fiddle

Categories : Jquery

created a jquery tab content changer when tab content is increasing height due to inner content its over lapping to its bottom div
This happens because the wrapper of you content tabs .tab-container has height: 300px;. Put it to min-height: 300px; and should work fine. Test: JsFiddle

Categories : Jquery

How to print map content with the data type is a class object
basically to print this you will do: typedef map <string, fsdbSig *> Pinname_sig; Pinname_sig _Pinname_sig; Pinname_sig::iterator itPS; for (itPS = _Pinname_sig.begin(); itPS != _Pinname_sig.end(); ++itPS){ cout << "Jden-key:"<< itPS->first<< ","<< "value:"<< *(itPS->second) <<endl; ^ since itPS->second is pointer to fsdbSig } however this will work only if fsdbSig is a type with defined operator<<, something like this in global namespace: std::ostream& operator<< (std::ostream&, const fsdbSig&); or this in fsdbSig class: class fsdbSig { public: friend std::ostream&

Categories : C++

Content of class property gets cleared out before outputting to browser
I don't know what happend. But somehow this script started to work as expected. I've rewritten the code over and over for a while now, and as far as I know it's just about the same as before. But anyway; This is what works now: site()-class: This class controlls notifications as well as settings set by the user - like preffered sorting direction of data and selections worth remembering for better user experience and such. <?php class site { private $notice_type = '', $notice_msg = ''; public function newNotice($type,$msg){ $this->notice_type=$type; $this->notice_msg=$msg; } public function notice($what){ switch($what){ case 'type': return $this->notice_type; break; case 'msg': return $this->notic

Categories : PHP

Can AngularJS directive pick up class name from dynamic content?
The problem is that the new HTML is not being compiled by Angular. The simplest solution may be to manually compile the dynamic content using the $compile service. Do this in a custom directive and replace ng-bind-html-unsafe="r.alink" with something like htmlinsert="r.alink". Here is how that directive could be coded: angular.module('appp', []) .directive('htmlinsert',function($compile){ return { scope: { htmlinsert: '=' }, link: function(scope,element,attrs){ var compiledElement = $compile(scope.htmlinsert)(scope); element.append(compiledElement); } } }); The reference to the html string is passed using isolate scope binding, and is then compiled before being appended to the current iteration of the repea

Categories : Angularjs

Class retains previous content where new instance is expected
Here's how the definition of the a instance variable should look: class test(object): def __init__(self): self.a = [] The way it was before a was not declared as an instance variable, but a class variable that was being shared across all instances of the class.

Categories : Python

Insert content in static containers of a templated class prior to main
You can add explicit template instantiation prior to usage in Wobble template class Quux<unsigned>; Something like this http://ideone.com/clone/mkJo0W

Categories : C++

Javascript: How to add "div" element right after 2nd generic "p" tag (w/o ID nor Class) inside of every post or content section?
Given your html: <input type='button' onclick='addText();' value='Add To List'/> <input type='text' id='input'/> <div id="main-content"> <p>1st paragraph content.....</p> <p>2nd paragraph content.....</p> <p>3rd paragraph content.....</p> </div> And since you didn't mention jQuery I will provide an answer with plain Javascript: var appender=1; function addText(){ var parentDiv = document.getElementById('main-content'); var input = document.getElementById('input').value; var node = document.createElement("DIV"); var textnode = document.createTextNode(input); node.appendChild(textnode); node.id = 'custom-div_' + appender; var child = parentDiv.children[2]

Categories : Javascript

Hiding/Showing SherlockFragments in ActionBar.TabListener Class, content is empty
Instead of using show() and hide(), use attach() and detach(). Using show/hide does not remove the view hierarchy from the screen, simply hides it, so there might be issues related to that.

Categories : Android

Jquery Content Slider: Add an error class to a navigation menu that corresponds to empty section
Two possibilities I guess. One is you don't let them go to the next tab until they finished their work on the current tab. That's option #1 below. Option #2 as you state is to style the tab somehow so they can see they need to return to it. See #2 below. #1: In your click event (use .on() not .live()) wrap the containing code in this: if(!$('.error').length){ //All the code you have in your event now should be here - that is, there are no errors they can proceed. } else { //else is optional. Here you could do whatever you want to tell the user - "no, you can't move on because you have a validation issue. Here is a suggestion: alert('You have errors! ' + someerrorvar); } #2 Again, as above use a .on() event instead of .live() because .live() is no more. I'm going to make

Categories : Javascript

Drupal - dynamically add class to wrapping div based on panel pane content node type
Find the tpl.php file that prints that panel layout from the panels module (it can be found under "panels/plugins/layouts/YOUR_LAYOUT" folder) and copy it in your theme folder. In the tpl.php file add the php code the same way you edit drupal themes.

Categories : Drupal

The type android.content.Context cannot be resolved. It is indirectly referenced from required .class files
Adding jar from Android SDK path...cleared the error. :) Josh Edit: Basically I copied the file android.jar from my computer and added it to the path of my Sap Mobile Platform project, which is running on a remote virtual machine. These are the detailed steps (We all love detailed steps): go to: YourAndroidSDKPathsdkplatformsandroid-17 (instead of 17 go to your version number) ...and copy the file android.jar somewhere else Now, go to your SMP project, highlight the red "app.getInstance().getApplicationContext()" code where the error is, so that a yellow popup appears, with a hyperlink to "Fix Path" Go to the Library tab, click on add external JAR, and browse to the android.jar file that you copied before. Voila!!

Categories : Java

FATAL EXCEPTION: main java.lang.RuntimeException: Content has view with id attribute 'android.R.id.list' that is not a ListView class
I had this error a while back. For some reason the XML for the layout had been modified so that one of the components had the wrong type. Go into the xml and look for the 'android.R.id.list' that doesn't belong to that item. I don't know how it got changed, but I think perhaps that when using the GUI editor, I changed something to list that shouldn't have been. If you don't see it, post the layout

Categories : Java

Parse content inside all HTML elements with class .mod in HTML document with PHP
You could use xpath $path = new DOMXPath($this->document); $nodes = $path->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' mod ')]");

Categories : PHP

Toggle class show div content(buttons and text field) above the text
Change the position property of your wrapper to relative like shown below and it should work. (Note: I have changed the top value also). #wrapper { position:relative; //modified this z-index:1; top:0px; //modified this bottom:48px; left:0; width:100%; height:100px; overflow:auto; } The difference between absolute and relative is that , when you have position absolute , it takes the position from the container having relative position, by default its the body of the page.Here when you give the position absolute , your elements takes the positioning from the body , but when you have positioning relative , it takes positioning from current container #wrapper Demo EDIT: This link explains the difference between the various positioning values.

Categories : Javascript

Web Api of content-type XML returns complete class - while JSON returns just ID
@Will that was it! I have to go back and add "[DataContract]" to my classes and "[DataMember]" to the members and the data then comes through. http://msdn.microsoft.com/en-us/library/ms733127.aspx namespace MyTypes { [DataContract] public class PurchaseOrder { private int poId_value; // Apply the DataMemberAttribute to the property. [DataMember] public int PurchaseOrderId { get { return poId_value; } set { poId_value = value; } } } }

Categories : C#

jQuery toggle slides DIV up and down, but UL content animates left to right. How can I make the content slide up and down?
toggle() simply toggles the showing/hiding, but doesn't specify how to show/hide. Try: $('#myMenu ul').slideToggle('slow'); jsfiddle

Categories : Jquery

Load content with Javascript, but still retain a unique link to specific content pages
What you want to achieve seems more like a Single Page Application. There are javascript libraries which can help you build the application the way you described it. Take a look on Sammy.js or History.js libraries.

Categories : Javascript

Setting appropriate HTTP Content-Length header in WSGI middleware after manipulating content
You dont need to worry about deleting/adding/changing content-length header, that will be auto handled by the server when it sends out the response. Sending a wrong length header might create problems for your website viewers / internet browsers. You can test the Content-length headers here - http://www.dekho-ji.com/website-diagnostics-curl-http-request-response-headers-online

Categories : Python

Cross-domain AJAX withCredentials, PHP returns header content-lenght, but no content
When setting headerAccess-Control-Allow-Credentials to true, you cannot use a wildcard for header Access-Control-Allow-Origin. That is, a specific host must be specified. Instead of: Access-Control-Allow-Origin: * Use: Access-Control-Allow-Origin: http://safedomain.com You can even set the Access-Control-Allow-Origin header to the Origin header received in the request. Not sure about PHP, but using the Java Servlets API: String origin = request.getHeader("Origin"); request.setHeader("Access-Control-Allow-Origin", origin);

Categories : PHP

How to show data (in front of every content) in div if content come in huge lines in jQuery?
I would do something like this: .data .status, .data .text { float: left; } .data .status { width: 25%; } .data .status span { display: block; } .data .text { width: 75%; } <section class='data'> <div class='status'><span>Changed</span></div> <div class='text'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce condimentum blandit neque. Nulla facilisi. Sed ornare luctus nulla euismod tincidunt. Cras rhoncus semper mi vitae facilisis. Nulla facilisi. Aliquam feugiat quis dui sit amet pretium. Nunc et accumsan risus, non lobortis mi. Donec pulvinar lacus diam, eu feugiat tortor malesuada a. Aenean pretium quam mi, id tincidunt nulla posuere nec</div> </section> var $data = $('.data'); $data.each(function

Categories : Jquery

UIPickerView change content text size after loading content into picker
If I understood your question correctly, you may want to take a look at this answer. The strategy is basically to truncate (ellipsis) instead of font shrinking. Edit (based on comment) I would strongly advise against setting all text to the minimum font. Lets say you have elements as such: Pear Peach ok, so far these will fit your label perfectly, with a good font size. Now you add a longer item: Pear Peach Strawberry Pineapple and now all your items are a little bit smaller, but thats still readable, so it's acceptable. And then a huge item appears, such as: Pear Peach Strawberry Pineapple SomeKindOfExoticFruitThatHasAnIncredibleLongName which would make all items inside your picker become incredibly small, and difficult to read. But if you still want to go down that roa

Categories : IOS

Drupal 7/Views - Showing similar content with the same tag(s) when adding a new piece of content
Views, similar_by_terms, similar and other modules provide that functionality. See how to create such a block with views at this article http://www.metachunk.com/blog/adding-related-content-view-drupal-7

Categories : Drupal

HTTP Content-Encoding: gzip not recognized and wrong Content-Length
Oh god, I got it working! I dont' know why, but today I booted into my Windows development machine instead of Ubuntu. As it seems, Chrome for Windows doesn't display or process the response correctly. Under Ubuntu, it works at the first try. I want 6 hours of my life back.

Categories : Node Js

How do you bind to a listbox.itemtemplate in a style's content template content control
In the ListBoxItem style add ContentTemplate="{TemplateBinding ContentTemplate}" <ContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"> <!-- style stuff--> </ContentControl>

Categories : Wpf

in Backbone, is it possible to tell fetch that it if it reads content that is content-type:'text/plain' to read it as JSON
Backbone uses jQuery.ajax under the hood for the ajax requests. So you need to use the dataType: 'json' options to specify how jQuery should treat the response when you are calling fetch: yourCollection.fetch({ dataType: 'json' });

Categories : Backbone Js

How to allow cross domain content script on Firefox add-on without firing mixed content blocking errors
Specifying that permission will cause the Sandbox (worker in SDK internal terms, content script in documentation) to simply get a new XMLHttpRequest constructor, that has more than one principal (or "origin", if you like). This will only change how to same-origin-policy is evaluated, but not how security in general and mixed-content policies in particular are implemented. That is: You still cannot do a https to http XHR, as you noticed. There is no work around you can use in your content script. You could however message your main script to do the request and pass the result back (again via message passing) to the content script. Please file a bug. At the very least this limitation should be documented. Personally, I wouldn't be in favor of lifting it. Mixed-content is a security issue,

Categories : Javascript

unable to set hidden field content from div html content on fullscreen iPad Mobile Safari
This is quite old, but after googling around to solve the same issue for me, I have not found a solution. Looks like some weird behaviour from iPad (easily reproducible, no way to fix, at least that I found): the target input field gets changed indeed, but the posted value is the original one (???) So just in case a workaround is useful to somebody, instead of applying the changes from the contenteditable div on form submit, I apply the changes whenever the div is changed (no on change event for contenteditable divs, so really it is done on blur event): <div id="editor_inline_core_body" class="inputbox editor-inline" contenteditable>[initial value here]</div> <input type="hidden" id="jform_core_body" name="jform[core_body]" value="[ initial value here]" /> <script>

Categories : HTML

How to design content blocks which render HTML content as tumblr does?
You are talking about template engines. There are many. See Wikipedia’s comparison of web template engines. For more about the concepts, see the article Web template system.

Categories : HTML



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.