Search Results

Search found 9872 results on 395 pages for 'preg replace callback'.

Page 28/395 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • YASR - Yet another search and replace question

    - by petronius31
    Environment: asp.net c# openxml Ok, so I've been reading a ton of snippets and trying to recreate the wheel, but I'm hoping that somone can help me get to my desination faster. I have multiple documents that I need to merge together... check... I'm able to do that with openxml sdk. Birds are singing, sun is shining so far. Now that I have the document the way I want it, I need to search and replace text and/or content controls. I've tried using my own text - {replace this} but when I look at the xml (rename docx to zip and view the file), the { is nowhere near the text. So I either need to know how to protect that within the doucment so they don't diverge or I need to find another way to search and replace. I'm able to search/replace if it is an xml file, but then I'm back to not being able to combine the doucments easily. Code below... and as I mentioned... document merge works fine... just need to replace stuff. protected void exeProcessTheDoc(object sender, EventArgs e) { string doc1 = Server.MapPath("~/Templates/doc1.docx"); string doc2 = Server.MapPath("~/Templates/doc2.docx"); string final_doc = Server.MapPath("~/Templates/extFinal.docx"); File.Delete(final_doc); File.Copy(doc1, final_doc); using (WordprocessingDocument myDoc = WordprocessingDocument.Open(final_doc, true)) { string altChunkId = "AltChunkId2"; MainDocumentPart mainPart = myDoc.MainDocumentPart; AlternativeFormatImportPart chunk = mainPart.AddAlternativeFormatImportPart( AlternativeFormatImportPartType.WordprocessingML, altChunkId); using (FileStream fileStream = File.Open(doc2, FileMode.Open)) chunk.FeedData(fileStream); AltChunk altChunk = new AltChunk(); altChunk.Id = altChunkId; mainPart.Document.Body.InsertAfter(altChunk, mainPart.Document.Body.Elements<Paragraph>().Last()); mainPart.Document.Save(); } exeSearchReplace(final_doc); } protected void exeSearchReplace(string document) { using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(document, true)) { string docText = null; using (StreamReader sr = new StreamReader(wordDoc.MainDocumentPart. GetStream())) { docText = sr.ReadToEnd(); } Regex regexText = new Regex("acvtClientName"); docText = regexText.Replace(docText, "Hi Everyone!"); using (StreamWriter sw = new StreamWriter(wordDoc.MainDocumentPart.GetStream(FileMode.Create))) { sw.Write(docText); } } } } }

    Read the article

  • I have a dead laptop, what are my options?

    - by Michael Kniskern
    After having my previous question answered by the HP technical support, I now have a HP laptop that does not work properly. HP recommended that I replace the motherboard and processor for a bargain price of $733 US dollars. I originally purchased this laptop back when the Windows Vista was released back in January 2007 for about $2,000 US dollar, but now is an very expensive paperweight. What are my options for this laptop? Do I try to revive it on my own.... What are your suggestions?

    Read the article

  • Disappearing Inlineshapes

    - by Rick
    I frequently edit files that have numerous inlineshapes, one per paragraph. One of the edits I make is to eliminate "double" paragraph marks either using Search and Replace or a simple macro that performs the same operation (e.g., search for "^p^p" and replace with "^p"). This operation works fine in Word 97-2003 documents (.doc), but when I try it on .docx documents, I lose all of the inlineshapes. The .docx files seem to ignore the inlineshape, therefore seeing the paragraphs containing them as "empty". Search and Replace sees "^p^p", replaces it with "^p", and the graphic goes away. Any thoughts on how to work around this?

    Read the article

  • Javascript string replace with calculations

    - by Chris
    Is there a way to resolve mathematical expressions in strings in javascript? For example, suppose I want to produce the string "Tom has 2 apples, Lucy has 3 apples. Together they have 5 apples" but I want to be able to substitute in the variables. I can do this with a string replacement: string = "Tom has X apples, Lucy has Y apples. Together they have Z apples"; string2 = string.replace(/X/, '2').replace(/Y/, '3').replace(/Z/, '5'); However, it would be better if, instead of having a variable Z, I could use X+Y. Now, I could also do a string replace for X+Y and replace it with the correct value, but that would become messy when trying to deal with all the possible in-string calculations I might want to do. I suppose I'm looking for a way to achieve this: string = "Something [X], something [Y]. Something [(X+Y^2)/5X]"; And for the [_] parts to be understood as expressions to be resolved before substituting back into the string. Thanks for your help.

    Read the article

  • Can I upgrade a Windows 2000 domain to 2008 and demote the 2000 server without clients attached?

    - by techie007
    Hi all, We're planning to replace a Windows 2000 domain controller with a new 2008 DC (new hardware). We've elected to take the route of getting the 2000 domain schema up-to-snuff, join the 2008 server, upgrade it to a DC, and after replication demote the 2000 server (eventually to be taken off-line). The goal being to not have to visit all the workstations, and limited domain down-time. :) We want bring the old server here and do all the backups, Domain prep, migration and role transfers here, and then (hopefully) just plop the new 2008 back in place after it's done, and join the 2000 server back as a member server (so we can then do folder migrations, etc.). Can this server work be done off-site, without the workstations attached? If we do this will anything need to be done to the clients, once the new DC is physically in place, so they contact the new 2008 DC; or will they just 'know' and continue on using the existing domain settings/user profiles, etc.? Thanks in advance! :)

    Read the article

  • Trigger a form submit from within an AJAX callback using jQuery

    - by Yarin
    I want to perform an ajax request right before my form is submitted. I want to trigger the form submit from my ajax callback, but when I try to trigger the submit, I get the following error: Uncaught TypeError: Property 'submit' of object # is not a function Here is the entire code: <form method="post" action="http://www.google.com" > <input type="text" name="email" id="test" size="20" /> <input id="submit" name="submit" type="submit" value="Submit" /> </form> <script> function do_ajax() { var jqxhr = $.get("#", function(){ $('form').submit(); }); } $(function() { $('#submit').click(function (e) { e.preventDefault(); do_ajax(); }); }); </script> Stumped.

    Read the article

  • Html5 - Callback when media is ready on iPad wont work

    - by Kap
    I'm trying to add a callback to a HTML5 audio element on an iPad. I added an eventlistener to the element, the myOtherThing() starts but there is no sound. If I pause and the play the sound again the audio starts. This works in chrome. Does anyone have an idea how I can do this? myAudioElement.src = "path_to_file"; addEventListener("canplay", function(){ myAudioElement.play(); myOtherThing.start(); }); SOLVED Just wanted to share my solution here, just in case someone else needs it. As far as I understand the iPad does not trigger any events without user interactions. So to be able to use "canply", "playing" and all the other events you need to use the built in media controller. Once you press play in that controller, the events gets triggered. After that you can use your custom interface.

    Read the article

  • Sending parameters to jquery callback

    - by KhanS
    I am making a jquery call from a javascript method. I want a parameter to be sent to my call back method. I am using a handler(ashx) to make jquery call, the handler is getting invoked by the callback is not getting fired. Below is the code function MyButtonClick(){ var myDiv = "divname"; $.post("MyHandler.ashx", { tgt: 1 }, myDiv, CustomCallBack); } function CustomCallBack(data, result) { debugger; //SomeCode } } Handler code(ashx file) public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int tgt = Convert.ToInt32(context.Request["tgt"]); if (tgt == 1) { context.Response.Write("Some text"); } }

    Read the article

  • Scrapy Not Returning Additonal Info from Scraped Link in Item via Request Callback

    - by zoonosis
    Basically the code below scrapes the first 5 items of a table. One of the fields is another href and clicking on that href provides more info which I want to collect and add to the original item. So parse is supposed to pass the semi populated item to parse_next_page which then scrapes the next bit and should return the completed item back to parse Running the code below only returns the info collected in parse If I change the return items to return request I get a completed item with all 3 "things" but I only get 1 of the rows, not all 5. Im sure its something simple, I just can't see it. class ThingSpider(BaseSpider): name = "thing" allowed_domains = ["somepage.com"] start_urls = [ "http://www.somepage.com" ] def parse(self, response): hxs = HtmlXPathSelector(response) items = [] for x in range (1,6): item = ScrapyItem() str_selector = '//tr[@name="row{0}"]'.format(x) item['thing1'] = hxs.select(str_selector")]/a/text()').extract() item['thing2'] = hxs.select(str_selector")]/a/@href').extract() print 'hello' request = Request("www.nextpage.com", callback=self.parse_next_page,meta={'item':item}) print 'hello2' request.meta['item'] = item items.append(item) return items def parse_next_page(self, response): print 'stuff' hxs = HtmlXPathSelector(response) item = response.meta['item'] item['thing3'] = hxs.select('//div/ul/li[1]/span[2]/text()').extract() return item

    Read the article

  • jquery calendarpicker callback pass querystring

    - by user577318
    Trying to use this CalendarPicker source and docs here: http://bugsvoice.com/applications/bugsVoice/site/test/calendarPickerDemo.jsp I need to be able to pass the date selected as query string variable of "searchdate" and reload page also updating current date for calendarPicker with querystring date on page reload. This is what I have so far: jQuery(document).ready(function() { var calendarPicker = jQuery("#calendarpicker").calendarPicker({ monthNames:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], years:0, months:6, days:5, showDayArrows:true, callback:function(cal) { // Simple output to test calendar date change jQuery("#output").html("Selected date: " + cal.currentDate.getFullYear()+"-"+cal.currentDate.getMonth()+"-"+cal.currentDate.getDate() ); // Not working well since it also includes arrows from datepicker as selectors jQuery(".calDay").children().click(function() { window.location.href="mysite.com?searchdate="+cal.currentDate.getFullYear()+"-"+cal.currentDate.getMonth()+"-"+cal.currentDate.getDate(); }); } }); Any help greatly appreciated. Can this be done with ajax? I am attempting to update a table of events by datepicker.

    Read the article

  • Regex replace (in Python) - a more simple way?

    - by Evan Fosmark
    Any time I want to replace a piece of text that is part of a larger piece of text, I always have to do something like: "(?P<start>some_pattern)(?P<replace>foo)(?P<end>end)" And then concatenate the start group with the new data for replace and then the end group. Is there a better method for this?

    Read the article

  • replace specefique codes in a script using through a tool

    - by Moudiz
    I have a script that contain random codes but I am searching for a way in notepad ++ or for a batch-file or any tool that can replace sepcifque codes, here is an example: Random If this equal that then you sould do this and do that therefore.. the code should be executed immediatly --stackb select * from user_error where object_name = name select * from user_error where table= randomly case 1 a = b else c=a --stacke Begin with the structure of the data and divide the codes end with what you know I want to replace the words between the comments stack b and stack a so the result will be like below Random If this equal that then you sould do this and do that therefore.. the code should be executed immediatly --stackb The codes here has been replaced, can you do that ? case 1 a = b else c=a --stacke Begin with the structure of the data and divide the codes end with what you know Is there a code in batch file or note pad ++ where I can acheive my result?

    Read the article

  • Select different parts of an line

    - by Ricardo Sa
    I'm new to regexes and have a file that looks like this one: |60|493,93|1,6500| |60|95,72|1,6500| |60|43,88|1,6500| |60|972,46|1,6500| I used the regex (\|60|.*)(1,65) and I was able to find all the lines that have the information that I wanted to changed. How can I make an replace that when Notepad++ finds (\|60|.*)(1,65), the 60 should be replaced with 50: |50|493,93|1,6500| |50|95,72|1,6500| |50|43,88|1,6500| |50|972,46|1,6500| PS: here's an example of the full line: |C170|002|34067||44,14000|KG|493,93|0|0|020|1102||288,11|12,00|34,57|0|0|0|0|||0|0|0|60|493,93|1,6500|||8,15|60|493,93|7,6000|||37,54||

    Read the article

  • Getting 'this' pointer inside dependency property changed callback

    - by mizipzor
    I have the following dependency property inside a class: class FooHolder { public static DependencyProperty CurrentFooProperty = DependencyProperty.Register( "CurrentFoo", typeof(Foo), typeof(FooHandler), new PropertyMetadata(OnCurrentFooChanged)); private static void OnCurrentFooChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FooHolder holder = (FooHolder) d.Property.Owner; // <- something like this // do stuff with holder } } I need to be able to retrieve a reference to the class instance in which the changed property belongs. This is since FooHolder has some event handlers that needs to be hooked/unhooked when the value of the property is changed. The property changed callback must be static, but the event handler is not.

    Read the article

  • Supervisor callback for child normal exit

    - by Aler
    I am creating a test app where is one supervisor with simple_one_for_one strategy and many worker children added dynamically to it. How to implement callback (or receive a message) in supervisor that will be called when child exit normally? Main goal is to notify some other process that all supervised worker processes are done and it's time to show final report. How to design such kind of behavior? Should I create my own behavior that combine supervisor and gen_server, or there is a way to do this with standard otp behaviors?

    Read the article

  • Replace between 2 items in observableArray - knockout

    - by Yojik
    im tring to Replace between 2 items in observableArray with knockout but something is wrong.. after the replace of the items ,i will change and send the displayOrder property (in both itmems) to the server (or should i take other approach for this) rankDownMessage: function () { console.log("ranking down msg"); var currentItemindex = viewModel.messages.indexOf(this); var nextItemIndex = currentItemindex + 1; viewModel.messages.replace( viewModel.messages()[nextItemIndex], viewModel.messages()[currentItemindex] ); } only the first item changed to the second item but the second item doesnt become the first one

    Read the article

  • Callback function doesn't work when using getJSON

    - by asilloo
    Hi, This is the code that I am using, When I write the link into the browser (I.E. or Mozilla) it is working like (MyFunc({"memes":[{"source":"http://www.knall......), but when I try to run it as HTML file I have a error in status Bar. what is the problem?. Thanks <head> <style>img{ height: 100px; float: left; }</style> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <div id="images"></div> <script>$.getJSON("http://tagthe.net/api/?url=http://www.knallgrau.at/en&view=json&callback=MyFunc",function(data){ alert(data); }); </script> </body>

    Read the article

  • Registering a delegate function with an ISO C++ callback (on mono)

    - by Stick it to THE MAN
    I am thinking of wrapping ISO C++ code in C# class. The only problem so far is how to deal with the C++ callbacks. In .Net languages (C# and Vb.Net), I believe the callback equivalent. Sticking with C# for now, can anyone recommend a way that I can register the C# delegate functions with my ISO C++ code. The ISO C++ code is a notification library, and I want to be able to "push" the notifications to the mono framework (i.e. C# delegates in this case). My underlying assumption is that the mechanism/steps to implement this would be the same for the .Net languages - I'll just have to code the actual delegates in the .Net language of choice - is that assumption correct? Last but not the least, is the question of thread saftey. The underlying ISO C++ code that I am exposing to .Net (mono to be more specific), is both re-ntrant and thread safe - do I have to do anything "extra" to call .Net delegate from my ISO C++ code?

    Read the article

  • Replace token in ANTLR

    - by user1019710
    I want to replace a token using ANTLR. I tried with TokenRewriteStream and replace, but it didn't work. Any suggestions? ANTLRStringStream in = new ANTLRStringStream(source); MyLexer lexer = new MyLexer(in); TokenRewriteStream tokens = new TokenRewriteStream(lexer); for(Object obj : tokens.getTokens()) { CommonToken token = (CommonToken)obj; tokens.replace(token, "replacement"); } The lexer finds all occurences of single-line comments, and i want to replace them in the original source too.

    Read the article

  • Delete the last instance of a certain string from a text file without changing the other instances o

    - by fraXis
    Hello, I have a C# program where I am using a lot of RegEx.Replace to replace text in my text file. Here is my problem. In my text file, I have a code such as "M6T1". This code is listed in numerous places in the text file. However, I only want to delete it from the bottom (last instance) in the text file. There will always be a "M6T1" at the bottom of the text file, but it is not always the last line. It could be the 3rd line from the bottom, the 5th line from the bottom etc. I only want to get rid of the last instance of "M6T1" so RegEx.Replace won't work here. I don't want to interfer with the other "M6T1"'s in the other locations in the text file. Can someone please give me a solution to this problem? Thanks

    Read the article

  • Quick Replace in Visual Studio 2010 fails to use Tagged Expression n

    - by slomojo
    I'm trying to do some basic regex Quick Replace operations in Visual Studio 2010, but when I use regex grouping I don't get Tagged Expressions (ie. \1 \2 etc.) returning their values, instead they are blank. For example: Text int a = int.Parse("10"); int b = int.Parse("20"); int c = int.Parse("30"); Search Pattern (regex enabled) int\.Parse\("([0-9]*)"\); Replace \1; Replaced Text int a = ; int b = ; int c = ;

    Read the article

  • Is it possible to edit a PDF file directly?

    - by rossmcm
    I have a PDF file that is produced as part of a help file compilation. There is always late breaking stuff which goes into a text file (e.g. "What's new in this version" type of stuff) and while Help and Manual allows you to include stuff from a text file it only works for the CHM output and not for the PDF. I'm wondering if I can do it by generating a unique placeholder string instead and then using some tool (I may need to write one) to do a search and replace of that unique string with the contents of the late breaking info text file. Is this feasible? Or will it break some sort of internal structure?

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >