Search Results

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

Page 19/395 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Write a SQL Query to replace values and include all the Dates.

    - by VJ
    Well I have this - Table DimDate- Date Table Employee- Id,Name,Points,Date Now the Employee table has points for everyday unless they did not come...so the Date does not have all the Dates entries... I mean for e.g in a week he did not come for 2 days the Employee table has only 5 rows...so I have this dimdate table which has all the dates till 2050 which I want to join with and add Zeros for the dates he does not have points. So I have written this query but does not work - Select E.EmployeeId,D.Date,isNull(E.Points,0) from DimDate D left join Employee E on D.Date between '01-01-2009'and '06-01-2009' where E.EmployeeId=1 The above query give multiple dates and I tried group by on Date but does not work.

    Read the article

  • preg_replace replacing with array

    - by Scott
    What I want to do is replace the "[replace]" in input string with the corresponding vaule in the replace array. The total number of values will change but there will always be the same number in the replace array as in input string. I have tried doing this with preg_replace and preg_replace_callback but I can't get the pattern right for [replace], I also tried using vsprintf but the % in <table width="100%"> was messing it up. All help is greatly appreciated! Replace Array: $array = array('value 1','value 2','value 3'); Input String $string = ' <table width="100%"> <tr> <td>Name:</td> <td>[replace]</td> </tr> <tr> <td>Date:</td> <td>[replace]</td> </tr> <tr> <td>Info:</td> <td>[replace]</td> </tr> </table> '; Desired Result <table width="100%"> <tr> <td>Name:</td> <td>value 1</td> </tr> <tr> <td>Date:</td> <td>value 2</td> </tr> <tr> <td>Info:</td> <td>value 3</td> </tr> </table>

    Read the article

  • POSIX AIO Library and Callback Handlers

    - by Charles Salvia
    According to the documentation on aio_read/write, there are basically 2 ways that the AIO library can inform your application that an async file I/O operation has completed. Either 1) you can use a signal, 2) you can use a callback function I think that callback functions are vastly preferable to signals, and would probably be much easier to integrate into higher-level multi-threaded libraries. Unfortunately, the documentation for this functionality is a mess to say the least. Some sources, such as the man page for the sigevent struct, indicate that you need to set the sigev_notify data member in the sigevent struct to SIGEV_CALLBACK and then provide a function handler. Presumably, the handler is invoked in the same thread. Other documentation indicates you need to set sigev_notify to SIGEV_THREAD, which will invoke the callback handler in a newly created thread. In any case, on my Linux system (Ubuntu with a 2.6.28 kernel) SIGEV_CALLBACK doesn't seem to be defined anywhere, but SIGEV_THREAD works as advertised. Unfortunately, creating a new thread to invoke the callback handler seems really inefficient, especially if you need to invoke many handlers. It would be better to use an existing pool of threads, similar to the way most network I/O event demultiplexers work. Some versions of UNIX, such as QNX, include a SIGEV_SIGNAL_THREAD flag, which allows you to invoke handlers using a specified existing thread, but this doesn't seem to be available on Linux, nor does it seem to even be a part of the POSIX standard. So, is it possible to use the POSIX AIO library in a way that invokes user handlers in a pre-allocated background thread/threadpool, rather than creating/destroying a new thread everytime a handler is invoked?

    Read the article

  • Noob boost::bind member function callback question

    - by shaz
    #include <boost/bind.hpp> #include <iostream> using namespace std; using boost::bind; class A { public: void print(string &s) { cout << s.c_str() << endl; } }; typedef void (*callback)(); class B { public: void set_callback(callback cb) { m_cb = cb; } void do_callback() { m_cb(); } private: callback m_cb; }; void main() { A a; B b; string s("message"); b.set_callback(bind(A::print, &a, s)); b.do_callback(); } So what I'm trying to do is to have the print method of A stream "message" to cout when b's callback is activated. I'm getting an unexpected number of arguments error from msvc10. I'm sure this is super noob basic and I'm sorry in advance.

    Read the article

  • jquery callback functions failing to finish execution

    - by calumbrodie
    I'm testing a jquery app i've written and have come across some unexpected behaviour $('button.clickme').live('click',function(){ //do x (takes 2 seconds) //do y (takes 4 seconds) //do z (takes 0.5 seconds) }) The event can be triggered by a number of buttons. What I'm finding is that when I click each button slowly (allowing 10 seconds between clicks) - my callback function executes correctly (actions x, y & z complete). However If I rapidly click buttons on my page it appears that the function sometimes only completes up to step x or y before terminating. My question: Is it the case that if this function is fired by a clicking second DOM element, while the first callback function is completing - will jQuery terminate the first callback and start over again? Do I have to write my callback function explicitly outside the event handler and then call it?? function doStuff() { //do x //do y //do z ( } $('button.clickme).live('click',doStuff()) If this is the case can someone explain why this is happening or give me a link to some advice on best practice on closures etc - I'd like to know the BEST way to write jQuery to improve performance etc. Thanks

    Read the article

  • Replace Listmenu with Textfield

    - by BRADINO
    Say you have a dropdown form field where you ask the user how they heard about you. You have numerous options and also an other field where if they selected other, then they enter the value in a text field. This is a cleaner alternative where if the user selects Other, then the dropdown turns into a textfield of the same name, so that your post routine, grooming, validation, writing to DB etc all works seamlessly. This example uses prototype JS library. Here is a working example: How did you hear about BRADINO? Select Google Yahoo MSN Other All you have to do is have an dropdown option for Other and then add call the function onchange: onchange="overrideListmenu('how-heard');" Here is the javascript function that uses Prototype: function overrideListmenu(field){         if ($F(field) == 'Other'){             Element.replace($(field), '<input name="'+field+'" id="'+field+'" type="text" value="">');                 $(field).focus();         } } Here is the javascript function that uses jQuery: function overrideListmenu(field){         if ($('#'+field).val() == 'Other'){             $('#'+field).after('<input name="'+field+'" id="'+field+'" type="text" value="">').remove();                 $('#'+field).focus();         } } listmenu replace textfield textfield for other how did you hear about us

    Read the article

  • JSONP callback method is not defined

    - by Micah
    I'm trying to get a jsonp callback working using jquery within a greasemonkey script. Here's my jquery: $.ajax({ url: "http://mydomain.com/MyWebService?callback=?", data: { authkey: "temphash" }, type: "get", dataType: "json", cache: false, success: function(data) { console.log(data); } }); in my webservice (asp.net) I'm returning the response with a content type of application/javascript. The response the server is actually sending back is: jsonp1276109314602({"message":"I'm getting tired of this not working"}) The jsonp1276109314602 method name is being randomly generated by jquery, and I'm grabbing it with Request.QueryString["callback"] However my success function is never called and the firebug console gives me an error saying jsonp1276109314602 is not defined. What am I doing wrong?

    Read the article

  • jQuery Star Rating plugin - select in callback causes infinite loop

    - by Ian
    Using the jQuery Star Rating plugin everything works well until I select a star rating from the rating's callback handler. Simple example: $('.rating').rating({ ... callback: function(value){ $.ajax({ type: "POST", url: ... data: {rating: value}, success: function(data){ $('.rating').rating('select', 1); } }); } }); I'm guessing this infinite loop occurs because the callback is fired after a manual 'select' as well. Once a user submits their rating I'd like to 'select' the average rating across all users (this value is in data returned to the success handler). How can I do this without triggering an infinite loop?

    Read the article

  • "Invalid Postback or callback argument" on modifying the DropDownList on the client side

    - by gnomixa
    I know why it's happening and i turned the validation on the page level, but is there a way to turn it off on the control level? "Invalid Postback or callback argument . Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %in a page. For security purposes, this feature verifies that arguments to Postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the Postback or callback data for validation."

    Read the article

  • Asynchronous Silverlight WCF callback

    - by Matt
    I've created my own WCF service and I've successfully been able to talk to it via my Silverlight client. I ran into an interesting problem on my asynchronous callbacks though. When my callback is invoked, I can't update any UI controls with the dreaded invalid cross thread access Here's what my callback function looks like private void GetTimeCallBack( object sender, Talk.ClientBase<IService>.ClientEventArgs e ) { lblDisplay.Text = e.Object.ToString(); } A quick google search showed me that I have to do this instead. private void GetTimeCallBack( object sender, Talk.ClientBase<IService>.ClientEventArgs e ) { Dispatcher.BeginInvoke( () => lblDisplay.Text = e.Object.ToString() ); } Now everything works fine, but I wasn't expecting my callback to be running on a different thread. Will I always have to use the Dispatcher class in order to modify anything within my class or is this just limited to UI elements? I've not familiar with the Dispatcher class at all so I'm looking to understand it more.

    Read the article

  • JavaScript replace with callback - performance question

    - by Tomalak
    In JavaScript, you can define a callback handler in regex string replace operations: str.replace(/str[123]|etc/, replaceCallback); Imagine you have a lookup object of strings and replacements. var lookup = {"str1": "repl1", "str2": "repl2", "str3": "repl3", "etc": "etc" }; and this callback function: var replaceCallback = function(match) { if (lookup[match]) return lookup[match]; else return match; } How would you assess the performance of the above callback? Are there solid ways to improve it? Would if (match in lookup) //.... or even return lookup[match] | match; lead to opportunities for the JS compiler to optimize, or is it all the same thing?

    Read the article

  • How to access the jQuery event object in a Seaside callback

    - by Mef
    Basically, I want to translate the following into Seaside Smalltalk: $(".myDiv").bind('click', function(e) { console.log(e); }); Besides that I don't want to console.log the event, but access it in my ajax callback. The most promising approach seemed to be something like html div onClick: (html jQuery ajax callback: [:v | self halt] value: (???); with: 'Foo'. But I couldn't find any way to access the event that caused the callback. Intuitively, I would try html jQuery this event for the ??? part, but the Seaside jQuery wrapper doesn't know any message that comes close to event. Any help is appreciated. There has to be away to access the event data...

    Read the article

  • Passing variables to callback functions

    - by mickyjtwin
    I am trying to write a jQuery plugin, that can be applied to a selector. Within this plugin, there are multiple calls to webservices, where callback methods are required. The problem I am having is maintaining the current context item in the each loop of the selector. (function($){ $.fn.myMethod = function(){ return this.each(function(){ var c = $(this); $.api.methodToCall("", CallbackFunction); }); }; function CallbackFunction(data, result){ // do stuff based on c } })(jQuery); Normally, you would provide the callback function straight away, which allows me to access c, however within the callback function, there potentially is another api call, so it would start to get messy. Is there any way to do this?

    Read the article

  • How to use xml response as XMLObject outside of ajax callback function

    - by Anthony
    Hopefully I've just made a dumb oversight, but I can't figure out why the following doesn't work: $(function() { var xml; $.get( "somexml.xml", function(data){ xml = data; }, "xml"); alert(xml); }); If I put the alert inside of the callback function, I get back object XMLdocument but if I place it outside of the ajax call, I get undefined. Since my goal is to have a new DOM to parse, I don't want the entire handling of the XMLdocument to be within the callback function. I've tried defining the variable outside of the entire onready function, inside at the top (like above) and inside the callback function, all with no luck. According to Specifying the Data Type for Ajax Requests in the jquery documentation, this should be possible.

    Read the article

  • What is the best way to expose a callback API - C++

    - by rursw1
    Hi, I have a C++ library that should expose some system\ resource calls as callbacks from the linked application. For example: the interfacing application (which uses this library) can send socket management callback functions - send, receive, open, close etc., and the library will use this implementation in stead of the library's implementation. (This way enables the application to manage the sockets by itself, can be useful). This library has to expose also more callbacks, like, for example, a password validation, so I wonder if there is a preferred method to expose the callback sending option in one API. Something like: int AddCallbackFunc (int functionCallbackType, <generic function prototype>, <generic way to pass some additional arguments>) Then within my library I will assign the callback to the appropriate function pointer according to the functionCallbackType parameter. Is there any way to implement it in a generic way which will fit ANY function prototype and ANY additional arguments? Your help will be more than appreciated... Thanks!

    Read the article

  • VB script + replace word only in specific line

    - by yael
    hi I find way to replace word in text file as the following strNewText = Replace(strText, "OLD_WORD", "NEW_WORD")t but this replace every OLD_WORD in the file my question is if it possible to replace the OLD_WORD with the NEW_WORD only on specific line for example I want to replace only on line that start with "THIS_LOCATION" THIS_LOCATION=OLD_WORD THX for help

    Read the article

  • Callback exception/error handling for ASP TreeView OnTreeNodePopulate?

    - by MHutchinson
    We're using an asp:TreeView configured with lazy loading. The callback method assigned for OnTreeNodePopulate throws an exception if the user has been logged out since the page was loaded. What we want to do is to direct the user to the login page. First attempt was to catch the exception on the server and try Response.Redirect(...), but that doesn't work because you can't redirect within a callback. I've tried various other approaches, including using ClientScript.RegisterStartupScript(...) but that doesn't seem to work for OnTreeNodePopulate. If there was some way we could hook into the callback event handling on the client side then it would be easy, but the TreeView doesn't seem to offer anything here. Suggestions?

    Read the article

  • does my js replace view?

    - by Milla Well
    I am writing a web application which is based on Codeigniter and jQuery. I primarily use ajax to call my controller functions and it turned out, that there are just 4 view*.php files, because most of my contoller functions return JSON data, which is processed in my jQuery. So my actual code is divided in kind of MVCC model: Codeigniter model (db, computations) Codeigniter controller (filtering, xss-cleaning, checking permissions, call model functions) jQuery controller (callback functions) jQuery view (adding/removing classes, appending elements,... ) So I violate the paradigm of not using the echo function in my Codeiginter controller and simply call echo json_encode($result); because it doesn't make any sense to me to create a view*.php file for one loc. Especially because all the regular view*.php stuff is covered in my jQuery view. I was wondering if I am missing something out, or if there is a way to integrate this jQuery-controller in my Codeigniter. I found some words on this topic, but this seems pretty handmade. Are there some neat solutions? Does a MVCC model make sense?

    Read the article

  • How To Replace Notepad in Windows 7

    - by Trevor Bekolay
    It used to be that Notepad was a necessary evil because it started up quickly and let us catch a quick glimpse of plain text files. Now, there are a bevy of capable Notepad replacements that are just as fast, but also have great feature sets. Before following the rest of this how-to, ensure that you’re logged into an account with Administrator access. Note: The following instructions involve modifying some Windows system folders. Don’t mess anything up while you’re in there! If you follow our instructions closely, you’ll be fine. Choose your replacement There are a ton of great Notepad replacements, including Notepad2, Metapad, and Notepad++. The best one for you will depend on what types of text files you open and what you do with them. We’re going to use Notepad++ in this how-to. The first step is to find the executable file that you’ll replace Notepad with. Usually this will be the only file with the .exe file extension in the folder where you installed your text editor. Copy the executable file to your desktop and try to open it, to make sure that it works when opened from a different folder. In the Notepad++ case, a special little .exe file is available for the explicit purpose of replacing Notepad.If we run it from the desktop, it opens up Notepad++ in all its glory. Back up Notepad You will probably never go back once you switch, but you never know. You can backup Notepad to a special location if you’d like, but we find it’s easiest to just keep a backed up copy of Notepad in the folders it was originally located. In Windows 7, Notepad resides in: C:\Windows C:\Windows\System32 C:\Windows\SysWOW64 in 64-bit versions only Navigate to each of those directories and copy Notepad. Paste it into the same folder. If prompted, choose to Copy, but keep both files. You can keep your backup as “notepad (2).exe”, but we prefer to rename it to “notepad.exe.bak”. Do this for all of the folders that have Notepad (2 total for 32-bit Windows 7, 3 total for 64-bit). Take control of Notepad and delete it Even if you’re on an administrator account, you can’t just delete Notepad – Microsoft has made some security gains in this respect. Fortunately for us, it’s still possible to take control of a file and delete it without resorting to nasty hacks like disabling UAC. Navigate to one of the directories that contain Notepad. Right-click on it and select Properties.   Switch to the Security tab, then click on the Advanced button. Note that the owner of the file is a user called “TrustedInstaller”. You can’t do much with files owned by TrustedInstaller, so let’s take control of it. Click the Edit… button. Select the desired owner (you could choose your own account, but we’re going to give any Administrator control) and click OK. You’ll get a message that you need to close and reopen the Properties windows to edit permissions. Before doing that, confirm that the owner has changed to what you selected. Click OK, then OK again to close the Properties window. Right-click on Notepad and click on Properties again. Switch to the Security tab. Click on Edit…. Select the appropriate group or user name in the list at the top, then add a checkmark in the checkbox beside Full control in the Allow column. Click OK, then Yes to the dialog box that pops up. Click OK again to close the Properties window. Now you can delete Notepad, by either selecting it and pressing Delete on the keyboard, or right-click on it and click Delete.   You’re now free from Notepad’s foul clutches! Repeat this procedure for the remaining folders (or folder, on 32-bit Windows 7). Drop in your replacement Copy your Notepad replacement’s executable, which should still be on your desktop. Browse to the two or three folders listed above and copy your .exe to those locations. If prompted for Administrator permission, click Continue. If your executable file was named something other than “notepad.exe”, rename it to “notepad.exe”. Don’t be alarmed if the thumbnail still shows the old Notepad icon. Double click on Notepad and your replacement should open. To make doubly sure that it works, press Win+R to bring up the Run dialog box and enter “notepad” into the text field. Press enter or click OK. Now you can allow Windows to open files with Notepad by default with little to no shame! All without restarting or having to disable UAC! Similar Articles Productive Geek Tips Search and Replace Specific Formatting (fonts, styles,etc) in Microsoft WordHow to Drag Files to the Taskbar to Open Them in Windows 7Customize the Windows 7 or Vista Send To MenuKill Processes from the Windows Command LineChange Your Windows 7 Library Icons the Easy Way TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 PCmover Professional Use My TextTools to Edit and Organize Text Discovery Channel LIFE Theme (Win7) Increase the size of Taskbar Previews (Win 7) Scan your PC for nasties with Panda ActiveScan CleanMem – Memory Cleaner AceStock – The Personal Stock Monitor

    Read the article

  • Can "go" replace C++? [closed]

    - by iammilind
    I was reading wiki article about "go" programming language, where Bruce Eckel states: The complexity of C++ (even more complexity has been added in the new C++), and the resulting impact on productivity, is no longer justified. All the hoops that the C++ programmer had to jump through in order to use a C-compatible language make no sense anymore --they're just a waste of time and effort. Now, Go makes much more sense for the class of problems that C++ was originally intended to solve. Can go really replace C++(11) for new development in future? How about generic programming? I don't know go , but the amount of time (in)wasted in learning C++ seems to go in vain.

    Read the article

  • Strategy for building an application to replace a large spreadsheet

    - by Dan Walmsley
    I'm working on an application that is going to replace a rather large spreadsheet. The spreadsheet is used to budget purchases and things like that. It is the largest spreadsheet I have ever seen, and it required a lot of manual data entry, so this application is going to automate much of that. But as I'm working on this I've noticed its slow going. And I got to thinking this must be a common thing to do many companies will start with something like a spreadsheet, then when they get too big to maintain that, they will get a custom application built. So is there anything out there ( a framework or similar ) that does this sort of thing, migrating a spreadsheet to a custom application. I've had a quick Google but not really seen the kind of thing that I'm looking for. It's too late for this project, but I thought it would be worth having a look for next time. How do you guys tackle this problem?

    Read the article

  • How to replace all images in Libreoffice with their description

    - by user30131
    I have a very long document containing lots of svg images created using the extension TexMaths. This extension uses the latex installation to create svg image of the inputted equation (or set of equations). The latex code for each equation (or set of equations) is embedded in the image as part of its Description. Such a Description can be accessed by right clicking the svg image and choosing the option Description. I want to replace all the svg images using a suitable macro, by the embedded descriptions. e.g. from The Einstein's famous equation, [svg embedded equation : E = mc 2], tells us that mass can be converted to energy and vice-versa. To The Einstein's famous equation, E = mc^2, tells us that mass can be converted to energy and vice-versa. This will allow me to convert by hand the odt file containing numerous TexMaths equations to LaTeX.

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >