Search Results

Search found 4651 results on 187 pages for 'john varghese'.

Page 132/187 | < Previous Page | 128 129 130 131 132 133 134 135 136 137 138 139  | Next Page >

  • JQuery div tag has children in FireFox but not Chrome

    - by John Edwards
    I am using JQuery ajax to load images from a url, display them, and then place a button on top of each image. The code works in firefox, but in chrome, the div parent "photos" that should have all the children(one child div "photo" for each image received from the url) is 0. I have tried read() and load(), but nothing seems to work. If I run alert($('#photos').children().size()); in the Chrome console it returns the children. But at execution it returns 0. Any ideas? $(window).load(function () { $("p").text("The DOM is now loaded and can be manipulated."); //returns 0 in chrome, but 10 in firefox alert($('#photos').children().size()); $('#photos').children().each(function() { //do stuff

    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

  • 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

  • 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

  • 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

  • Using * Width & Precision Specifiers With boost::format

    - by John Dibling
    I am trying to use width and precision specifiers with boost::format, like this: #include <boost\format.hpp> #include <string> int main() { int n = 5; std::string s = (boost::format("%*.*s") % (n*2) % (n*2) % "Hello").str(); return 0; } But this doesn't work because boost::format doesn't support the * specifier. Boost throws an exception when parsing the string. Is there a way to accomplish the same goal, preferably using a drop-in replacement?

    Read the article

  • User class - 'load' data

    - by John
    <?php class User { private $id; private $username; public function __construct($id = null) { $this->id = $id; if (!is_null($this->id)) { $this->load(); } } public function load() { } } ?> In the 'load' method I am going to load all the information from the current user (id) But I wonder how is the best way to load all info. I could grab all data and then just assign all private variables, but I assume there must be another "cheaper" way to get all the data so I can use as such $this-variable; And not have to ASSIGN every single data row, I select in the load method. How?

    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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • How do you extend the Site model in django?

    - by John Giotta
    What is the best approach to extending the Site model in django? Creating a new model and ForeignKey the Site or there another approach that allows me to subclass the Site model? I prefer subclassing, because relationally I'm more comfortable, but I'm concerned for the impact it will have with the built-in Admin.

    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

  • 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

  • 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

  • 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

  • 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

  • Choose 'better' or more familiar technologies for a new project?

    - by John
    I am looking to start work on a brand-new project, something I've been thinking about for a while as my first independent sellable project. It's broadly speaking a web-based service application, and my first choice, server-language is quite easy... I know Java pretty well from working on Java web-apps in the past. However my experience doing web-apps involved JSP, Servlets and JSTL... I know the ideas behind newer technologies like Hibernate/Spring but have never used them. So we wrote our own DAOs, handled AJAX by writing special mini-JSP pages that generated XML/JSON pages, etc. I'm not hugely into the idea that Spring/Hibernate are the 'only' or 'right' way to do any Java web-project, but they are widely used. On the other hand, not only would trying to learn these increase initial development time, but I'd be using my learning attempts to build a production system. I remember one of Joel's early articles said (I'll paraphrase since I can't find it) "regardless what's cool, always use the technologies that the lead developer (or dev team?) knows best" I wondered what people thought about that? ps: should this be CW?

    Read the article

  • Adapting Map Iterators Using STL/Boost/Lambdas

    - by John Dibling
    Consider the following non-working code: typedef map<int, unsigned> mymap; mymap m; for( int i = 1; i < 5; ++i ) m[i] = i; // 'remove' all elements from map where .second < 3 remove(m.begin(), m.end(), bind2nd(less<int>(), 3)); I'm trying to remove elements from this map where .second < 3. This obviously isn't written correctly. How do I write this correctly using: Standard STL function objects & techniques Boost.Bind C++0x Lambdas I know I'm not eraseing the elements. Don't worry about that; I'm just simplifying the problem to solve.

    Read the article

  • Should multiple regional websites all use the same database?

    - by John Himmelman
    I'm developing a cms for a company that has multiple regional sites (us, uk, china, russia, etc..). Should I use a separate database for each of these sites or use a single database with a 'site' field in each table? My main concern is the table language encoding (ie, can storing strings in different langauges in the same table cause problems, such as sorting issues).

    Read the article

< Previous Page | 128 129 130 131 132 133 134 135 136 137 138 139  | Next Page >