Skip comma and other puncuation mark character from text content and replace it by space |
You could use std::replace or std::replace_if
std::replace(s.begin(), s.end(), ',' , ' ');
std::replace_if(s.begin(), s.end(), [](char c){return c == ','; }, ' ');
see live sample
For C++03, could do:
#include <cctype>
struct IsComma
{
bool operator()(char c) const
{
return (bool)std::ispunct(c);
//!"#$%&'()*+,-./:;<=>?@[]^_`{|}~ as punctuation
}
};
std::replace_if(s.begin(), s.end(), IsComma(), ' ');
als don't forget read std::ispunct
Hope this helps!
|
How to avoid/skip the text finding inside the Hidden/Non-displayed content in CKEDITOR 4.0 |
At the moment CKEditor doesn't offer such feature. You need to modify the
source code of the find plugin to have this working your way.
Created a new ticket for this bug on CKEditor bug tracker. Hopefully we'll
see this fixed soon ;)
|
Open activity before setting webview.load(--) and on backpress or skip show below activty |
i have a suggestion
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.activity_wap_launcher);
Intent intent = new Intent(this, BManager.class);
this.startActivityForResult(intent,1);
}
@override
protected void onActivityResult(int requestCode, int resultCode, Intent
data) {
if(requestCode == 1)
{
WebView webView = (WebView) findViewById(R.id.webView1);
final String url = "http://www.google.com";
webView.loadUrl(url);
}
super.onActivityResult(requestCode, resultCode, data);
}
|
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.
|
How to load jQuery content into div from external content specific div |
Use ordinary string concatenation:
$("#proj_content").load("/projects/rest #" + $(this).attr("class"));
or maybe you meant:
$("#proj_content").load("/projects/" + $(this).attr("class") + "
#proj_cont");
|
possible to use 'load()' to insert content into jquery tab content? |
Have you tried the ajax functionality already present in Tabs plugin? You
can put the webpage that is to be inserted in href attribute of the a tag,
the content of that page will be loaded automatically when you select the
tab.
Here is example code provided in the website:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Tabs - Content via Ajax</title>
<link rel="stylesheet"
href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"
/>
<script
src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script
src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
|
.load() To Load Multiple Content Individually |
If the HTML structure you're using is fixed, such has:
<ul class="links">
...
</ul>
<div></div>
<ul class="links">
...
</ul>
<div></div>
Then you can use:
$(document).ready(function() {
$('.links + div').load('login.php')
$(document).on('click','.links li a:not(.noajax)',function() {
/* code */
$(this).closest('.links').next('div').fadeOut('fast').load('' +
page + '.php').fadeIn('slow');
/* code */
});
});
If the HTML structure isn't fixed, then something like this would work:
<ul class="links" data-load-target="div1">
...
</ul>
<!-- HTML -->
<div id="div1"></div>
<ul class="links" data-load-target="div2">
...
</ul>
<!-- HTML -->
<div id=
|
using jQuery .load and content will not load correctly |
The script registering the click event for 'omicronchapterlink' is not
waiting until the element is ready in the DOM. User jQuery's
$(document).ready for this.
<div id="leftcol">
<h1>
About Us
</h1>
<script type="text/javascript">
$(document).ready(function(){
$('#omicronchapterlink').click(function(){
$('#rightcol').load('Z:\NewSitePagesContentAboutUsInfo.html
#OmicronChapter');
});
});
</script>
<a href="#" id="omicronchapterlink">About Us</a>
</div>
<div id="rightcol"></div>
|
Ajax loading image did not show before ajax content load; image and content load at the same div |
How about this , you don't need to wrap a change function inside
ajax_courses() just put it in ready and when onchange function is called
the loader image will be added in the ajax-content-container and when ajax
request is completed the ajax-content-container div will have the desired
content in a container .
Note Make sure Your loading image path is correct otherwise image will not
be shown
<script type="text/javascript">
$(document).ready(function () {
//ajax_courses();
ajax_sched();
ajax_status();
$('#select_id').change(function () {
$('#ajax-content-container').html('<img src="<?php echo
base_url()?>/img/ajax-loader.gif" width="200" height="200"
style="margin-left:450px; margin-top:300px;" />');
var course_id = $("#select_id").val();
var postData = {'course_id
|
I want to replace content inside a String which starts with # if it starts with !# it must skip it |
Use a negative lookbehind?
String test = "Hello #Admin Welcome this is Your welcome page !#Admin
This is #Admin";
String out = test.replaceAll("(?<!!)#Admin", "MyAdministrator");
System.out.println("OutPut: "+out);
The lookbehind is (?<!!).
|
How to load json models in three.js properly? |
I have made some brutal mistakes exporting JSON models. For all those who'r
having issues with exporting from Blender. I suggest you to check out your
exporting settings.
for me, it worked with following setup;
geometry:
Vertices: check, Faces: check, normals: check, skinning: check
Materials: check all
Settings: Flip YZ: check
Animation: Morph animation
and all mehses: check
|
PHP textarea content download not working properly |
I created two files, tarea.php (for the form) and download.php
tarea.php
<?php
session_start();
$_SESSION['Zone'] = 'test';
?>
<form action="download.php" method="post">
<textarea name="tarea"></textarea>
<input type="submit">
</form>
download.php
<?php
session_start();
if(isset($_POST['tarea'])){
$filename = $_SESSION['Zone'].'.zone';
$data = $_POST['tarea'];
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$filename");
header("Content-Type: application/octet-stream; ");
header("Content-Transfer-Encoding: binary");
echo $data;
exit;
}
?>
|
Getting Middle Column Content to Center Properly |
For this type of problem is better if you look at Twitter Bootstrap.
It's a library that contains css files already set up so you can do things
faster and they auto-resize and move around depending on the window width
and so forth.
Have a look here: http://twitter.github.io/bootstrap/
Next time also provide a code so that who looks at your problem can spot
what the error is and doesn't have to make it up by himself.
|
Tableview cells not resizing properly to content |
You need to dynamically calculate the height of your text and based on that
and the padding you want, adjust the height of the cell through the
following delegate method:
#define PADDING 10.0f
- (CGFloat)tableView:(UITableView *)t heightForRowAtIndexPath:(NSIndexPath
*)indexPath {
Subscription *sub = [_dictTask valueForKeyPath:@"subscription"];
NSArray *meta = sub.meta.allObjects;
NSString *text = [[meta objectAtIndex:indexPath.row]
valueForKey:@"sum_value"];
CGSize textSize = [text sizeWithFont:[UIFont systemFontOfSize:14.0f]
constrainedToSize:CGSizeMake(self.tableView.frame.size.width - PADDING * 3,
1000.0f)];
return textSize.height + PADDING * 3;
}
|
showing and hiding content using javascript properly |
You could pass a parameter in your onclick and then you need only once the
function:
FIDDLE
<tr><td onclick="check('tab4');" > Page
A</td><td>Content</td></tr>
<tbody id="tab4" style="display:none;" class="subpages_bg">
<tr><td>Page
A1</td><td>Content</td></tr>
<tr><td>Page
A2</td><td>Content</td></tr>
<tr><td>Page
A3</td><td>Content</td></tr>
<tr><td>Page
A4</td><td>Content</td></tr>
</tbody>
And you would only need 1 function:
function check(id) {
if (document.getElementById(id).style.display == "none") {
document.getElementById(id).style.display = "";
} else {
|
check box not working properly at page load |
This is because you have just wrote ONLY to uncheck the checkboxes in the
pageload and not to disable the controls behind the checkbox; If thats
needed, then your snippet in the pageload should be:
if (!Page.IsPostBack)
{
ChckOrdType.Checked = false;
ChkPlntPric.Checked = false;
ChkExcluBro.Checked = false;
......
.....
ddlOrdType.Enabled = false;
ddlPlntPric.Enabled = false;
ddlExcluBroker.Enabled = false;
.........
}
or
if (!Page.IsPostBack)
{
ChckOrdType.Checked = false;
ChkPlntPric.Checked = false;
ChkExcluBro.Checked = false;
......
.....
ChckOrdType_CheckChanged(sender,e);
chkPlntPric_CheckChanged(sender,e);
chkExcluBro_CheckChanged(sender,e);
...
}
|
Why cant I save and load these serialized variables properly? |
Your constructor misses the boolean and the int. It should be like this :
public classToSave(boolean done, int lvl, String s, int x, int y, Skill
parent, Item
item, int cost) {
this.done = done;
this.lvl = lvl;
...
}
|
Using javascript cant properly load Label BackgroundImage |
Open your browser debug panel, look at NETWORK and see if you get a 404
error on the image load. Also, an empty element with no dimensions will not
show a background image - so give it some content or size it with CSS.
|
Microsoft.VisualStudio.Web.PasteJson.JsonPackage did not load properly |
I had this problem as I had an older version of VS2012 Express (release on
Web Platform installer dated 15/08/2012).
Try installing 'Visual Studio 2012 Express for Web (Latest)' with release
date 22/10/2012 from the Microsoft Web Platform Installer.
That is all I did and I no longer get those messages.
|
Rake task failing to load :environment properly |
In a nutshell, Rails doesn't eager load models (or anything else) when
running rake tasks on Production.
The simplest way to work with a model is to require it when you begin the
rake task, and it should work as expected, in this case:
# explicitly require model
require 'application_wide_setting'
It's possible to eager load the entire rails app with:
Rails.application.eager_load!
However, you may have issues with some initializers (ie. devise)
|
Django manage.py test cannot load fixture properly |
When you run a test the initial_data fixtures will be loaded (by syncdb).
For me dumpdata works with the --natural argument, excluding the
contenttypes and then deleting some auth.permission entries manually that
only these remain:
{
"pk": 1,
"model": "auth.permission",
"fields": {
"codename": "add_permission",
"name": "Can add permission",
"content_type": [
"auth",
"permission"
]
}
},
{
"pk": 2,
"model": "auth.permission",
"fields": {
"codename": "change_permission",
"name": "Can change permission",
"content_type": [
"auth",
"permission"
]
}
},
{
"pk": 3,
"model": "auth.permission",
"fields": {
"codename": "delete
|
Username and Password Failing to load properly in website |
All I had to do was make sure that my loop goes back to the beginning of
the nested loop and use the .seek functionality and it loads all passwords
and try's them out.
import urllib, urllib2
user = open ('users.txt' , 'r')
password = open ('password.txt' , 'r')
for users in user:
password.seek(0)
for pass_list in password:
login_data = users + '
' + pass_list
print login_data
base_url = 'http://my-site.com'
#login action we want to post data to
response = urllib2.urlopen(base_url)
login_action = '/auth/login'
login_action = base_url + login_action
response = urllib2.urlopen(login_action, login_data)
response.read()
print response.headers
print response.getcode()
|
IIS URL Rewrite module: Url.Content() does not resolve CSS/Image path properly |
You said the line:
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" />
is resolved as
"http:// localhost/Photographer/Content/Site.css"
, which is absolutely correct this is how it would be resolved. Where does
your css lie, is the path for the image in css correct?
|
Content-Disposition file extension not properly working on Firefox |
Even if I am not sure why it worked, changing the addHeader Method to
setHeader fixed the issue.
response.setHeader("Content-Disposition: ", "attachment; filename=my" +
offerType + "Offers.csv");
|
Django application does not properly load Twitter bootstrap 3 modal |
I solved this issue by defining my modal code outside the ul tags, I put my
modal code just after start of the body tag and it worked for me.
This is my code
<!-- Modal 1 -->
<!-- define the sign up modal finished -->
<!-- sign up modal -->
<!-- Modal -->
<div class="modal fade" id="signup">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">TrackLeech Sign
Up</h4>
|
How to properly load and configure Spring beans from an external utility jar |
Two approaches by which you can solve this : (Please include the dependency
as part of pom.xml)
To manually include only the required utility beans into this new
application-context.xml with the path referring to those class paths.
That's the beauty of spring to create the selective bean only.
Have a properties file
(Include this in the new application-context.xml)
<context:property-placeholder location="WEB-INF/utility.properties"/>
<import resource="${application.path.of.utility.jar}"/>
And define path ao the utility jar
application.path.of.utility.jar=/utility/jar/path/application_context.xml
|
How do I properly size in relative layout so my content isn't stretching on larger devices? |
You should try nested Linear layout and thus using weights you may achieve
a flexible user interface, try this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="60dip" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView3"
android:layout_width="0dp"
android:la
|
How to - If using IE8 don't load web content |
Really you could do something javascript to hide the page, such as hiding
the content, or placing a div over it, but the best thing to do would be to
just let the user view the page regardless of how messed up it is. Many
people are often stuck using old web browsers, and this is especially true
on corporate networks. So those people may be unable to view your page at
all if you do this.
|
Load iOS tab content only once |
I believe if you invoke the method -loadView rather than your own instance
method, the view will remain loaded upon presentation and the duplication
of loading will not occur.
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html
|
load content into div |
Use preventDefault(); to disable the default behavior of an anchor tag
(linking to something).
$('#menu').on('click', 'li:not(.current) a', function (event) { //Add event
event.preventDefault();
...
});
|
Dynamically Load Content |
$('nav li a').click(function(e){
var pageurl = $(this).attr('href');
$('#wrap').load(pageurl);
e.preventDefault();
});
You need to add quotes around the attr and also stop the link from changing
page by adding preventDefault().
Edit:
I just noticed your selector is:
$('nav li a')
Are you sure it's not meant to be #nav or .nav (for ID or class)?
|
load menu div into the Content div not in new tab |
You cannot change div's content without javascript. You might want to use
jQuery - put the following script in the <head> tag:
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#menu a").click(function (e) {
var $this = $(this);
$("#" + $this.attr("target")).load($this.attr("href"));
e.preventDefault();// to make browser not follow the link
});
});
</script>
|
how to load content on settimeout |
Load is executed in async mode. You're probably trying to wait until load
finished to show .overlay. In order to do that you should execute show
inside complete handler
$('.overlay').load('page6.html', function() {
$('.overlay').show();
});
|
Load content into a div, default one |
Updated your fiddle: http://jsfiddle.net/EPvGf/1/
$(document).ready(function()
{
$('#menu').on('click','a',function()
{
// fade out all open subcontents
$('.pbox:visible').fadeOut();
// fade in new selected subcontent
$('.pbox[id='+$(this).attr('data-id')+']').fadeIn();
}).find('a:first').click();
});
Really all I did was click the first a when the page loads. Quick and
dirty.
Hide .pboxes on load: add to css .pbox { display:none; }. Fiddle:
http://jsfiddle.net/EPvGf/8/
|
Load content without refresh |
I want to implement new HTML5 history API (pushstate) function to enable
change content based on the url without header refresh.
pushState is there to allow you to change the url without loading a new
page.
Is there any simple way, to avoid url restructure and load whole content
using new HTML5 history API?
Changing the content is the job of DOM.
You can use XMLHttpRequest (or other Ajax techniques) to load new content
from the server (and then insert that into the page using DOM manipulation)
Generally, you should use the history API in combination with DOM
manipulation. You change the content of the page with DOM, then change the
URL to one that the server can use to generate the same page from scratch.
This means the page still works for users (including search engines) w
|
How to Dynamically load content |
EDIT: I have added a e.preventDefault() to the function as it was following
the link otherwise. Secondly, please see this fiddle as a demo, obviously
there is no content to load at the moment, but in the console in Chrome or
Firefox you should see it try to load the correct page.
http://jsfiddle.net/jqUxb/
You can use jQuery's .load() function to load a page into a div.
So your code would look something like:
$(document).ready(function(){
$("nav").delegate("a", "click", function(e) {
e.preventDefault();
var menuItem = $(this);
//remove "current" class
$("nav a").each(function(){
$(this).removeClass("current");
})
//flag the current menu-item as current:
$(menuItem).addClass("current");
//load the content:
$('#main-conte
|
Load content from one div into another div on click |
You can do this as below.
$('.title').on('click',function(){
$('#main-content').html($(this).html());
});
Fiddle Demo
|
Load content into TinyMCE |
The content of a textarea is enclosed within textarea tags like:
<textarea name="newsmsg" id="newsmsg" cols="80" rows="20" ><?=
htmlspecialchars($content); ?></textarea>
|
Ajax to load content of another php page |
first you must make all data with json on php file, include jquery on html
then use this code :
i hope it will help you
HTML
<form action="graph.php" method="get">
<input type="text" name="q" />
<input type="submit"/>
</form>
js
$("form").on("submit", function(){
$.get($('form').attr('action'), $('form').serialize(),
function(result) {
$("#txtHint").html(result);
},'json');
});
|
How to load JS in a dynamically loaded content? |
Yes, with event delegation. Say the following input is loaded in
dynamically:
<input type="button" value="click me" id="btnTest" />
To capture this elements click event, we'll bind the event to the container
of the element (in this example document) and listen for a click on that
element:
$(document).on('click', '#btnTest', function() {
console.log("You clicked dynamic content!");
});
Reference: http://api.jquery.com/on/
|