Search Results

Search found 1654 results on 67 pages for 'hack'.

Page 23/67 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Asynchronous vs Synchronous vs Threading in an iPhone App

    - by Coocoo4Cocoa
    I'm in the design stage for an app which will utilize a REST web service and sort of have a dilemma in as far as using asynchronous vs synchronous vs threading. Here's the scenario. Say you have three options to drill down into, each one having its own REST-based resource. I can either lazily load each one with a synchronous request, but that'll block the UI and prevent the user from hitting a back navigation button while data is retrieved. This case applies almost anywhere except for when your application requires a login screen. I can't see any reason to use synchronous HTTP requests vs asynchronous because of that reason alone. The only time it makes sense is to have a worker thread make your synchronous request, and notify the main thread when the request is done. This will prevent the block. The question then is bench marking your code and seeing which has more overhead, a threaded synchronous request or an asynchronous request. The problem with asynchronous requests is you need to either setup a smart notification or delegate system as you can have multiple requests for multiple resources happening at any given time. The other problem with them is if I have a class, say a singleton which is handling all of my data, I can't use asynchronous requests in a getter method. Meaning the following won't go: - (NSArray *)users { if(users == nil) users = do_async_request // NO GOOD return users; } whereas the following: - (NSArray *)users { if(users == nil) users == do_sync_request // OK. return users; } You also might have priority. What I mean by priority is if you look at Apple's Mail application on the iPhone, you'll notice they first suck down your entire POP/IMAP tree before making a second request to retrieve the first 2 lines (the default) of your message. I suppose my question to you experts is this. When are you using asynchronous, synchronous, threads -- and when are you using either async/sync in a thread? What kind of delegation system do you have setup to know what to do when a async request completes? Are you prioritizing your async requests? There's a gamut of solutions to this all too common problem. It's simple to hack something out. The problem is, I don't want to hack and I want to have something that's simple and easy to maintain.

    Read the article

  • Force Quirks mode with Doctype

    - by Ameer
    I have a page which needs to be rendered in Quirks mode for the page to be loaded properly. The problem is that the page uses valid XHTML and thus has a doctype. This forces the page to render in Standards mode in all browsers. Is there any workaround/hack that can force Quirks mode eventhough I have a doctype?

    Read the article

  • Is there any way to evaluate (expand-file-name) in .dir-locals.el?

    - by vava
    I'm trying to move all my compilation config (compilation-command and compilation-directory to be exact) to .dir-locals.el file at the top of my project. It is working fine except that I can't find the way to use expand-file-name there and without it I have to use absolute path, which is not really convenient. So, is there a way (or a dirty hack) to make local directory variables to evaluate values before assigning?

    Read the article

  • Wordpress: how to call a plugin function with an ajax call?

    - by Bee
    I'm writing a Wordpress MU plugin, it includes a link with each post and I want to use ajax to call one of the plugin functions when the user clicks on this link, and then dynamically update the link-text with output from that function. I'm stuck with the ajax query. I've got this complicated, clearly hack-ish, way to do it, but it is not quite working. What is the 'correct' or 'wordpress' way to include ajax functionality in a plugin? (My current hack code is below. When I click the generate link I don't get the same output I get in the wp page as when I go directly to sample-ajax.php in my browser.) I've got my code[1] set up as follows: mu-plugins/sample.php: <?php /* Plugin Name: Sample Plugin */ if (!class_exists("SamplePlugin")) { class SamplePlugin { function SamplePlugin() {} function addHeaderCode() { echo '<link type="text/css" rel="stylesheet" href="'.get_bloginfo('wpurl'). '/wp-content/mu-plugins/sample/sample.css" />\n'; wp_enqueue_script('sample-ajax', get_bloginfo('wpurl') . '/wp-content/mu-plugins/sample/sample-ajax.js.php', array('jquery'), '1.0'); } // adds the link to post content. function addLink($content = '') { $content .= "<span class='foobar clicked'><a href='#'>click</a></span>"; return $content; } function doAjax() { // echo "<a href='#'>AJAX!</a>"; } } } if (class_exists("SamplePlugin")) { $sample_plugin = new SamplePlugin(); } if (isset($sample_plugin)) { add_action('wp_head',array(&$sample_plugin,'addHeaderCode'),1); add_filter('the_content', array(&$sample_plugin, 'addLink')); } mu-plugins/sample/sample-ajax.js.php: <?php if (!function_exists('add_action')) { require_once("../../../wp-config.php"); } ?> jQuery(document).ready(function(){ jQuery(".foobar").bind("click", function() { var aref = this; jQuery(this).toggleClass('clicked'); jQuery.ajax({ url: "http://mysite/wp-content/mu-plugins/sample/sample-ajax.php", success: function(value) { jQuery(aref).html(value); } }); }); }); mu-plugins/sample/sample-ajax.php: <?php if (!function_exists('add_action')) { require_once("../../../wp-config.php"); } if (isset($sample_plugin)) { $sample_plugin->doAjax(); } else { echo "unset"; } ?> [1] Note: The following tutorial got me this far, but I'm stumped at this point. http://www.devlounge.net/articles/using-ajax-with-your-wordpress-plugin

    Read the article

  • How do I disable "eager" validation entirely using jquery validate ?

    - by Kevin J
    Is there a way to disable "eager" validation using the jquery.validate plugin? Either through an option in the script or as a hack? "Eager" validation kicks in once the form has been validated once - after that, invalid fields are validated onfocusout. I want to disable this behavior, and change my forms to only be validated when the submit button is pressed. I don't mind hacking through the validate script itself also, so if that's what the solution requires that's acceptable.

    Read the article

  • Best way to copy the entire contents of a directory in C#

    - by Keith
    I want to copy the entire contents of a directory from one location to another in C#. There doesn't appear to be a way to do this using System.IO classes without lots of recursion. There is a method in VB that we can use if we add a reference to Microsoft.VisualBasic: new Microsoft.VisualBasic.Devices.Computer(). FileSystem.CopyDirectory( sourceFolder, outputFolder ); This seems like a rather ugly hack. Is there a better way?

    Read the article

  • Cheapest way to send SMS for number verification?

    - by erotsppa
    My application needs to verify phone numbers that are provided by the user. What is the absolute cheapest way to send an SMS to a phone? Which company/API should I go to? I'm not looking for a hack solution to send out 10 SMS a month kind of thing, I need to roll this out for a company that will be sending mass amount of verifications. But they want to do it at the lowest cost. (Each user will only need to verify once)

    Read the article

  • Integrate website backend with forum software?

    - by Msencenb
    I am designing a php/mysql website that will have a members are and a separate "forum" section. Should I just use the forum software as my "login/registration"? If this is the case should I go with VBulletin, Invision, phpBB3 or something different? Or should I roll my own single sign on hack? Or something completely different?

    Read the article

  • Font Rendering between Mozilla and webkit

    - by Joe Payton
    I'm not sure if this has anything to do with the recent Safari update, but I'm beginning to notice this a lot. There is a drastic difference in the way each browser is rendering fonts. for instance, I took screenshots of what I am seeing here on stackoverflow... http://twitpic.com/q43eh I have verified that this is a trend via my co-workers machines. has anyone noticed this or have any thoughts on non-hack solutions?

    Read the article

  • getting around circular references in Delphi

    - by Tom
    Is there a way of getting around circular unit references in Delphi? Maybe a newer version of delphi or some magic hack or something? My delphi project has 100 000+ lines of code mostly based on singleton classes. I need to refactor this, but that would mean several months of "circular reference" hell :)

    Read the article

  • Is there a working example of using WebDAV for querying Exchange server for calendar items?

    - by Lasse V. Karlsen
    I have tried to hack together a small test project, but it fails with "400 Bad Request" so I'm pretty sure I have done something very basic wrong, but the examples I've found are all in the form of questions, only showing minor pieces of the puzzle, such as a request XML for public folders or whatnot. Is there a complete example somewhere where I can just put in my username and servername and it would list the calendar items in my calendar? This is for C# 3.0/4.0.

    Read the article

  • Howto clone a URI

    - by alesch
    Is there a better way to get a copy (clone) of a URI than this horrible hack? import org.eclipse.emf.common.util.URI; URI cloned = URI.createURI( originalURI.toString() ); Thanks in advance!

    Read the article

  • Python datetime to Unix timestamp

    - by Off Rhoden
    I have to create an "Expires" value 5 minutes in the future, but I have to supply it in UNIX Timestamp format. I have this so far, but it seems like a hack. def expires(): '''return a UNIX style timestamp representing 5 minutes from now''' epoch = datetime.datetime(1970, 1, 1) seconds_in_a_day = 60 * 60 * 24 five_minutes = datetime.timedelta(seconds=5*60) five_minutes_from_now = datetime.datetime.now() + five_minutes since_epoch = five_minutes_from_now - epoch return since_epoch.days * seconds_in_a_day + since_epoch.seconds Is there a module or function that does the timestamp conversion for me?

    Read the article

  • Conditional action based on whether any file in a directory has a ctime newer than X

    - by jberryman
    I would like to run a backup job on a directory tree from a bash script if any of the files have been modified in the last 30 minutes. I think I can hack together something using find with the -ctime flag, but I'm sure there is a standard way to examine a directory for changes. I know that I can inspect the ctime of the top level directory to see if files were added, but I need to be able to see changes also. FWIW, I am using duplicity to backup directories to S3.

    Read the article

  • Duplicating an array of strings.

    - by Jon
    arr = ["red","green","yellow"] arr2 = arr.clone arr2[0].replace("blue") puts arr.inspect puts arr2.inspect produces: ["blue", "green", "yellow"] ["blue", "green", "yellow"] Is there anyway to do a deep copy of an array of strings, other than using Marshal as i understand that is a hack. I could do: arr2 = [] arr.each do |e| arr2 << e.clone end but it doesn't seem very elegant, or efficient. Thanks

    Read the article

  • QApplication In Non-Main Thread

    - by Boatzart
    I need to exec() a QApplication in a thread that is not main (my GUIs must be plugins that can be dynamically loaded and unloaded at runtime, so I have no access to the main thread). Does anyone know of a (relatively) painless way to hack around Qt's restriction against starting QApplication outside of main? I'm developing in Linux with Qt4 in C++ using gcc4.3.4.

    Read the article

  • how to specify a BIGINT in a rails scaffold?

    - by webdestroya
    I am trying to create a model in ruby that uses a BIGINT datatype (as opposed to the INT done by :integer). I have search all over Google, but all I seem to find is "run an SQL statement to alter the table to a BIGINT" - This seems a bit hack-ish to me, so I wanted to know if there was a way to specify a bigint in the ruby system like :big_int or something Any ideas?

    Read the article

  • Opera Browser: prevent mousewheel scrolling?

    - by frankB
    I just build a website that works good on any browser even ipad but in Oper ai noticed a weird thing: the website is built with a div layer on top zindez:999, body is overflow:hidden, and you cant scroll, but underneath the div there is a long text that goes way underneath the viewport... the strage thing is that even if any browser i wasable to keep this effect in Oepra if I use the mousewheel you can kepp scrolling...! ...argh.. do you any hack/solution for this?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >