Search Results

Search found 4763 results on 191 pages for 'adams john'.

Page 136/191 | < Previous Page | 132 133 134 135 136 137 138 139 140 141 142 143  | Next Page >

  • django update object

    - by John
    Hi, How do I run an update and select statement on the same queryset rather than having to do 2 querys, ones to select the object and one to update the object? the sql would be something like update my_table set field_1 = 'some value' where pk_field = some_value Thanks

    Read the article

  • Localizing validation (error) messages in Grails

    - by John
    Hi, I try to localize error messages from the Domain classes. This is possible with the default error messages, e.g.: default.blank.message=Property [{0}] cannot be blank and localized attribute names, e.g.: customer.address.label=Customer address Where "Customer" is my domain class and address is its attribute. My problem is that I can't localize some attributes because I need specific error messages. E.g: has.to.be.a.number=Property [{0}] has to be a number contingent.size.label=Contingent size. But the message I get is "Property [size] has to be a number" instead of "Property [Contingent size] has to be a number". The messages I cant localize are following: - Property [{0}] has to be a number - Property [{0}] has to be a valid date // I can't use g:datePicker in this context

    Read the article

  • prevent onmouseout when hovering child element of the parent absolute div

    - by John
    Hi I am having trouble with the onmouseout function in a absolute positoned div. When the mouse hits a child element in the div, the mouseout event fires, but I do not want it to fire until the mouse is out of the parent, absolute div. How can I prevent the mouseout event from firing when it hits a child element WITHOUT jquery. I know this has something to do with event bubbling, but I am having no luck on finding out how to work this out. A similar post I found here: How to disable mouseout events triggered by child elements? How ever that solution uses jquery.

    Read the article

  • Is external JavaScript source available to scripting context inside HTML page?

    - by John K
    When an external JavaScript file is referenced, <script type="text/javascript" src="js/jquery-1.4.4.min.js"></script> is the JavaScript source (lines of code before interpretation) available from the DOM or window context in the current HTML page? I mean by using only standard JavaScript without any installed components or tools. I know tools like Firebug trace into external source but it's installed on the platform and likely has special ability outside the context of the browser sandbox.

    Read the article

  • jQuery .ajax method executing but not firing error (or success)

    - by John Swaringen
    I'm having a very strange situation. I have a .NET Web Service (.asmx) that I'm trying to call via jQuery ajax to populate some <select></select>'s. The service is running System.Web.Services like it's supposed to and should be returning a JSON list. At least that's the way I understand that it will in .NET 3.5/4.0. The main problem is that the .ajax() function (below) seems to execute but the internal callbacks aren't executing. I know it's executing because I can do something before and after the function and both execute, so JavaScript isn't blowing up. $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: 'http://localhost:59191/AFEDropDownService/Service.asmx/GetAVP', data: "{}", dataType: "jsonp", crossDomain: true, success: function(list) { console.log(list); console.log("success!!"); }, error: function(msg) { console.log("error: " + msg.text); } }); If you need more of the code let me know. Or if you know a better way as I'm trying to build cascading <select></select's.

    Read the article

  • How to stop a MFC/win32 control re-painting

    - by John
    I have a CRichEditCtrl, and an algorithm works on its contents in-place, iterating through the contents and making changes. This seems to cause it to re-paaint every time, which causes flickering and a noticeable time to complete the operation, especially if the control starts scrolling. I wondered if there's a neat way for me to stop it repainting for a period. It's actually a custom subclass of CRichEditCtrl in use so I was thinking something like: void MyCustomEditCtrl::DoAlgorithm() { enableRepaint(false); ... //to the actual work ... enableRepaint(true); } What's the neatest approach? A custom on-paint handler which does nothing when an operation is in progress? Or can repainting actually be disabled?

    Read the article

  • How can I delete a file in Sinatra after it has been sent via send_file?

    - by John Reilly
    I have a simple sinatra application that needs to generate a file (via an external process), send that file to the browser, and finally, delete the file from the filesystem. Something along these lines: class MyApp < Sinatra::Base get '/generate-file' do # calls out to an external process, # and returns the path to the generated file file_path = generate_the_file() # send the file to the browser send_file(file_path) # remove the generated file, so we don't # completely fill up the filesystem. File.delete(file_path) # File.delete is never called. end end It seems, however, that the send_file call completes the request, and any code after it does not get run. Is there some way to ensure that the generated file is cleaned up after it has been successfully sent to the browser? Or will I need to resort to a cron job running a cleanup script on some interval?

    Read the article

  • Extending struts 2 "property" data tag

    - by John B.
    Hi, We are currently developing a project with Struts2. We have a module on which we display a large amount of data on read-only fields from a group of beans via the "property" Struts 2 data tag (i.e. <s:property value="aBeanProperty" /) on a jsp file. In some cases most of the fields might come empty, so a blank is being displayed on screen. Our customer is now requesting us to display default string (i.e. "N/A") whenever a property comes empty, so that it is displayed in place of the blank spaces currently shown. We are looking for a way to achieve this in a clean and maintainable way. The 'property' tag comes with a 'default' attribute on which one can define a default value in cases when the accessed property comes as null. However, most of our properties are empty strings, therefore it does not work in our case. Another solution we are thinking of is to define a base class for all of our beans, and define a util method which will validate if a string is null or empty and then return the default value. Then we would call this method from each bean getter. And yes this would be tiresome and kind of ugly :), therefore we are holding out on this one in case of a better solution. Now, we have in mind a solution which we think would be the best but have not had luck on how implement it. We are planning on extending the 'property' tag some way, defining a new 'default' attribute so that besides working on null properties, it also do so on empty strings ("", " ", etc). Therefore we would only need to replace the original s:property tag with our new custom tag, and the desired result would be achieved without touching java code. Do you have an idea on how to do this? Also, any other clever solution (maybe some sort of design pattern?) on how to default the values of a large amount of property beans are welcome too! (Or maybe, even there might be some tag that does this already in Struts2??) Thanks in advance.

    Read the article

  • Load php file wth xml header

    - by John Smith
    I have a php file with an xml header and xml code, named test.php. How do I load this file as an xml? The following doesn't work: $xml = simplexml_load_file('test.php'); echo $xml; I just get a white page. The test file is saved as php, as it's dynamic. It's loading data from the tradedoubler api. The xml looks something like this: <voucherList> <voucher> <id>115</id> <programId>111</programId> <programName>Program 111</programName> <code>AF30C5</code> <updateDate>1332422674941</updateDate> <startDate>1332370800000</startDate> <endDate>1363906800000</endDate> <title>Voucher number one</title> <shortDescription>Short description of the voucher.</shortDescription> <description>This is a long version of the voucher description.</description> <voucherTypeId>1</voucherTypeId> <defaultTrackUri>http://clk.tradedoubler.com/click?a(222)p(111)ttid(13)</defaultTrackUri> <siteSpecific>True</siteSpecific> </voucher> <voucher> <id>116</id> <programId>111</programId> <programName>Program 111</programName> <code>F90Z4F</code> <updateDate>1332423212631</updateDate> <startDate>1332370800000</startDate> <endDate>1363906800000</endDate> <title>The second voucher</title> <shortDescription>Short description of the voucher.</shortDescription> <description>This is a long version of the voucher description.</description> <voucherTypeId>1</voucherTypeId> <defaultTrackUri>http://clk.tradedoubler.com/click?a(222)p(111)ttid(13)url(http://www.example.com/product?id=123)</defaultTrackUri> <siteSpecific>False</siteSpecific> <landingUrl>http://www.example.com/product?id=123</landingUrl> </voucher> </voucherList>

    Read the article

  • Getting every odd variable in a list?

    - by John
    If I make a list in Python and want to write a function that would return only odd numbers from a range 1 to x how would I do that? For example, if I have list [1, 2, 3, 4] from 1 to 4 (4 ix my x), I want to return [1, 3].

    Read the article

  • c++: what is a good idea for a list of strings?

    - by John
    I simply want to build an RPG and make it as neat as possible, I wish to define a pile of strings which I may want to edit later, so I tried something like this: enum {MSG_INIT = "Welcome to ...", MSG_FOO = "bar"}; But I just get errors, such as that MSG_INIT is not an integer! Why must it not be a string, are that what enums are only for? What do you think is the best way to define a pile of strings? In a struct called msg or something? I'm kinda new to all this so I'd really appreciate small examples.

    Read the article

  • C++: use array of strings wrapped in namespace?

    - by John D.
    I got the following code, wishing to wrap a group of strings nicely in a namespace: namespace msgs { const int arr_sz = 3; const char *msg[arr_sz] = {"blank", "blank", "blank" }; msg[0] = "Welcome, lets start by getting a little info from you!\n"; msg[1] = "Alright, bla bla bla.."; msg[2] = "etc."; } The code inside works nicely inside a function, but I don't know how to return an array from it. The namespace idea LOOKS fine, but it returns on the last three lines: error: expected constructor, destructor, or type conversion before ‘=’ token Why can't I define the array inside a namespace, do I need to do something first? It's nice because I can call it like printf(msgs::msg[1]) etc. I want to do this I just can't wrap my head around what's wrong :(

    Read the article

  • What's the most efficient way to repeatedly remove leading text using Vim?

    - by John Topley
    What's the most efficient way to remove the text 2010-04-07 14:25:50,773 DEBUG This is a debug log statement - from a log file like the extract below using Vim? 2010-04-07 14:25:50,772 DEBUG This is a debug log statement - 9,8 2010-04-07 14:25:50,772 DEBUG This is a debug log statement - 1,11 2010-04-07 14:25:50,772 DEBUG This is a debug log statement - 5,2 2010-04-07 14:25:50,772 DEBUG This is a debug log statement - 8,4 This is what the result should look like: 9,8 1,11 5,2 8,4 Note that on this occasion I'm using gVim on Windows, so please don't suggest any UNIX programs which may be better suited to the task—I have to do it using Vim.

    Read the article

  • What's the right way to show a non-modal child dialog in MFC (VS2005)?

    - by John
    Rather than have everything in one big dialog, I'm looking at being able to display child dialogs for separate groups of controls. The idea is these are not free-floating child dialogs like floating toolbars, but would be shown with no title-bar, their position locked to the parent dialog... so as you drag the parent dialog any open child is dragged too. NOTE: these child windows are not inside the parent dialog, they would typically be 'glued' to the edge of it. In MFC/VC++ 2005, what's the best way to do this? For testing, I currently have a standard MFC Dialog-based app setup with CMainDlg, and I've then created a 'widget dialog' CWidgetDlg. So far I've got a member variable CWidgetDlg MainDlg::m_Widget and a button on CMainDlg with a handler like CMainDlg::OnDisplayWidgetBtn() { m_Widget.ShowWindow(TRUE); } But of course m_Widget hasn't got a HWND setup, and I am trying to remember the right way to do this? For dialog controls I can use DDX but what about child dialogs? And is this a reasonable approach, or is there a nicer, more automated way?

    Read the article

  • How to get an array size

    - by John Doe
    I'd like to know how to get an array rows & columns size. For instance it would be something like this: int matrix[][] = { { 2, 3 , 4}, { 1, 5, 3 } } The size of this one would be 2 x 3. How can I calculate this without including other libraries but stdio or stdlib?

    Read the article

  • Binding Javascript Event Handlers to a an Ajax HTML Response?

    - by John
    Let's say I have the following HTML code <div id="outer"> <div id="inner">Hello World</div> </div> At the end of my HTML page, I use javascript to attach event handlers like so, document.getElementById('inner').onclick = function() {alert(this.innerHTML);} document.getElementById('outer').onclick = function() { /* An Ajax Call where the response, which will be a string of HTML content, then goes into document.getElementById('outer').innerHTML */ document.getElementById('inner').onclick = function() {alert(this.innerHTML);} } In the above code, I am expecting <div id="inner">Hello World 2</div> to come back which requires me to re-attach the onclick event handler. This makes sense because the new response coming back is just a string, and I have to tell the browser that after converting to DOM, i also need some event handlers So my question is, is there a better way to manage event handlers on AJAX response that contains HTML content? I could use inline javascript within the html response, but then it prevents me from achieving non-intrusive javascript. So is there a way to achieve non-intrusive javascript and an efficient way to "maintain" event handlers of ajax html responses?

    Read the article

  • Looking for a jquery plugin to serialize a form to an object

    - by John
    I'm looking for a jQuery function or plugin that serializes form inputs to an object using the naming convention for deep-serialization supported by param() in jQuery 1.4: <form> <input name="a[b]" value="1"/> <input name="a[c]" value="2"/> <input name="d[]" value="3"/> <input name="d[]" value="4"/> <input name="d[2][e]" value="5"/> </form> $('form').serializeObject(); // { a: { b:1,c:2 }, d: [3,4,{ e:5 }] } Prototype's Form.serialize method can do exactly this. What's the jQuery equivalent? I found this plugin but it doesn't follow this naming convention.

    Read the article

  • Small questions on data structure

    - by John Graveston
    Hi, I'm trying to search the parent of a node with Kruskal's algorithm. My program works just fine, but I think I have heard of a method to improve the speed of the algorithm by reconstructing the tree while searching for the parent node and connecting it to the parent node. I'm pretty sure that I've heard of this somewhere, maybe in a lecture. Can anyone refresh my memory? And also, given a number of arrays, when searching for the minimum and the maximum value from a certain section of an array, what is the name of the tree that can calculate the minimum/maximum value from the array by making a binary tree that has the minimum/maximum value of each array in O(log N)?

    Read the article

  • Memcached in a trusted shared environment?

    - by John Kary
    We are a university IT organization that hosts all of the university's websites on several shared servers on our server room floor. We have several VMs, each running its own instance of Apache as a web server for each respective server. If we were going to setup a memcached server, is it feasible to use it as a shared instance? If shared by several servers, or even multiple web apps running on the same server, what's the best way to keep each app's cache stores separate? Prefix the key? Would each VM require its own instance of memcached, or could we setup 1 memcached server and allow our multiple VMs to read/write to it?

    Read the article

  • Which ISO format should I use to store a user's language?

    - by John Himmelman
    Should I use ISO 639-1 (2-letter abbreviation) or ISO 639-2 (3 letter abbrv) to store the user's language? Both are official standards, but which is the de facto standard in the development community? I think ISO 639-1 would be easier to remember, and is probably more popular for that reason, but thats just a guess. The site I'm building will have a separate site for the US, Brazil, Russia, China, & the UK. http://en.wikipedia.org/wiki/ISO_639

    Read the article

  • What's the best way to do Ruby gemspec creation and dependency management?

    - by John Feminella
    Over the last few months, there have been a number of rapid developments in the state of Ruby dependency management and gem creation, to the point where I've been having trouble keeping up with everything. If I'm writing a new gem, what's the best tool for me to use to create my gemspec? Are there disadvantages of using this tool over competitors? I've used Bundler a few times on applications and for me it's been a lifesaver. Is the consensus that it is suitable for use with production apps? Are there quirks or idiosyncracies people should be aware of? Links to resources you've used and have found helpful would also be much appreciated.

    Read the article

  • boost::function & boost::lambda - call site invocation & accessing _1 and _2 as the type

    - by John Dibling
    Sorry for the confusing title. Let me explain via code: #include <string> #include <boost\function.hpp> #include <boost\lambda\lambda.hpp> #include <iostream> int main() { using namespace boost::lambda; boost::function<std::string(std::string, std::string)> f = _1.append(_2); std::string s = f("Hello", "There"); std::cout << s; return 0; } I'm trying to use function to create a function that uses the labda expressions to create a new return value, and invoke that function at the call site, s = f("Hello", "There"); When I compile this, I get: 1>------ Build started: Project: hacks, Configuration: Debug x64 ------ 1>Compiling... 1>main.cpp 1>.\main.cpp(11) : error C2039: 'append' : is not a member of 'boost::lambda::lambda_functor<T>' 1> with 1> [ 1> T=boost::lambda::placeholder<1> 1> ] Using MSVC 9. My fundamental understanding of function and lambdas may be lacking. The tutorials and docs did not help so far this morning. How do I do what I'm trying to do?

    Read the article

< Previous Page | 132 133 134 135 136 137 138 139 140 141 142 143  | Next Page >