w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
What is a simple example of using Pango to render text into an image using a FreeType font?
I'd take a look at the source code of pango-view, the "toy" app included in pango to demonstrate its capabilities. It can render in all pango modes pango text-rendering

Categories : C

Cairo introspection errors in Eclipse with PyDev `TypeError: Couldn't find conversion for foreign struct 'cairo.Context'`
In view of the lack of response I have come up with the following workaround, which uses WebKit instead of weasyprint to do the parsing, rendering and administration of the printing from html: #!/usr/bin/env python3 import os from gi.repository import Gtk, WebKit testFile = 'file://' + os.path.join(os.getcwd(), 'printTestHtml.html') class Example(Gtk.Window): def __init__(self): super(Example, self).__init__() self.init_ui() def init_ui(self): self.set_title("Print Html WebKit Test") self.resize(230, 150) self.set_position(Gtk.WindowPosition.CENTER) self.connect("delete-event", Gtk.main_quit) printButton = Gtk.Button('Press Me') self.add(printButton) printButton.connect('clicked', self.on_p

Categories : Python

Cairo: How to create path-warped text?
It appears cairiotwisted.c that's being referred to in the mailing list is available here at github.

Categories : Lua

Web Essentials Including existing style in new LESS style from another CSS file
Web Essentials doesn't appear to compile mixins etc in from CSS files, only LESS files. I found I had to include the original bootstrap.less files, like so: @import "../../Bootstrap/less/bootstrap.less"; Obviously your path might be different!

Categories : CSS

Best approach handling Relational ActiveRecords in Yii
code for dataprovider $dataProvider=new CActiveDataProvider('Company', array( 'criteria'=>array( 'with'=>array('transaction'), 'group' = 't.value' ), 'pagination'=>array( 'pageSize'=>20, ), ));

Categories : PHP

What is the recommended approach to style a SlickGrid?
Within your second/last jsFiddle you can modify the CSS to have this code .slick-header-column.ui-state-default { background:none ; background-color: #505050 ; color: #eeeeee; border: none; padding: 0; text-shadow: none; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 13px; height: 40px; line-height: 40px; } .slick-row.ui-widget-content, .slick-cell { background: none; background-color: #eeeeee; color: #666666; border: none; border-bottom: solid 1px #ffffff; font-size: 14px; height: 60px; line-height: 60px; padding: 0 5px; }

Categories : CSS

What's the approach for handling transactions in java across multiple data stores?
Obviously your question describes a pretty complex scenario. Writing data across multiple data stores and wanting the writes to be transactional across all systems. I can think of three ways of doing this. Use a Service Bus Mule ESB (http://www.mulesoft.org/) provides its own transaction functionality and will let you write data to multiple systems fairly easily. The difficult part would be implementing a rollback strategy in case of one of the writes failing. But Mule was definitely my first thought because it has good integrations with lots of systems and it supports the idea of transactions. Mark Records as Dirty The second approach is to introduce a dirty flag to every record in each system. As you begin a transaction, you write the data and have a "dirty" flag set to 1 for each

Categories : Java

Entity Framework with existing database - neatest approach?
The code you have put into Global.asax.cs can be put into a static constructor for the Context. public class MyContext : DbContext { static MyContext () { Database.SetInitializer<MyContext>(null); } //... } References here, here and here

Categories : C#

Using jsoup is there a way to get anchor tags that are within div tags with class attribute that have display none style in the css class..?
Select all <a>-tags and search if one of the parents is a <div> with the hiding-class: for (Element a : doc.getElementsByTag("a")) { for (Element parent : a.parents()) { if (parent.tagName().equals("div") && parent.hasClass("hidden")) { a.remove(); } } } Or easier - just remove all anchors in a <div> with the hiding-class: doc.select("div.hidden a").remove();

Categories : CSS

Regex - Replace tags and special characters, saving the text within the tags
Sure it is possible with regex, you place text you want to preserve into parentheses and then refer to it in repl string by "1" (for first one, 2 for second etc.): import re mystring = '* Text1' print re.sub(r'* (.*)',r'\begin{itemize} \item 1 \end{itemize}',mystring) Output: egin{itemize} item Text1 end{itemize} For more details see http://docs.python.org/2/library/re.html#re.sub

Categories : Python

Stripping tags from xml while preserving contained text and parent tags using xslt
The output of the first stylesheet you show (if you add the missing xsl:stylesheet element is <vocabularyModel> <conceptDomain name="ActAccountType"> <annotations> <documentation> <definition> <text>Description: more txt here Examples: Patient billing accountsCost centerCash</text> </definition> </documentation> </annotations> </conceptDomain> <conceptDomain name="ActAdjudicationInformationCode"> <annotations> <documentation> <definition> <text>long text.long text.long text.long text.</text> </definition> </documentation> </annot

Categories : Xml

PHP XPath, cannot retrieve text after tags inside targeted tags
This would work: $xpath->query('//p[preceding::b]')->item(0)->textContent; There's a string-join function in XPath, but sadly not in the XPath 1.0 version in lbxml which PHP uses.

Categories : PHP

How to remove HTML tags, but preserve text, and then later replace the tags?
Use the unwrap function: $('ruby').unwrap(); http://api.jquery.com/unwrap/ EDIT: How about similarly following the tutorial example in the above link? pTags = $('ruby'); if ( pTags.parent().is("span") ) { pTags.unwrap(); pTags.wrap("<ruby></ruby>"); } else { pTags.unwrap(); pTags.wrap("<span class='unwrapped_ruby'></span>"); } Unwrap the <ruby> tag and wrap it with a placeholder <span> tag. Update 1: Well, my previous code had the right "pseudocode", but I tested it and it wasn't working properly. Instead I had to do something like this: pTags = $('ruby'); var content = pTags.contents(); $("button").click(function () { if (content.parent().is("span")) { content.unwrap().wrapAll("<ruby></ruby>"); } else {

Categories : Jquery

Trying to have both stylize() randomly select cell bgcolor and text style separately using CSS style
If I understood correctly, you are not being able to change the background correct? You need to fix the following CSS styles: .myBackground1{color:blue} .myBackground2{color:red} etc... with .myBackground1{background-color:blue} .myBackground2{background-color:red} etc... and change the code: function stylize() { if (index > 20) index = 1; var s = "myStyle" + index; var e = document.getElementById("MessageText") e.className = s { var bgindex = 0; bgindex++; if (bgindex >5) bgindex =1; var b ="myBackground" + bgindex; var c = document.getElementById("MessageCell") c.className = b } } with function stylize() { index = getRandomInt(1, 20); var s = "myStyle" + index; var e = document.getElementById("MessageText") e

Categories : Javascript

Add tags to enclose existing table
Try this: var tables = main_code.getElementsByTagName("table"); for(var i = 0; i < tables.length; i++) { var div = document.createElement("div"); var _t = tables[i]; var parent = _t.parentNode; div.id = "extra"; parent.replaceChild(div, _t); div.appendChild(_t); } Although, this adds the same id to multiple div container, if there are more than one table. You might want to use div.className = 'extra' instead.

Categories : Javascript

Handling sorting, tags, search, paging of a list
There are a number of additional parameters that automatically get passed to template toolkit. Here is the documentation: https://metacpan.org/pod/Dancer::Template::Abstract You will notice that one of them is params. So, within TT, you could build something like this: <a href="/example?search=<% params.search %>&sort=<% params.sort %>&tag=<% params.tag %>"> ... </a> Of course, if you wanted to get fancier, you could add them only conditionally. For example: ... <% IF params.sort %>&sort=<% params.sort %><%END%> ...

Categories : HTML

CSS apply same style to a group of tags
You need to use a CSS class instead of an ID, like this: a.myStyle { background-color: transparent; padding: 0px; } Then you can apply the class to each anchor tag, like this: <a class="myStyle" href="..."><img src="..."/></a> <a class="myStyle" href="..."><img src="..."/></a> <a class="myStyle" href="..."><img src="..."/></a>

Categories : Asp Net

Style heading tags with css reset
The way that you have set up the new header style will work fine. You might want think about adding h1,h2,h3,h4,h5,h6 { font-weight: normal; font-style: normal; } to make sure the type is default set to non italic/oblique or bold (unless you want the default to be strong)

Categories : HTML

Is it possible to style posts in octopress according to its tags?
I'll assume you have a old class that differentiates the posts or that you can style a list of old posts with a old_posts class. You can create two separate lists: <ul class="old_posts"> {% for post in site.tags.old %} <li><a href="{{ post.url }}">{{ post.title }}</a></li> {% endfor %} </ul> <ul class="new_posts"> {% for post in site.posts %} {% unless post.tags contains 'old' %} <li><a href="{{ post.url }}">{{ post.title }}</a></li> {% endif %} {% endfor %} </ul> Or you can create one list with the old posts receiving a special class old: <ul> {% for post in site.posts %} {% if post.tags contains 'old' %} <li><a href="{{ post

Categories : CSS

Adding whitespace handling to existing Java regex
Just using \s will account for all of them. And add the + quantifier on entire character class, to match 1 or more repetition: Pattern.compile("[~#@*+%\s]+"); Note that in Java, you need to escape the backslashes. So it's \s and not s.

Categories : Java

Spring MVC dynamic view + handling non existing views
Not with UrlBasedViewResolver and friends. Once the chain has reached it, you're committed -- if the view doesn't exist, you're going to be directed to whatever 404 page your container has configured. Note: When chaining ViewResolvers, a UrlBasedViewResolver always needs to be last, as it will attempt to resolve any view name, no matter whether the underlying resource actually exists.

Categories : Java

Style Existing Class (PHP Echo)
Put a hidden input in your form, <form action="" method="post"> -------- -------- <input type="hidden" name="process" value="1" /> </form> Then, instead echoing in your php file, use the following code in your html file to show the h5. <?php if (isset($_POST['process']) && ($_POST['process'] == 1)): ?> <h5 class="when-text"> Form submitted! </h5> <?php else: ?> <h5 class="when-text"> Form not submitted </h5> <?php endif; ?> If your form is submitted by the user, $_POST['process'] will be 1

Categories : PHP

Overriding an existing style in the android sdk
Try this: <style name="MyStyle" parent="@android:Widget.ActionBar.TabText"> <item name="android:textAppearance">@style/TextAppearance.Holo.Medium</item> <item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textSize">14sp</item> <item name="android:textStyle">bold</item> <item name="android:textAllCaps">false</item> <item name="android:ellipsize">marquee</item> <item name="android:maxLines">3</item> </style> Note that you have to add the 'android' namspace in front of a style from the framework. So change parent="Widget.ActionBar.TabText" to parent="@android:Widget.ActionBar.TabText".

Categories : Android

CSS overwrite existing style for an element
If your "particular" anchor tag has a class or id you could use :not pseudo class a:not(.exemptedSelector):hover { /*Your style goes here*/ } Demo Documentation Support Or just provide a hover style for your "particular" anchor tag to override the style provided using A tag. .exemptedSelector:hover { /*Your style goes here*/ }

Categories : HTML

How to parse a String, using a certain pattern, in PHP? (to add some style-tags)
Try: preg_replace_callback('/(+[/d]+% ([^)]+))/', function($matches) { // Make a valid class identifier $class = str_replace(' ', '-', strtolower($matches[1])); // Wrap everything in a <span> return "<span class='$class'>{$matches[0]}</span>"; }, $string);

Categories : PHP

How to add blog style tags in reStructuredText with Sphinx
I've solved this with some custom preprocessing and a custom directive. My personal website is made with Sphinx, as is my weblog. And a weblog means tags. First the custom Sphinx directive "tags" that I use like this: My blog entry header ==================== .. tags:: python, django Bla bla bla bla The directive itself translates itself to a bunch of relative links of the form ../../tags/python.html, which works because the blog entries are always in yyyy/mm/dd/ directories. Second a small preprocessing script that I call from the Sphinx makefile. This script simply generates a tags/TAGNAME.txt file. Sphinx processes it as a regular Sphinx file, so you only have to generate some valid restructured text. For instance: python ###### .. toctree:: :maxdepth: 1 2013-08-23 Pra

Categories : Python

XCode style file handling in visual studio
Thanks to Visual Studio 2012 this is now available. Clicking a file in the solution explorer opens it immediately with a right-aligned tab. Double clicking permanently opens it, with a standard tab, aligned to the left.

Categories : Xcode

ffmpeg convert mp3 to lower bitrate with existing mp3 tags
Use a newer version of ffmpeg. Current versions preserve ID3 tags when converting media files. See the FFmpeg download page for links to builds for Linux, OS X, and Windows, or refer to a FFmpeg compile guide.

Categories : PHP

Programmatically Add Tag to Wordpress Post Without Overwriting Pre-Existing Tags
Look at the fourth parameter of the function, $append. If it is set to true, the tags are appended to the existing tags, if it's false (the default) they replace them. So you want to call it like so: wp_set_object_terms($post_id, 'mytagname', 'post_tag', true);

Categories : Wordpress

existing frameworks for a questionnaire style app for web and mobile
How about using sth like https://github.com/patocallaghan/questionnaire-js This is a purely (client) javascript framework (using MVC frameworks underneath, like Angular). On server-side one would only need to validate and save the data.

Categories : Node Js

Creating BBCode style of tags into my custom blog
You could probably do it kind of like this: $str = 'this is a string with [bold]bold[/bold] text'; $str = preg_replace('/([bold])/', '<strong>', $str ); $str = preg_replace('/([/bold])/', '</strong>', $str ); echo $str; I'm not great at regex, so I'm sure some wizard can combine my two statements into one, but this is the general idea. Just replace any bbcode with the proper html? DEMO

Categories : PHP

Remove contents between script and style tags in Objective-C
You can edit the scanner code so that you can check the tags. If the tag is one you want to remove then you can scan to the closing tag and just discard the string. You not then you can store / append the string. Read up to the tag start (<)' then read the tag so you can check what it is. Then read to the tag close and either drop it or save it. Start with something like (typed inline and not tested in any way): while (![scanner isAtEnd]) { [scanner scanUpToString:@"<" intoString:&s]; if (s != nil) [ms appendString:s]; [scanner scanUpToString:@">" intoString:&t]; if ([t isEqualToString:@"tagToIgnore"]) { [scanner scanUpToString:@"<" intoString:NULL]; [scanner setScanLocation:[scanner scanLocation]-1]; s = nil;

Categories : Objective C

perl: strip html tags, manipulate text, and then return html tags to their original positions
The module HTML::Strip uses the XS glue language to connect the Perl code with C code. You can find the XS file e.g. on (meta-)cpan. It includes a file strip_html.c that implements the actual algorithm. Due to the definitions in the XS file, a strip_html sub is available in the Perl code as part of the HTML::Strip package. Therefore, it can be invoked as a method on an appropriate object. Explanation of that piece of code my $stripped = $self->strip_html( $text ); This will invoke the C function on the contents of $text to strip all the HTML tags. The stripped data will then be assigned to $stripped. if( $self->decode_entities && $_html_entities_p ) { $stripped = HTML::Entities::decode($stripped); } Suffixing variable names with -p is a lispish tradition to indicate

Categories : HTML

jQuery.Rule plugin how to change existing style?
I'm not familiar with the plugin, but .attr() usually looks something like this: $('#id.class1.class2').attr('style','top:20px;'); API doc. for .attr() you could also try something like: $('#id').css('top','20px');

Categories : Jquery

How to apply additional inline style to html tags in ruby?
I recommend against using regex for this, as in general HTML can't be properly parsed by regex. That said, as long as your input data is consistent, regex will still work. You want to match whatever content is already in a p element's style attribute using parentheses, then insert it in the substitution string: myHtmlString.gsub(/<p( style="(.*)")?/, "<p style="#{$2};margin:0px;padding:0px"") Here's how the match pattern works: / #regex delimiter <p #match start of p tag ( #open paren used to group, everything in this group gets saved in $1 style=" #open style attribute (.*) #group contents of style attribute, gets saved to $2 " #close style attribute )? #question mark makes everything in the paren group optional /

Categories : Ruby On Rails

Removing all content between