replacement

What alignment guarantees can I expect for arrays in a struct?

Hi all, I've got a lightweight templated class that contains a couple of member objects that are very rarely used, and so I'd like to avoid calling their constructors and destructors except in the rare cases when I actually use them. To do that, I "declare" them in my class like this: template <class K, class V> class MyClass { publi...

Cufon - jQuery, Replace font color on click

Hello I am using cufon for some font replacement and jQuery to build a custom accordion. the code for my accordion is something like this: $(".acc-title").click(function () { //show something, hide something etc. }); Is it possible during the click event to change the color of the replaced (with cufon) font? something like: $...

BOOST_STATIC_ASSERT without boost

Since boost is forbidden in a company I work for I need to implement its functionality in pure C++. I've looked into boost sources but they seem to be too complex to understand, at least for me. I know there is something called static_assert() in the C++0x standart, but I'd like not to use any C++0x features. ...

Make one gsub call instead of five.

How can I replace this: lyrics = lyrics.gsub(/\n/,'').gsub(/^\{\"similar\": \[/, '').gsub(/\]\}$/, '').gsub(/^\{/, '').gsub(/\}$/, '') to something shorter and one gsub call? ...

SQL Replacement via table

Mysql question: I've got a table A with a column full of sentences. I've got another table B with two columns: words and abbreviations. I want to look through table A's column sentences and if a word from table B's word column matches then replace it with abbreviation. Hope that is clear. Case doesn't matter, I can deal with that. ...

Java, replacement for infinite loops?

I am making a program that shows cellular growth through an array. I have gotten it so when I press the start button, the array updates every 10 seconds in a while(true){} loop. The problem with that is I want to be able to stop the loop by pressing the pause button, but while in the loop, it wont let me use any of the controls. I need s...

Is there a better way to deal with reserved characters when parsing XML/JSON data on the iPhone?

The following code works, but it's ugly and creates a bunch of autoreleased objects. I'm using similar code for parsing reserved HTML characters as well (for quotes, & symbols, etc). I'm just wondering... Is there a cleaner way? NSString *result = [[NSString alloc] initWithString:userInput]; NSString *result2 = [result stringBy...

Regex Replace Between &quot; Encoding

I want to be able to replace style=&quot;STUFF&quot; I keep thinking that this is the correct REGEX: style=(&quot;)(?!&quot;)*(&quot;) But for some reason that won't match. Any ideas? ...

binary sed replacement

I was attempting to do a sed replacement in a binary file however I am beginning to believe that is not possible. Essentially what I wanted to do was similar to the following: sed -bi "s/\(\xFF\xD8[[:xdigit:]]\{1,\}\xFF\xD9\)/\1/" file.jpg The logic I wish to achieve is: scan through a binary file until the hex code FFD8, continue re...

How can I do the multiple replace in python?

As asked and answered in HERE, I need to replace '[' with '[[]', and ']' with '[]]'. I tried to use s.replace(), but as it's not in place change, I ran as follows to get a wrong anwser. path1 = "/Users/smcho/Desktop/bracket/[10,20]" path2 = path1.replace('[','[[]') path3 = path2.replace(']','[]]') pathName = os.path.join(path3, "*.txt...

h3 tag text/image replacement, does this hurt seo?

I'm trying to "replace" text with an image in all of my h3 tags. I want the image to be in the html to avoid multiple h3 classes as this is being done for a portfolio and there will be about 10 h3 tags on the page. My image is 156x44. My question is, will this be viewed as an attempt to hide, stuff keywords by google for seo purposes? If...

Iterative text replacement across multiple files?

Disclaimer: Not a programmer by trade, but I've messed around a little in the past. Problem: I have a CLI program that generates an output text file from a text file list of inputs. I have been manually changing inputs in the text file to view the changes in output; however, this is inefficient. I would like to define a range of inputs ...

Replacing backslashes in Python strings

I have some code to encrypt some strings in Python. Encrypted text is used as a parameter in some urls, but after encrypting, there comes backslashes in string and I cannot use single backslash in urllib2.urlopen. I cannot replace single backslash with double. For example: print cipherText '\t3-@\xab7+\xc7\x93H\xdc\xd1\x13G\xe1\xfb' ...

Cufon displays an artifact in Safari when letter-spacing CSS attribute is used

You can see this problem for a while at: http://www.hopplayground.com/ I'm trying to display a cufon headline and nav system. The font I'm using is a little too widely kerned, so I'm trying to push the letters closer together with letter-spacing in the CSS: h1, h2, h3 { margin: 0; padding: 0; font-family: "DIN 1451 Std", Trebu...

Page replacement algorithm simulation in Java

Is there utility program for Page replacement algorithm simulation in Java? ...

Bassistance Autocomplete Plugin - Search Page Replacement

Hi, i've setup an autocomplete field that searches my database which works fine: $("#autocomplete input#lookupAccount").autocomplete("lib/php/autocomplete_backend.php", { width: 300, selectFirst: false, delay: 250 }); When a user clicks on a result I want to refer them to another page depending on what they've been cl...

Javascript - Search/React for each result

So if you have the following string: "$(document).ready(function() {" There are three open parentheses "(" I know there is the good 'ol string.replace(/(/g, "replacement_string"); way of doing things, but lets just say that doesn't exist for this question. Now lets say I have a function that does replaces "(" with "?". Is there a way ...

Dynamically changing typeface / font in web page based on user choice

I know of various ways to dynamically alter web pages' typeface properties via JS/DHTML, or replacing text with Flash-rendered fonts (with sIFR or Cufon). However, I can't find any good examples of dynamically changing the typeface used on a web page depending on user choice - with, for example, the use of a dropdown box or text links (t...

sifr not replacing font

Hello, I am trying to use sIFR to replace the headlines (e.g. The Tour of A Lifetime) on this page: http://tanciltown.com/ten-chimneys/ The font I want to swap in is Verlag by hoefler & frere jones. I had this working the other day but it suddenly stopped working: the font does not replace. All the js/css/flash files are linked corre...

Serializing Object - Replacing Values

Hey Everyone, I've got a collection of around 20,000 objects that need to get persisted to my database. Now, instead of doing 20,000 insert statements, I want to pass all the records in using an XML parameter. As far as serializing the object and passing it into the procedure goes, I'm all set. However, I'm wondering if anyone has an...