Search Results

Search found 890 results on 36 pages for 'jonathan dyle'.

Page 26/36 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • Speeding up templates in GAE-Py by aggregating RPC calls

    - by Sudhir Jonathan
    Here's my problem: class City(Model): name = StringProperty() class Author(Model): name = StringProperty() city = ReferenceProperty(City) class Post(Model): author = ReferenceProperty(Author) content = StringProperty() The code isn't important... its this django template: {% for post in posts %} <div>{{post.content}}</div> <div>by {{post.author.name}} from {{post.author.city.name}}</div> {% endfor %} Now lets say I get the first 100 posts using Post.all().fetch(limit=100), and pass this list to the template - what happens? It makes 200 more datastore gets - 100 to get each author, 100 to get each author's city. This is perfectly understandable, actually, since the post only has a reference to the author, and the author only has a reference to the city. The __get__ accessor on the post.author and author.city objects transparently do a get and pull the data back (See this question). Some ways around this are Use Post.author.get_value_for_datastore(post) to collect the author keys (see the link above), and then do a batch get to get them all - the trouble here is that we need to re-construct a template data object... something which needs extra code and maintenance for each model and handler. Write an accessor, say cached_author, that checks memcache for the author first and returns that - the problem here is that post.cached_author is going to be called 100 times, which could probably mean 100 memcache calls. Hold a static key to object map (and refresh it maybe once in five minutes) if the data doesn't have to be very up to date. The cached_author accessor can then just refer to this map. All these ideas need extra code and maintenance, and they're not very transparent. What if we could do @prefetch def render_template(path, data) template.render(path, data) Turns out we can... hooks and Guido's instrumentation module both prove it. If the @prefetch method wraps a template render by capturing which keys are requested we can (atleast to one level of depth) capture which keys are being requested, return mock objects, and do a batch get on them. This could be repeated for all depth levels, till no new keys are being requested. The final render could intercept the gets and return the objects from a map. This would change a total of 200 gets into 3, transparently and without any extra code. Not to mention greatly cut down the need for memcache and help in situations where memcache can't be used. Trouble is I don't know how to do it (yet). Before I start trying, has anyone else done this? Or does anyone want to help? Or do you see a massive flaw in the plan?

    Read the article

  • How do I pass a string or data object between two view controllers?

    - by Jonathan
    In my last question i asked how to best send a string from one view controller to another, both which were on a navigation stack: http://stackoverflow.com/questions/2898860/pass-string-from-tableviewcontroller-to-viewcontroller-in-navigation-stack However I just realised I can either pass the path to the file in the app's document's folder as the first (the table view) has already accessed the data in the file should I pass viewcontroller the data to the pushed VC?

    Read the article

  • Email form isn't sending

    - by Jonathan
    Hi I have an email form that isn't sending out an email to the recipient or a copy to the client. The form can be found at www.kelcos.co.uk/contact and the files associated with this are: /index.php /jquery.js /sendemail.php /submitform.php /thanks.php /verify.php I have used this form on other websites http://www.bowlesgreen.co.uk/contact/ and http://www.arbortectreecare.co.uk/contact/ and it works fine - the only difference is that these other sites use my usual hosting provider and for the one that won't send I'm working through the clients hosting provider, which I can only presume is what is causing the problem. I have contacted the hosting and so far we have eliminated a few things such as: 'The limitation to our systems is that the emails sent using scripts will be blocked if they are not going to or coming from an email address setup on the web hosting account. - so I am now sending the form to an a kelcos.co.uk address, but still no joy. PHP/ASP was originally disabled, but now has been activated the mail() script is enabled I would really appreciated any advise any of you could offer. Thanks

    Read the article

  • Copying a foreign Subversion repository to keep under dependencies

    - by Jonathan Sternberg
    I want to keep dependencies for my project in our own repository, that way we have consistent libraries for the entire team to work with. For example, I want our project to use the Boost libraries. I've seen this done in the past with putting dependencies under a "vendor" or "dependencies" folder. But I still want to be able to update these dependencies. If a new feature appears in a library and we need it, I want to just be able to update that repository within our own repository. I don't want to have to recopy it and put it under version control again. I'd also like for us to have the ability to change dependencies if a small change is needed without stopping us from ever updating the library. I want the ability to do something like 'svn cp', then be able to 'svn merge' in the future. I just tried this with the boost trunk, but I'm not able to get any history using 'svn log' on the copy I made. How do I do this? What is usually done for large projects with dependencies?

    Read the article

  • Minify an Entire Directory While Keeping Element/Style/Script Relationships?

    - by Jonathan Sampson
    Do any solutions currnetly exist that can minify an entire project directory? More importantly, do any solutions exist that can shorten classnames, id's, and keep them consistent throughout all documents? Something that can turn this: Index.html --- <div class="fooBar"> <!-- Code --> </div> Styles.css --- .fooBar { // Comments and Messages background-color:#000000; } Index.js --- $(".fooBar").click(function(){ /* More Comments */ alert("fooBar"); }); Into This: Index.html --- <div class="a"></div> Styles.css --- .a{background-color:#000;} Index.js --- $(".a").click(function(){alert("fooBar");});

    Read the article

  • C#: How would you only draw certain ListView Items while in Virtual Mode?

    - by Jonathan Richter
    C#: How would you only draw certain ListView Items while in Virtual Mode? I am trying to create a filter-like feature to use in listview so that if the user selects an imageindex from 0-5, it will loop through the listview items and only make it so that the items in question with the correct image index will be displayed and the other items will be hidden. How would I go upon creating such a routine?

    Read the article

  • For single-producer, single-consumer should I use a BlockingCollection or a ConcurrentQueue?

    - by Jonathan Allen
    For single-producer, single-consumer should I use a BlockingCollection or a ConcurrentQueue? Concerns: * My goal is to pull up to 100 items at a time and send them as a batch to the next step. * If I use a ConcurrentQueue, I have to manually cause it to go asleep when there is no work to be done. Otherwise I waste CPU cycles on spinning. * If I use a BlockingQueue and I only have 99 work items, it could indefinitely block until there the 100th item arrives. http://msdn.microsoft.com/en-us/library/system.collections.concurrent.aspx

    Read the article

  • XPath: Nodes that have a child node that have an attribute

    - by Jonathan Allen
    XML Fragment <component name='Stipulations'> <group name='NoStipulations' required='N'> <field name='StipulationType' required='N' /> <field name='StipulationValue' required='N' /> </group> </component> <component name='NestedParties3'> <group name='NoNested3PartyIDs' required='N'> <field name='Nested3PartyID' required='N' /> <field name='Nested3PartyIDSource' required='N' /> <field name='Nested3PartyRole' required='N' /> <group name='NoNested3PartySubIDs' required='N'> <field name='Nested3PartySubID' required='N' /> <field name='Nested3PartySubIDType' required='N' /> </group> </group> </component> <component name='UnderlyingStipulations'> <group name='NoUnderlyingStips' required='N'> <field name='UnderlyingStipType' required='N' /> <field name='UnderlyingStipValue' required='N' /> </group> </component> What I want is all "group" nodes which have a child node of type "field" and a name "StipulationType". This is what I've tried so far: dictionary.XPathSelectElements("group[field[@name='StipulationType']]") dictionary.XPathSelectElements("group[./field[@name='StipulationType']]")

    Read the article

  • Imagemagick Resizing in Paperclip

    - by jonathan.soeder
    So, I want to resize images to a FIXED width, but proportional height. I have been trying a wide range of operators: 380x242# 380x242 380!x242 380x242< none of them have the desired effect. Any help? I want it to fill or resize to the 380 width, then resize / shrink the height by the same factor it used to shrink or resize the image to 380 wide.

    Read the article

  • Simulating "focus" and "blur" in jQuery .live() method...

    - by Jonathan Sampson
    Update: As of jQuery 1.4, $.live() now supports focusin and focusout events. jQuery currently1 doesn't support "blur" or "focus" as arguments for the $.live() method. What type of work-around could I implement to achieve the following: $("textarea") .live("focus", function() { foo = "bar"; }) .live("blur", function() { foo = "fizz"; }); 1. 07/29/2009, version 1.3.2

    Read the article

  • get length of data sent over network to TCPlistener/networkstream vb.net

    - by Jonathan.
    It seems the most obvious thing, but I just can't work out how to get the length of bytes sent over a network using a TCPClient and TCPListener? This is my code so far: 'Must listen on correct port- must be same as port client wants to connect on. Const portNumber As Integer = 9999 Dim tcpListener As New TcpListener(IPAddress.Parse("192.168.2.7"), portNumber) tcpListener.Start() Console.WriteLine("Waiting for connection...") 'Accept the pending client connection and return 'a TcpClient initialized for communication. Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient() Console.WriteLine("Connection accepted.") ' Get the stream Dim networkStream As NetworkStream = tcpClient.GetStream() '' Read the stream into a byte array I need to get the length of the networkstream to set the size of the array of bytes I'm going to read the data into. But the networkStream.length is unsupported and does not work and throws an Notsupportedexception. The only other way I can think of is to send the size of the data before sending the data, but this seems the long way round.

    Read the article

  • Efective way to avoid integer overflow when multiplying?

    - by Jonathan
    Hi, I'm working on a hash function which gets a string as input. Right now I'm doing a loop and inside the hash (an int variable) is being multiplied by a value and then the ASCII code for the current character is added to the mix. hash = hash * seed + string[i] But sometimes, if the string is big enough there is an integer overflow there, what can I do to avoid it while maintaining the same hash structure? Maybe a bit operation included inside the loop?

    Read the article

  • PHP Transferring Photos From One Oracle Database Table to Another

    - by Jonathan Swift
    I am attempting to transfer a set of photos (blobs) from one table to another across databases. I'm nearly there, except for binding the photo parameter. I have the following code: $conn_db1 = oci_pconnect('username', 'password', 'db1'); $conn_db2 = oci_pconnect('username', 'password', 'db2'); $parse_db1_select = oci_parse($conn_db1, "SELECT REF PID, BINARY_OBJECT PHOTOGRAPH FROM BLOBS"); $parse_db2_insert = oci_parse($conn_db2, "INSERT INTO PHOTOGRAPHS (PID, PHOTOGRAPH) VALUES (:pid, :photo)"); oci_execute($parse_db1_select); while ($row = oci_fetch_assoc($parse_db1_select)) { $pid = $row['PID']; $photo = $row['PHOTOGRAPH']; oci_bind_by_name($parse_db2_insert, ':pid', $pid, -1, OCI_B_INT); // This line causes an error oci_bind_by_name($parse_db_insert, ':photo', $photo, -1, OCI_B_BLOB); oci_execute($parse_db2_insert); } oci_close($db1); oci_close($db2); But I get the following error, on the error line commented above: Warning: oci_execute() [function.oci-execute]: ORA-03113: end-of-file on communication channel Process ID: 0 Session ID: 790 Serial number: 118 Does anyone know the right way to do this?

    Read the article

  • JQuery tablesorter - Second click on column header doesn't resort

    - by Jonathan
    I'm using tablesorter in on a table I added to a view in django's admin (although I'm not sure this is relevant). I'm extending the html's header: {% block extrahead %} <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script> <script type="text/javascript" src="http://mysite.com/media/tablesorter/jquery.tablesorter.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#myTable").tablesorter(); } ); </script> {% endblock %} When I click on a column header, it sorts the table using this column in descending order - that's ok. When I click the same column header a second time - it does not reorder to ascending order. What's wrong with it? the table's html looks like: <table id="myTable" border="1"> <thead> <tr> <th>column_name_1</th> <th>column_name_2</th> <th>column_name_3</th> </tr> </thead> <tbody> {% for item in extra.items %} <tr> <td>{{ item.0|safe }} </td> <td>{{ item.1|safe }} </td> <td>{{ item.2|safe }} </td> </tr> {% endfor %} </tbody> </table>

    Read the article

  • How can I create a collection of references in C#

    - by Jonathan Kaufman
    Ok I am having a cross language hiccup. In C# with it's great collections like List and I have: a Map class with properties of: List<byte[]> Images; List<Tile> Tiles; a Tile Class of: byte[] ImageData; int X; int Y; Now I want to add an image to the Map class and have the ImageData property of the Tile Classes to "reference" it. I have discovered I can't just assign it Images[0]. You can't have a reference to an object of a List. My fix was to create a Dictionary. Is this the best way or can I somehow have a "pointer" to a collection of objects?

    Read the article

  • How do you populate a UIImage view with ASIHTTPRequest given @2x?

    - by Jonathan Page
    I've been trying to load images from a url using ASIHTTPRequest but I always come up with a blank UIImage. I think it might have something to do with iOS automatically choosing the @2x named version of images or vica versa. [ASIHTTPRequest setDefaultCache:[ASIDownloadCache sharedCache]]; NSString *url_string = [NSString stringWithFormat:@"http://173.246.100.185/%@", [eventDictionary objectForKey:kEventDescriptionImageURLKey]]; NSURL *url = [NSURL URLWithString:url_string]; __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDownloadCache:[ASIDownloadCache sharedCache]]; [request setCachePolicy:ASIAskServerIfModifiedCachePolicy|ASIFallbackToCacheIfLoadFailsCachePolicy]; [request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy]; [request setSecondsToCache:86400]; [request setDelegate:self]; [request setCompletionBlock:^{ NSLog(@"Successful Update"); [self makeAssignment]; }]; [request setFailedBlock:^{ NSError *error = [request error]; NSLog(@"%@", [error localizedDescription]); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Update Failed" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; }]; [request startAsynchronous]; NSLog(@"%@", url_string); The makeAssignment method is below. NSString *url_string = [NSString stringWithFormat:@"http://173.246.100.185/%@", [eventDictionary objectForKey:kEventDescriptionImageURLKey]]; NSURL *url = [NSURL URLWithString:url_string]; downloadedImage = [[UIImage alloc] initWithContentsOfFile:[[ASIDownloadCache sharedCache] pathToCachedResponseDataForURL:url]]; NSLog(@"%@", downloadedImage); NSLog(@"%@", [[ASIDownloadCache sharedCache] pathToCachedResponseDataForURL:url]); Nothing I do, including naming images @2x on the server or providing both versions, gets it to load. Any ideas? Has anyone done this before? When I load them locally (from within the package) I don't have any issues. Thanks!

    Read the article

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