Search Results

Search found 1506 results on 61 pages for 'replacement'.

Page 41/61 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Faster forking of large processes on Linux ?

    - by timday
    What's the fastest, best way on modern Linux of achieving the same effect as a fork-execve combo from a large process ? My problem is that the process forking is ~500MByte big, and a simple benchmarking test achieves only about 50 forks/s from the process (c.f ~1600 forks/s from a minimally sized process) which is too slow for the intended application. Some googling turns up vfork as having being invented as the solution to this problem... but also warnings about not to use it. Modern Linux seems to have acquired related clone and posix_spawn calls; are these likely to help ? What's the modern replacement for vfork ? I'm using 64bit Debian Lenny on an i7 (the project could move to Squeeze if posix_spawn would help).

    Read the article

  • How do I prove to a client/advertiser that my site's analytics numbers are what I say they are?

    - by Bryson
    I have been asked to provide recommendations on "Verified Analytics" for the next iteration of my company's site. Verified to mean that when we sell ad space, it's based on a number of page-views, and the people who buy that space want a way to verify that the numbers we give them are the actual numbers we're delivering. I have turned to The Google and the only services I can find for this sort of thing revolve around Google Analytics and the sale of a domain name. I export my analytics numbers to a PDF, have Google email the PDF to my auctioneer, and they look for signs of tampering. If no signs of tampering are found they put a little "Verified" badge on the domain auction. (Here) Other than this, and something similar on another domain sales site, I haven't found anything like what I've been asked to find. Currently we are using Google Analytics, however I've been also asked to recommend a replacement for that based on the ability to be verified. I'd rather just stick with Google Analytics since we also use Google for advertising.

    Read the article

  • mysql query - syntax error - cannot find out why

    - by Phil Jackson
    Hi all, im taring my hair out over this one. A query is throwing an error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM, SUBJECT, DATE, READ, MAIL ) VALUES ( 'EJackson', 'dfdf', '1270974101', 'fa' at line 1 I printed out the query to see what could be the problem: INSERT INTO db.tablename ( FROM, SUBJECT, DATE, READ, MAIL ) VALUES ( 'EJackson', 'dfdf', '1270974299', 'false', 'dfdsfdsfd' ) and finaly the structure consists of: CREATE TABLE db.tablename ( `ID` int(12) NOT NULL auto_increment, `FROM` varchar(255) NOT NULL, `SUBJECT` varchar(255) NOT NULL, `DATE` varchar(255) NOT NULL, `READ` varchar(255) NOT NULL, `MAIL` varchar(255) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; I cant find anything wrong. Any Help would be much appreciated. ( db.tablename is a replacement for the actual tablename )

    Read the article

  • Assign multiple Emacs keybindings to a single command?

    - by Dan
    I'm giving ErgoEmacs mode a try to see if I can use Emacs more comfortably. Some of its keybindings are fairly intuitive, but in many cases I don't want to outright replace the defaults. For example, in the context of ErgoEmacs' navigation shortcut structure, M-h makes sense as a replacement for C-a--but I want to be able to use both, not just M-h. I tried simply duplicating the commands: ;; Move to beginning/ending of line (defconst ergoemacs-move-beginning-of-line-key (kbd "C-a")) ; original (defconst ergoemacs-move-end-of-line-key (kbd "C-e")) ; original (defconst ergoemacs-move-beginning-of-line-key (kbd "M-h")) ; ergoemacs (defconst ergoemacs-move-end-of-line-key (kbd "M-H")) ; ergoemacs But Emacs simply overwrites the first keybinding with the second. What's the best way to address this?

    Read the article

  • Url open encoding

    - by badc0re
    I have the following code for urllib and BeautifulSoup: getSite = urllib.urlopen(pageName) # open current site getSitesoup = BeautifulSoup(getSite.read()) # reading the site content print getSitesoup.originalEncoding for value in getSitesoup.find_all('link'): # extract all <a> tags defLinks.append(value.get('href')) The result of it: /usr/lib/python2.6/site-packages/bs4/dammit.py:231: UnicodeWarning: Some characters could not be decoded, and were replaced with REPLACEMENT CHARACTER. "Some characters could not be decoded, and were " And when i try to read the site i get: ?7?e????0*"I??G?H????F??????9-??????;??E?YÞBs????????????4i???)?????^W?????`w?Ke??%??*9?.'OQB???V??@?????]???(P??^??q?$?S5???tT*?Z

    Read the article

  • Ruby on Rails: What are Erubis' disadvantages and why isn't it packaged with Rails by default? How t

    - by williamjones
    I just discovered Erubis, a replacement for the default view renderer for Ruby on Rails. However, from what I can tell from reading about it, it's superior across the board. It is much faster. It has many more options. It can prevent cross site scripting without having to use h. Does this have any disadvantages versus the standard erb renderer? Why isn't this the standard renderer packaged with Rails? Also, the docs for Erubis say to install it just by installing the gem, and then add the following to environment.rb: require 'erubis/helpers/rails_helper' #Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby Reading the docs, FastEruby seems to be just a faster renderer than Eruby. Why wouldn't it be default and used by everyone? I'm highly interested in using the engine erubis::EscapedEruby which automatically calls h to escape html on fields from the database. Are there any gotchas I should be aware of or does this pretty much solve all cross site scripting?

    Read the article

  • Replace repeating character with array elements in PHP

    - by Will Croft
    I hope this is blindingly obvious: I'm looking for the fastest way to replace a repeating element in a string with the elements in a given array, e.g. for SQL queries and parameter replacement. $query = "SELECT * FROM a WHERE b = ? AND c = ?"; $params = array('bee', 'see'); Here I would like to replace the instances of ? with the corresponding ordered array elements, as so: SELECT * FROM a WHERE b = 'bee' and c = 'see' I see that this might be done using preg_replace_callback, but is this the fastest way or am I missing something obvious?

    Read the article

  • How do I get bison/flex to restart scanning after something like token substitution?

    - by chucknelson
    Is there a way to force bison and/or flex to restart scanning after I replace some token with something else? My particular example would be with replacement for a specific word/string. If I want a word of hello to be replaced by echo hello, how can I get flex or bison to replace hello and then start parsing again (to pick up 2 words instead of just one). So it would be like: Get token WORD (which is a string type) If hello, replace token value with echo hello Restart parsing entire input (which is now echo hello) Get token WORD (echo) Get token WORD (hello) I've seen very tempting functions like yyrestart(), but I don't really understand what that function in particular really accomplishes. Any help is greatly appreciated, thanks!

    Read the article

  • Is there a way put a timestamp in the file header automatically when saving in Eclipse?

    - by George
    I am a PHP developer using Eclipse PDT. I would like a timestamp put automatically in my file headers whenever I save the file. Maybe as a replacement of a variable. Let's say I use this header in a file: /** * ${filename} * ${timestamp} */ When I save the file I would this to be replaced with: /** * Myfile.php * 4/20/2010 19:04 */ It would also be ok if there is a macro that would add a line at the very beginning of the file just containing a timestamp. Anybody with an idea? Regards, George

    Read the article

  • Direct video card access

    - by icemanind
    Guys, I am trying to write a class in C# that can be used as a direct replacement for the C# Bitmap class. What I want to do instead though is perform all graphic functions done on the bitmap using the power of the video card. From what I understand, functions such as DrawLine or DrawArc or DrawText are primitive functions that use simple cpu math algorithms to perform the job. I, instead, want to use the graphics card cpu and memory to do these and other advanced functions, such as skinning a bitmap (applying a texture) and true transparancy. My problem is, in C#, how do I access direct video functions? Is there a library or something I need?

    Read the article

  • How to output floating point numbers with a custom output format in C++?

    - by Victor Liu
    The problem is that I want to output Mathematica compatible floating point numbers. The only difference with the standard IOStream or printf output format is that the exponential e is replaced by *^: Standard C/C++ output format: 1.23e-4 Mathematica format: 1.23*^-4 Is there a way to manipulate streams to achieve this effect? My original idea was just to use istringstream and dump it to a string and then replace all the e's. I would also be okay if someone posted code to parse through the bits of the floating point number and output it directly (i.e. a printf("%e") replacement).

    Read the article

  • Is it possible to preg replace unique variables into a string?

    - by Scarface
    What I want to do is use preg replace to replace matches within a string with a varying replacement, and I was wondering if anyone knew if that is possible in php or at least achievable by some means. For example, a string has two matches, then those matches will be replaced with two different variables. What I want are replacements to each be a unique id and I cannot figure out how this could possibly work or if php could even do this. For example if the match is 'a' and there is a sentence, 'put a smile on a person' then one 'a' will be unique id 98aksd00 and the other will be 09alkj08. I am retrieving my comments from a database so the preg replace is happening within while ($row=mysql_fetch_assoc($query)){ //preg replace If anyone could provide any insight into this, I would really appreciate it

    Read the article

  • Which external DSLs do you like to use?

    - by Max Toro
    The reason I'm asking is because right now there seems to be tendency to make DSLs internal. One example is LINQ in C# and VB. You can use it against in-memory objects, or you can use it as a replacement of SQL or other external DSL. Another example is HTML5 vs XHTML2. XHTML2 supported decentralized extensibility through namespaces, in other words you embed external DSL code (XForms, SVG, MathML, etc.) in your XHTML code. Sadly HTML5 doesn't seem to have such mechanism, instead new features are internal (e.g. <canvas> instead of SVG). I'd like to know what other developers think about this. Do you like using external DSLs ? Which ones ? If not, why ?

    Read the article

  • Converting "User Shell Folders" registry value

    - by Sach
    The following registry key contains many system default folder locations. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders The value for the path of the All Users desktop, which is found there, is as follows: XP or earlier : [%ALLUSERSPROFILE%\Desktop] Vista or later: [%PUBLIC%\Desktop] Whereas the actual paths of the All User desktops, respectively, are as follows: XP or earlier : "C:\Documents and Settings\All Users\Desktop" Vista or later: "C:\Users\Public\Desktop" Now, if you use copy and paste the above registry values in Windows Explorer and hit enter it takes you to the actual folders. For example, if you paste [%PUBLIC%\Desktop] in a Windows Explorer in Vista it takes you to ["C:\Users\Public\Desktop"]. My question is this; how do I reproduce this behavior from withing a C# program? To be more specific, if I retrieve the registry value [%PUBLIC%\Desktop] from withing a C# program, which I can do easily, how do I convert it to ["C:\Users\Public\Desktop"]? Obviously I'm not looking for a string replacement, I need to do what Windows does.

    Read the article

  • Using Apache Velocity with StringBuilders/CharSequences

    - by mindas
    We are using Apache Velocity for dynamic templates. At the moment Velocity has following methods for evaluation/replacing: public static boolean evaluate(Context context, Writer writer, String logTag, Reader reader) public static boolean evaluate(Context context, Writer out, String logTag, String instring) We use these methods by providing StringWriter to write evaluation results. Our incoming data is coming in StringBuilder format so we use StringBuilder.toString and feed it as instring. The problem is that our templates are fairly large (can be megabytes, tens of Ms on rare cases), replacements occur very frequently and each replacement operation triples the amount of required memory (incoming data + StringBuilder.toString() which creates a new copy + outgoing data). I was wondering if there is a way to improve this. E.g. if I could find a way to provide a Reader and Writer on top of same StringBuilder instance that only uses extra memory for in/out differences, would that be a good approach? Has anybody done anything similar and could share any source for such a class? Or maybe there any better solutions to given problem?

    Read the article

  • Create a new output file in ant replace task

    - by Sathish
    Ant replace task does a in-place replacement without creating a new file. The below snippet replaces tokens in any of the *.xml files with the corresponding values from my.properties file. <replace dir="${projects.prj.dir}/config" replacefilterfile="${projects.prj.dir}/my.properties" includes="*.xml" summary="true"/'> I want those *.xml files that had their tokens replaced be created as *.xml.filtered (for e.g.) and still have the original *.xml. Is this possible in Ant with some smart combination of tasks and concepts ?

    Read the article

  • WCF for the totally clueless

    - by Kyralessa
    I've been hearing about WCF for a couple of years now, and I still don't get it. I understand that it's supposed to be a replacement for web services, remoting, MSMQ, and a few other things. The trouble is, every tutorial I find assumes that I've done one of those things, and it tends to follow the line of "Here are the differences; you know the rest." But I don't know the rest! So: Do you know of any tutorial articles, books, etc. that assume that the reader knows C# or VB .NET, but nothing about web services, MSMQ, remoting, and all those other technologies that WCF replaces?

    Read the article

  • Performance characteristics of pthreads vs ucontext

    - by Robert Mason
    I'm trying to port a library that uses ucontext over to a platform which supports pthreads but not ucontext. The code is pretty well written so it should be relatively easy to replace all the calls to the ucontext API with a call to pthread routines. However, does this introduce a significant amount of additional overhead? Or is this a satisfactory replacement. I'm not sure how ucontext maps to operating system threads, and the purpose of this facility is to make coroutine spawning fairly cheap and easy. So, question is: Does replacing ucontext calls with pthread calls significantly change the performance characteristics of a library?

    Read the article

  • c#, can you think of anymore optimization in this code?

    - by Sha Le
    Hi All: Look at the following code: StringBuilder row = TemplateManager.GetRow("xyz"); // no control over this method StringBuilder rows = new StringBuilder(); foreach(Record r in records) { StringBuilder thisRow = new StringBuilder(row.ToString()); thisRow.Replace("%firstName%", r.FirstName) .Replace("%lastName%", r.LastName) // all other replacement goes here .Replace("%LastModifiedDate%", r.LastModifiedDate); //finally append row to rows rows.Append(thisRow); } Currently 3 StringBuilders and row.ToString() is inside a loop. Is there any room for further optimization here? Thanks a bunch. :-)

    Read the article

  • Looking for a file database

    - by Mitchell Skurnik
    A few years ago there was a PHP script around called paFileDB. Essentially it created a database of files that end users could download and rate. It would keep track of the number of downloads as well. I am looking for a replacement of this coded in ASP.net C#. For the last week I have been searching around for "asp.net C# file database" and have just gotten how to upload files to a database. I have also search with some other terms. I do not need a full blown CMS like DotNetNuke or SharePoint. All I have been looking for is a system I could easily add to my existing .net C# site. I have thought about coding one myself, but with me being rather busy at work and this being a personal project, I simply do not have the time to code this myself. I hope that you guys can help. Thank you!

    Read the article

  • Is there a shorthand version of HTML available?

    - by monguin
    I remember reading an article about a shorthand version, or extension, of HTML a few months ago. Its purpose was to make HTML code significantly more concise, by removing end tags, and it may have allowed loops of some sort as well. I want to use it now, but I can't seem to remember what it was called. Searching online, I found HAML, but HAML syntax doesn't look like the example that I remember from the article. The syntax from the article made use of right angle brackets, which were a sort of replacement for indentation. Can anyone identify this language?

    Read the article

  • How do I convert from a possibly Windows 1252 'ANSI' encoded uploaded file to UTF8 in .NET?

    - by qqq123
    I've got a FileUpload control in an ASP.NET web page which is used to upload a file, the contents of which (in a stream) are processed in the C# code behind and output on the page later, using HtmlEncode. But, some of this output is becoming mangled, specifically the symbol '£' is output as the Unicode FFFD REPLACEMENT CHARACTER. I've tracked this down to the input file, which is Windows 1252 ('ANSI') encoded. The question is, How do I determine whether the file is encoded as 1252 or UTF8? It could be either, and How do I convert it to UTF8 if it is in Windows 1252, preserving the symbol £ etc? I've looked online but cannot find a satisfactory answer.

    Read the article

  • How to interrupt a waiting C++0x thread?

    - by doublep
    I'm considering to use C++0x threads in my application instead of Boost threads. However, I'm not sure how to reimplement what I have with standard C++0x threads since they don't seem to have an interrupt() method. My current setup is: a master thread that manages work; several worker threads that carry out master's commands. Workers call wait() on at least two different condition variables. Master has a "timed out" state: in this case it tells all workers to stop and give whatever result they got by then. With Boost threads master just uses interrupt_all() on a thread group, which causes workers to stop waiting. In case they are not waiting at the moment, master also sets a bool flag which workers check periodically. However, in C++0x std::thread I don't see any replacement for interrupt(). Do I miss something? If not, how can I implement the above scheme so that workers cannot just sleep forever?

    Read the article

  • Check if a string substitution rule will ever generate another string.

    - by Mgccl
    Given two strings S and T of same length. Given a set of replacement rules, that find substring A in S and replace it with string B. A and B have the same length. Is there a sequence of rule application, such that it make string S into string T? I believe there is no better way to answer this than try every single rule in every single state. Which would be exponential time. But I don't know if there are better solutions to it.

    Read the article

  • REGEX to extract word connected to nearest semicolon?

    - by John Kaybern
    I'm attempting to extract a series of data values from a text file. The values are in the format: <MODIFIER NAME1 VALUE; MODIFIER NAME2 VALUE;> For the purposes of the current task that I have, I only care about extracting the VALUE that is situated next to each semicolon. What would the REGEX command look like that would isolate each of these VALUES (preferably so that I backreference all values in the replacement part of my processing.) I believe that ^(.*?); is somehow used, but I'm not seeing how to isolate only the word that is attached to the semicolon in a group for backreference use. Thanks!

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >