Search Results

Search found 5493 results on 220 pages for 'boost regex'.

Page 23/220 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Using Boost on ubuntu

    - by Dexter
    I've heard a lot of good comments about Boost in the past and thought I would give it a try. So I downloaded all the required packages from the package manager in Ubuntu 9.04. Now I'm having trouble finding out how to actually use the darn libraries. Does anyone know of a good tutorial on Boost that goes all the way from Hello World to Advanced Topics, and also covers how to compile programs using g++ on ubuntu?

    Read the article

  • Trying to link my project with Boost.Thread using CMake

    - by wowus
    When I link Boost.Thread to my boost_test executable, it gives me make[2]: *** No rule to make target `/usr/lib64/libboost_thread-mt.so', needed by `gogo/test/test_boost'. Stop. when I make it. Here's the offending CMake code, what am I doing wrong? add_executable(boost_test boost_test.cpp) add_test(boost_test boost_test) # Boost auto-links for MSVC, so we exclude it. if(CMAKE_COMPILER_IS_GNUCXX) target_link_libraries(test_boost #LINK_INTERFACE_LIBRARIES ${Boost_THREAD_LIBRARY} ) endif()

    Read the article

  • Iterating through boost ptr_vector

    - by Ockonal
    Hello, I have a ptr_vector list of my own objects. Something like this: boost::ptr_vector<SomeClass> *list; list.push_back(new SomeClass()>; ... BOOST_FOREACH(SomeClass *tempObj, list) // [x] { tempObj->... } >‘boost::ptr_vector<SomeClass>*’ is not a class, struct, or union type

    Read the article

  • Serialize boost array

    - by jules
    I would like to serialize a boost::array, containing something that is already serializable. If get this error: error C2039: 'serialize' : is not a member of 'boost::array<T,N>' I have tried to include the serialization/array.hpp header but it did not help. Is there another header to include ? According to the documentation I should be able to do that http://www.chuchusoft.com/serialization/doc/boost_types.html Thanks

    Read the article

  • boost::function function pointer to parameters?

    - by high6
    How does boost::function take a function pointer and get parameters from it? I want wrap a function pointer so that it can be validated before being called. And it would be nice to be able to call it like boost::function is with the () operator and not having to access the function pointer member. Wrapper func; func(5); //Yes :D func.Ptr(5) //Easy to do, but not as nice looking

    Read the article

  • C++ boost function overloaded template

    - by aaa
    I cannot figure out why this segment gives unresolved overloaded function error (gcc version 4.3.4 (Debian 4.3.4-6)): #include <algorithm> #include <boost/function.hpp> int main { typedef boost::function2<const int&, const int&, const int&> max; max m(static_cast<max>(&std::max<int>)); } can you help me, thanks

    Read the article

  • Missing A Detail About Boost (.lib files)

    - by bobber205
    Where do I find the lib files for linking my program when using some Boost libraries? Decided to try its threading functionality but I am getting Error 6 fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_42.lib' InterviewPractice after I include Error 6 fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_42.lib' InterviewPractice I can't find where to get the .lib files for proper linking on the boost website? Any tips? :)

    Read the article

  • [C++] Missing A Detail About Boost (.lib files)

    - by bobber205
    Where do I find the lib files for linking my program when using some Boost libraries? Decided to try its threading functionality but I am getting Error 6 fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_42.lib' InterviewPractice after I include Error 6 fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_42.lib' InterviewPractice I can't find where to get the .lib files for proper linking on the boost website? Any tips? :)

    Read the article

  • Passing template into boost function

    - by Ockonal
    template <class EventType> class IEvent; class IEventable; typedef boost::function<void (IEventable&, IEvent&)> behaviorRef; What is the right way for passing template class IEvent into boost function? With this code I get: error: functional cast expression list treated as compound expression error: template argument 1 is invalid error: invalid type in declaration before ‘;’ token

    Read the article

  • Building boost 1.42 on FreeBSD 6.3

    - by Ivan Perekluyev
    Hi, i need to build mapnik on freebsd 6.3, but port marked as 'broken', so i forced to build it from source. With boost 1.41 (which is in ports) mapnik doesn't build. somewhere in internet, i found that mapnik successfully builded with boost 1.42. So, i download patch from wiki.freebsd.org/BoostPortingProject andd apply it: wget http://alexanderchuranov.com/boost-port/boost-from-1.41-to-1.42-2010-02-16-17-11.diff cd /usr/ports patch -p0 -i ~/boost-from-1.41-to-1.42-2010-02-16-17-11.diff after that, i trying to install boost-all metaport, but its failed. cd devel/boost-all make install 2>&1 | tee build.log tail -n 100 build.log > short_build.log Build.log (attention, 5m !): dl.dropbox.com/u/7365614/build.log Short build log: http://paste.pocoo.org/show/224474/ Thanks!

    Read the article

  • codingBat repeatEnd using regex

    - by polygenelubricants
    I'm trying to understand regex as much as I can, so I came up with this regex-based solution to codingbat.com repeatEnd: Given a string and an int N, return a string made of N repetitions of the last N characters of the string. You may assume that N is between 0 and the length of the string, inclusive. public String repeatEnd(String str, int N) { return str.replaceAll( ".(?!.{N})(?=.*(?<=(.{N})))|." .replace("N", Integer.toString(N)), "$1" ); } Explanation on its parts: .(?!.{N}): asserts that the matched character is one of the last N characters, by making sure that there aren't N characters following it. (?=.*(?<=(.{N}))): in which case, use lookforward to first go all the way to the end of the string, then a nested lookbehind to capture the last N characters into \1. Note that this assertion will always be true. |.: if the first assertion failed (i.e. there are at least N characters ahead) then match the character anyway; \1 would be empty. In either case, a character is always matched; replace it with \1. My questions are: Is this technique of nested assertions valid? (i.e. looking behind during a lookahead?) Is there a simpler regex-based solution?

    Read the article

  • Regex to check if exact string exists including #

    - by Jayrox
    New question As suggested by Asaph in previous question: Regex to check if exact string exists I am looking for a way to check if an exact string match exists in another string using Regex or any better method suggested. I understand that you tell regex to match a space or any other non-word character at the beginning or end of a string. However, I don't know exactly how to set it up. Search String: #t String 1: Hello World, Nice to see you! #t String 2: Hello World, Nice to see you! String 3: #T Hello World, Nice to see you! I would like to use the search string and compare it to String 1, String 2 and String 3 and only get a positive match from String 1 and String 3 but not from String 2. Requirements: Search String may be at any character position in the Subject. There may or may not be a white-space character before or after it. I do not want it to match if it is part of another string; such as part of a word. For the sake of this question: I think I would do this using this pattern: /\b\#t\b/gi However, this is not returning the results as I would have expected. I am able to find the exact matches for normal strings (strings where # isn't present) using: /\b{$search_string}\b/gi Additional info: this will be used in PHP 5

    Read the article

  • Replacing specific HTML tags using Regex

    - by matthewpe
    Alright, an easy one for you guys. We are using ActiveReport's RichTextBox to display some random bits of HTML code. The HTML tags supported by ActiveReport can be found here : http://www.datadynamics.com/Help/ARNET3/ar3conSupportedHtmlTagsInRichText.html An example of what I want to do is replace any match of <div style="text-align:*</div> by <p style=\"text-align:*</p> in order to use a supported tag for text-alignment. I have found the following regex expression to find the correct match in my html input: <div style=\"text-align:(.*?)</div> However, I can't find a way to keep the previous text contained in the tags after my replacement. Any clue? Is it me or Regex are generally a PITA? :) private static readonly IDictionary<string, string> _replaceMap = new Dictionary<string, string> { {"<div style=\"text-align:(.*?)</div>", "<p style=\"text-align:(.*?)</p>"} }; public static string FormatHtml(string html) { foreach(var pair in _replaceMap) { html = Regex.Replace(html, pair.Key, pair.Value); } return html; } Thanks!

    Read the article

  • Problem with RegEx.Replace and trying to change a filename

    - by fraXis
    Hello, I am having a strange problem and I can't seem to figure it out. My filename is something like this: DER 1513016-3.020F.NCF. I want to be able to change it to: DER 1513016-3.020H.NCF Sometimes the filename can be this as well: DER 1513016-3.020F_NEW.NCF which would change to: DER 1513016-3.020H_NEW.NCF This is my code to do this: OpenFileDialog fDialog = new OpenFileDialog(); fDialog.Title = "Open"; fDialog.Filter = "NCF files (*.ncf)|*.ncf|All files (*.*)|*.*"; fDialog.InitialDirectory = @"C:\Program Files\"; if (fDialog.ShowDialog() == DialogResult.OK) { string newfilename; string fileext = Path.GetExtension(fDialog.FileName); newfilename = Regex.Replace(fDialog.FileName, "F.NCF", "H.NCF"); newfilename = Regex.Replace(fDialog.FileName, "F_NEW.NCF", "H_NEW.NCF"); } This is where things get wierd. The way the code works now, it will NOT change the filename to DER 1513016-3.020H.NCF If I comment out this line of code: //newfilename = Regex.Replace(fDialog.FileName, "F_NEW.NCF", "H_NEW.NCF"); it will work fine and the file will now become: DER 1513016-3.020H.NCF However, if I uncomment that line of code, the filename will not change to DER 1513016-3.020H.NCF. It will stay as DER 1513016-3.020F.NCF. Why is that line of code causing the routine to not change the filename? Thanks,

    Read the article

  • Limiting regex match

    - by DMIL
    Say I have this HTML fragment <td width="25%" style="text-align:right;" > <span style="font-family: Arial; font-size: 12px;"> <strong>Regular price:</strong></span> </td> <td width="25%" style="text-align:center;" > <span style="font-family: Arial; font-size: 12px;> <strong>11,100.00 USD</strong></span> </td> <td width="25%" style="text-align:right;" > <span style="font-family: Arial; font-size: 12px;"> <strong>Web price:</strong></span> </td> <td width="25%" style="text-align:center;" > <span style="font-family: Arial; font-size: 12px;> <strong>9,100.00 USD</strong></span> </td> How would I get the first amount (11,100.00) using regex? I tried /Regular price.+(\d[^\s]+)\sUSD/is but it's not working, it's returning '00'. Obviously I'm a newbie at regex and I'm hoping to get by without picking up a book. And I HAVE to use regex to parse this HTML because that particular site was designed by someone who doesn't know about classes or IDs.

    Read the article

  • .NET regex's not working - 1# check beginning of text entered #2 check structure

    - by Olly
    OK it has unfortunately been a while since I've used REGEX and I am struggling to wonder why its not working with my project. I have used Regex Tester which says my two tests are valid but when it comes to testing in my project they get rejected. 1) Check the text starts with certain characters [RegularExpression("(spAPP)",ErrorMessage = "Stored procedures must begin with spAPP")] This seems to accept spAPP on it's own, but not something like spAPPabcdef which I want it to. I am struggling to find the "Ignore rest of the text" attribute with REGEX. 2) A bit more complicated. I have certain naming conventions for AD groups, so an example would be "UK ROLE IT APPLICATION DEV ADMIN", up to the role name there are standards (so I need the "UK ROLE IT APPLICATION DEV" checked. [RegularExpression(@"((UK|FRANCE|GERMANY|USA)\s(ROLE)\s(IT|NON-IT)\s(APPLICATION)\s(DEV|TEST|LIVE))", ErrorMessage = "Please use AD naming standards.")] I think it might be the fact I am using () around all the words, but its easier to read in my code. The RegexTester I found seems to indicate that it's right, but again, in my .NET project, it rejects it. Thanks,

    Read the article

  • PHP Regex to remove nested form elements but not input elements

    - by that0n3guy
    I'm modifying a PHP script that I have and it is currently outputting a nested form. Something like: <form name="input" action="html_form_action.asp" method="get"> <p>stuff here here, this may or may not be in a div, script, etc..</p> <form name="input" action="html_form_action.asp" method="get"> <div>stuff here possibilly</div> Username: <input type="text" name="user" /> <input type="submit" value="Submit" /> </form> <p>otherstuff this may or may not be in a div, script, etc..</p> </form> Nested form's are a no-no (IE hates them and basically causes the form to stop working), so I need to remove the nested form lines, but not the form items. I need to remove the nested: <form name="input" action="html_form_action.asp" method="get"> and </form> but not the outer <form and </form> or the input or submit stuff. Is this possible to do with regex? Note, the reason I just want to regex out the form rather than find the problem is because I know it will take some significant re-working to get rid of the double form... the regex solution is quick for now.

    Read the article

  • C# Regex stops after first line matched

    - by JD Guzman
    Ok so I have a regex and I need it to find matches in a multiline string. This is the string I am using: Device Identifier: disk0 Device Node: /dev/disk0 Part of Whole: disk0 Device / Media Name: OCZ-VERTEX2 Media Volume Name: Not applicable (no file system) Mounted: Not applicable (no file system) File System: None Content (IOContent): GUID_partition_scheme OS Can Be Installed: No Media Type: Generic Protocol: SATA SMART Status: Verified Total Size: 240.1 GB (240057409536 Bytes) (exactly 468862128 512-Byte-Blocks) Volume Free Space: Not applicable (no file system) Device Block Size: 512 Bytes Read-Only Media: No Read-Only Volume: Not applicable (no file system) Ejectable: No Whole: Yes Internal: Yes Solid State: Yes OS 9 Drivers: No Low Level Format: Not supported Basically I need to separate each line into two groups with the colon as the separator. The regex I am using is: @"([A-Za-z0-9\(\) \-\/]+):([A-Za-z0-9\(\) \-\/]+).*" It does work but only picks up the first line and separates it into the two groups like I want but it stops at that point. I have tried the Multiline option but it doesn't make any difference. I must admit I am new to the regex world. Any help is appreciated.

    Read the article

  • PCRE/PHP regex not matching last "item"

    - by superbarney
    Here's a regex that I've cobbled up: /(.*={76}\s)?\s*(.*?)\s\-\-\s(\d{2}\/\d{2}\-\d{2}\s\d{2}:\d{2})\s\s(.*?)\s(http:\/\/service.*?)\s(\-{76})/is and here's the text I will be parsing: http://p.linode.com/7015 and here's the replacement for the matched text: <item>\n\t<title>$2</title>\n\t<pubDate>$pubDate</pubDate>\n\t<description>$4</description>\n\t<link>$5</link>\n</item>\n\n I have almost come up with a regex needed to parse a block of text into RSS 2.0 XML markup. I've tested it with RegExr and RegexBuddy and it works perfectly except for the last "item" where there is no line breaks after the link (Line 269). In short, the problem is the "iProperty" article in the text is not matched. Any regex gurus willing to help me troubleshoot what's wrong? I've tried /(.*={76}\s)?\s*(.*?)\s\-\-\s(\d{2}\/\d{2}\-\d{2}\s\d{2}:\d{2})\s\s(.*?)\s(http:\/\/service.*?)\s*(\-{76})/is Here's the output that I get: http://p.linode.com/7016 but that didn't work as I expected (i.e. a newline would be optional). Thanks!

    Read the article

  • Regex to ensure group match doesn't end with a specific character

    - by AJ
    I'm having trouble coming up with a regular expression to match a particular case. I have a list of tv shows in about 4 formats: Name.Of.Show.S01E01 Name.Of.Show.0101 Name.Of.Show.01x01 Name.Of.Show.101 What I want to match is the show name. My main problem is that my regex matches the name of the show with a preceding '.'. My regex is the following: "^([0-9a-zA-Z\.]+)(S[0-9]{2}E[0-9]{2}|[0-9]{4}|[0-9]{2}x[0-9]{2}|[0-9]{3})" Some Examples: >>> import re >>> SHOW_INFO = re.compile("^([0-9a-zA-Z\.]+)(S[0-9]{2}E[0-9]{2}|[0-9]{4}|[0-9]{2}x[0-9]{2}|[0-9]{3})") >>> match = SHOW_INFO.match("Name.Of.Show.S01E01") >>> match.groups() ('Name.Of.Show.', 'S01E01') >>> match = SHOW_INFO.match("Name.Of.Show.0101") >>> match.groups() ('Name.Of.Show.0', '101') >>> match = SHOW_INFO.match("Name.Of.Show.01x01") >>> match.groups() ('Name.Of.Show.', '01x01') >>> match = SHOW_INFO.match("Name.Of.Show.101") >>> match.groups() ('Name.Of.Show.', '101') So the question is how do I avoid the first group ending with a period? I realize I could simply do: var.strip(".") However, that doesn't handle the case of "Name.Of.Show.0101". Is there a way I could improve the regex to handle that case better? Thanks in advance.

    Read the article

  • Assign RegEx submatches to variables or map (C++/C)

    - by Michael
    I need to extract the SAME type of information (e.g. First name, Last Name, Telephone, ...), from numerous different text sources (each with a different format & different order of the variables of interest). I want a function that does the extraction based on a regular expression and returns the result as DESCRIPTIVE variables. In other words, instead of returning each match result as submatch[0], submatch[1], submatch[2], ..., have it do EITHER of the following: 1.) return std::map so that the submatches can be accessed via: submatch["first_name"], submatch["last_name"], submatch["telephone"] 2.) return a variables with the submatches so that the submatches can be accessed via: submatch_first_name, submatch_last_name, submatch_telephone I can write a wrapper class around boost::regex to do #1, but I was hoping there would be a built-in or a more elegant way to do this in C++/Boost/STL/C.

    Read the article

  • custom C++ boost::lambda expression help

    - by aaa
    hello. A little bit of background: I have some strange multiple nested loops which I converted to flat work queue (basically collapse single index loops to single multi-index loop). right now each loop is hand coded. I am trying to generalized approach to work with any bounds using lambda expressions: For example: // RANGE(i,I,N) is basically a macro to generate `int i = I; i < N; ++i ` // for (RANGE(lb, N)) { // for (RANGE(jb, N)) { // for (RANGE(kb, max(lb, jb), N)) { // for (RANGE(ib, jb, kb+1)) { // is equivalent to something like (overload , to produce range) flat<1, 3, 2, 4>((_2, _3+1), (max(_4,_3), N), N, N) the internals of flat are something like: template<size_t I1, size_t I2, ..., class L1_, class L2, ..._> boost::array<int,4> flat(L1_ L1, L2_ L2, ...){ //boost::array<int,4> current; class variable bool advance; L2_ l2 = L2.bind(current); // bind current value to lambda { L1_ l1 = L1.bind(current); //bind current value to innermost lambda l1.next(); advance = !(l1 < l1.upper()); // some internal logic if (advance) { l2.next(); current[0] = l1.lower(); } } //..., } my question is, can you give me some ideas how to write lambda (derived from boost) which can be bound to index array reference to return upper, lower bounds according to lambda expression? thank you much

    Read the article

  • GCC emits extra code for boost::shared_ptr dereference

    - by Checkers
    I have the following code: #include <boost/shared_ptr.hpp> struct Foo { int a; }; static int A; void func_shared(const boost::shared_ptr<Foo> &foo) { A = foo->a; } void func_raw(Foo * const foo) { A = foo->a; } I thought the compiler would create identical code, but for shared_ptr version an extra seemingly redundant instruction is emitted. Disassembly of section .text: 00000000 <func_raw(Foo*)>: 0: 55 push ebp 1: 89 e5 mov ebp,esp 3: 8b 45 08 mov eax,DWORD PTR [ebp+8] 6: 5d pop ebp 7: 8b 00 mov eax,DWORD PTR [eax] 9: a3 00 00 00 00 mov ds:0x0,eax e: c3 ret f: 90 nop 00000010 <func_shared(boost::shared_ptr<Foo> const&)>: 10: 55 push ebp 11: 89 e5 mov ebp,esp 13: 8b 45 08 mov eax,DWORD PTR [ebp+8] 16: 5d pop ebp 17: 8b 00 mov eax,DWORD PTR [eax] 19: 8b 00 mov eax,DWORD PTR [eax] 1b: a3 00 00 00 00 mov ds:0x0,eax 20: c3 ret I'm just curious, is this necessary, or it is just an optimizer's shortcoming? Compiling with g++ 4.1.2, -O3 -NDEBUG.

    Read the article

  • standard way to perform a clean shutdown with Boost.Asio

    - by Timothy003
    I'm writing a cross-platform server program in C++ using Boost.Asio. Following the HTTP Server example on this page, I'd like to handle a user termination request without using implementation-specific APIs. I've initially attempted to use the standard C signal library, but have been unable to find a design pattern suitable for Asio. The Windows example's design seems to resemble the signal library closest, but there's a race condition where the console ctrl handler could be called after the server object has been destroyed. I'm trying to avoid race conditions that cause undefined behavior as specified by the C++ standard. Is there a standard (correct) way to stop the server? So far: #include <csignal> #include <functional> #include <boost/asio.hpp> using std::signal; using boost::asio::io_service; extern "C" { static void handle_signal(int); } namespace { std::function<void ()> sighandler; } void handle_signal(int) { sighandler(); } int main() { io_service s; sighandler = std::bind(&io_service::stop, &s); auto res = signal(SIGINT, &handle_signal); // race condition? SIGINT raised before I could set ignore back if (res == SIG_IGN) signal(SIGINT, SIG_IGN); res = signal(SIGTERM, &handle_signal); // race condition? SIGTERM raised before I could set ignore back if (res == SIG_IGN) signal(SIGTERM, SIG_IGN); s.run(); // reset signals signal(SIGTERM, SIG_DFL); signal(SIGINT, SIG_DFL); // is it defined whether handle_signal can still be in execution at this // point? sighandler = nullptr; }

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >