Search Results

Search found 1213 results on 49 pages for 'jonathan allen'.

Page 36/49 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • templates and casting operators

    - by Jonathan Swinney
    This code compiles in CodeGear 2009 and Visual Studio 2010 but not gcc. Why? class Foo { public: operator int() const; template <typename T> T get() const { return this->operator T(); } }; Foo::operator int() const { return 5; } The error message is: test.cpp: In member function `T Foo::get() const': test.cpp:6: error: 'const class Foo' has no member named 'operator T'

    Read the article

  • 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

  • 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

  • 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

  • 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

  • Finding changes in MongoDB database

    - by Jonathan Knight
    I'm designing a MongoDB database that works with a script that periodically polls a resource and gets back a response which is stored in the database. Right now my database has one collection with four fields , id, name, timestamp and data. I need to be able to find out which names had changes in the data field between script runs, and which did not. In pseudocode, if(data[name][timestamp]==data[name][timestamp+1]) //data has not changed store data in collection 1 else //data has changed between script runs for this name store data in collection 2 Is there a query that can do this without iterating and running javascript over each item in the collection? There are millions of documents, so this would be pretty slow. Should I create a new collection named timestamp for every time the script runs? Would that make it faster/more organized? Is there a better schema that could be used? The script runs once a day so I won't run into a namespace limitation any time soon.

    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

  • 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

  • [Doing it Wrong] Auto Boxing of primitives

    - by Jonathan
    I can't seem to figure out how to get Objective-c to auto box my primitives. I assumed that i would be able to do the following NSString* foo = @"12.5"; NSNumber* bar; bar = [foo floatValue]; However i find that i have used to the more verbose method of NSString* foo = @"12.5"; NSNumber* bar; bar = [NSNumber numberWithFloat:[foo floatValue]]; Am i doing it wrong or is this as good as it gets?

    Read the article

  • Spring.Net Message Selectors with compound statements don't seem to be working

    - by Jonathan Beerhalter
    I'm using Spring.NET to connect to ActiveMQ and do some fairly simple pub sub routing. Everything works fine when my selector is a simple expression like Car='Honda' but if I try a compound expression like Car='Honda' AND Make='Pilot' I never get any matches on my subscription. Here's the code to generate the subscription, does anyone see where I might be doing something wrong? public bool AddSubscription(string topicName, Dictionary<string,string> selectorList, GDException exp) { try { ActiveMQTopic topic = new ActiveMQTopic(topicName); string selectorString = ""; if (selectorList.Keys.Count == 0) { // Select all items for this topic selectorString = "2>1"; } else { foreach (string key in selectorList.Keys) { selectorString += key + " = '" + selectorList[key] + "'" + " AND "; } selectorString = selectorString.Remove(selectorString.Length - 5, 5); } IMessageConsumer consumer = this._subSession.CreateConsumer(topic, selectorString, false); if (consumer != null) { _consumers.Add(consumer); consumer.Listener += new MessageListener(HandleRecieveMessage); return true; } else { exp.SetValues("Error adding subscription, null consumer returned"); return false; } } catch (Exception ex) { exp.SetValues(ex); return false; } } And then the code to send the message, which seems simple enough to me public void SendMessage(GDPubSubMessage messageToSend) { if (!this.isDisposed) { if (_producers.ContainsKey(messageToSend.Topic)) { IBytesMessage bytesMessage = this._pubSession.CreateBytesMessage(messageToSend.Payload); foreach (string key in messageToSend.MessageProperties.Keys) { bytesMessage.Properties.SetString(key, messageToSend.MessageProperties[key]); } _producers[messageToSend.Topic].Send(bytesMessage, false, (byte)255, TimeSpan.FromSeconds(1)); } else { ActiveMQTopic topic = new ActiveMQTopic(messageToSend.Topic); _producers.Add(messageToSend.Topic, this._pubSession.CreateProducer(topic)); IBytesMessage bytesMessage = this._pubSession.CreateBytesMessage(messageToSend.Payload); foreach (string key in messageToSend.MessageProperties.Keys) { bytesMessage.Properties.SetString(key, messageToSend.MessageProperties[key]); } _producers[messageToSend.Topic].Send(bytesMessage); } } else { throw new ObjectDisposedException(this.GetType().FullName); } } 07/102009: Update Ok, found the problem bytesMessage.Properties.SetString(key, messageToSend.MessageProperties[key]); This justs sets a single property, so my messages are only being tagged with a single property, hence the combo subscription never gets hit. Anyone know how to add more properties? You'd think bytesMessage.Properties would have a Add method, but it doesn't.

    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

  • Mod_Rewrite: Testing URL got indexed in Google - How do I create a proper 301 redirect?

    - by Jonathan Wold
    I worked on a website for which I had a "development URL" that looked something like this: www.domainname.com.php5-9.dfw1-2.websitetestlink.com/ Now, several weeks after the website launch, there is at least one page of content indexed on Google with that URL. Question: How do I redirect all requests from that test URL to reroute to the actual domain? So, for instance, I would want: www.domainname.com.php5-9.dfw1-2.websitetestlink.com/page-name To go to: www.domainname.com/page-name The website is powered by WordPress and hosted on a PHP server. I've experimented with .htaccess without much success.

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >