Search Results

Search found 1111 results on 45 pages for 'fly'.

Page 4/45 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Changing CSS on the fly in a UIWebView on iPhone

    - by Shaggy Frog
    Let's say I'm developing an iPhone app that is a catalogue of cars. The user will choose a car from a list, and I will present a detail view for the car, which will describe things like top speed. The detail view will essentially be a UIWebView that is loading an existing HTML file. Different users will live in different parts of the world, so they will like to see the top speed for the car in whatever units are appropriate for their locale. Let's say there are two such units: SI (km/h) and conventional (mph). Let's also say the user will be able to change the display units by hitting a button on the screen; when that happens, the detail screen should switch to show the relevant units. So far, here's what I've done to try and solve this. The HTML might look something like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <title>Some Car</title> <link rel="stylesheet" media="screen" type="text/css" href="persistent.css" /> <link rel="alternate stylesheet" media="screen" type="text/css" href="si.css" title="si" /> <link rel="alternate stylesheet" media="screen" type="text/css" href="conventional.css" title="conventional" /> <script type="text/javascript" src="switch.js"></script> </head> <body> <h1>Some Car</h1> <div id="si"> <h2>Top Speed: 160 km/h</h2> </div> <div id="conventional"> <h2>Top Speed: 100 mph</h2> </div> </body> The peristent stylesheet, persistent.css: #si { display:none; } #conventional { display:none; } The first alternate stylesheet, si.css: #si { display:inline; } #conventional { display:none; } And the second alternate stylesheet, conventional.css: #si { display:none; } #conventional { display:inline; } Based on a tutorial at A List Apart, my switch.js looks something like this: function disableStyleSheet(title) { var i, a; for (i = 0; (a = document.getElementsByTagName("link")[i]); i++) { if ((a.getAttribute("rel").indexOf("alt") != -1) && (a.getAttribute("title") == title)) { a.disabled = true; } } } function enableStyleSheet(title) { var i, a; for (i = 0; (a = document.getElementsByTagName("link")[i]); i++) { if ((a.getAttribute("rel").indexOf("alt") != -1) && (a.getAttribute("title") == title)) { a.disabled = false; } } } function switchToSiStyleSheet() { disableStyleSheet("conventional"); enableStyleSheet("si"); } function switchToConventionalStyleSheet() { disableStyleSheet("si"); enableStyleSheet("conventional"); } My button action handler looks something like this: - (void)notesButtonAction:(id)sender { static BOOL isUsingSi = YES; if (isUsingSi) { NSString* command = [[NSString alloc] initWithString:@"switchToSiStyleSheet();"]; [self.webView stringByEvaluatingJavaScriptFromString:command]; [command release]; } else { NSString* command = [[NSString alloc] initWithFormat:@"switchToConventionalStyleSheet();"]; [self.webView stringByEvaluatingJavaScriptFromString:command]; [command release]; } isUsingSi = !isUsingSi; } Here's the first problem. The first time the button is hit, the UIWebView doesn't change. The second time it's hit, it looks like the conventional style sheet is loaded. The third time, it switches to the SI style sheet; the fourth time, back to the conventional, and so on. So, basically, only that first button press doesn't seem to do anything. Here's the second problem. I'm not sure how to switch to the correct style sheet upon initial load of the UIWebView. I tried this: - (void)webViewDidFinishLoad:(UIWebView *)webView { NSString* command = [[NSString alloc] initWithString:@"switchToSiStyleSheet();"]; [self.webView stringByEvaluatingJavaScriptFromString:command]; [command release]; } But, like the first button hit, it doesn't seem to do anything. Can anyone help me with these two problems?

    Read the article

  • Interpolating Large Datasets On the Fly

    - by Karl
    Interpolating Large Datasets I have a large data set of about 0.5million records representing the exchange rate between the USD / GBP over the course of a given day. I have an application that wants to be able to graph this data or maybe a subset. For obvious reasons I do not want to plot 0.5 million points on my graph. What I need is a smaller data set (100 points or so) which accurately (as possible) represents the given data. Does anyone know of any interesting and performant ways this data can be achieved? Cheers, Karl

    Read the article

  • django admin - adding fields on the fly

    - by Thomas
    Basically I am writing a simple shopping cart. Each item can have multiple prices. (i.e. shirts where each size is priced differently). I would like to have a single price field in my admin panel, where when the first price is entered, an additional price field pops up. However I am kind of at a loss as to how to do this. What would be the best way to do this?

    Read the article

  • Create Class functions on the fly?

    - by JasonS
    Hi, i have a validation class which needs improving. If I require some custom validation I need to specify a custom function. It works a bit like this: The controller tells the validation that a custom validation function is required. The controller runs the validation. --- Gets iffy here --- Validation class creates a new instance of the controller class.... Validation class runs controller-custom_validation_function() Validation class returns true / false Is there someway that I can alter this to do something like this? $validation = new validation; // Insert rules here. $validation-function() = $this-function(); By doing this I could get rid of the step of creating an unneeded class instance.

    Read the article

  • Rendering form on the fly from XML in flex

    - by kartikkowligi
    Hi, I have an xml code something like this <root> <render> <head> <transition id="fadeIn" type="fade" subtype="" dur="3s"/> <transition id="fadeOut" type="fade" subtype="" dur="3s"/> <layout> <root-layout width="480px" height="360px" backgroundColor="0"/> <region id="rootRegion" dur="15s"> <region id="background" soundLevel="100%" top="0px" left="0px" width="480px" height="360px" z-index="0"/> <region id="foreground" soundLevel="100%" top="0%" left="0%" width="480px" height="360px" z-index="1"/> </region> </layout> </head> <body> <par region="background" begin="0s"> <img> <meta name="assetsource" content="stock"/> <src>http://s3.amazonaws.com/JivoxStockImage/000003296736.jpg</src> <width>102.49999999999999%</width> <height>97.5%</height> <left>0%</left> <top>0%</top> <clipBegin/> <clipEnd/> <begin>0s</begin> <dur>15</dur> </img> <audio> <meta name="assetsource" content="stock"/> <src>http://audio.mp3</src> <clipBegin/> <clipEnd/> <begin>0s</begin> <dur>15s</dur> </audio> </par> <par region="foreground" begin="0s"> <img> <meta name="assettype" content="user"/> <src>http://image.png</src> <width>20%</width> <height>20%</height> <left>41.5%</left> <top>25.555555555555557%</top> <begin>2s</begin> <dur>10s</dur> <id>BA6B7CF0BD9080CAD7A02199483224EA61A6E08A</id> </img> </par> </body> </render> <form> <map formId="BA6B7CF0BD9080CAD7A02199483224EA61A6E08A" type="image" label="Logo" /> <map formId="F635A9123082A15834389030382683C55EB29E75" type="text" label="Company Name" /> </form> </root> Here I need to match formId in 'form' with that of 'id' in 'render' and create the form dynamically in flex. I am able to get the xml file via the httpservice. All I need to know is how to match it and render the form dynamically!!

    Read the article

  • Generating scriptaculous ajax.autocompleter on the fly

    - by user279992
    I have a form where the user can dynamically add a new table row with fields. I'm using a simple insertCell/InsertRow with innerHTML to generate the new row. One of those form fields is using scriptaculous' ajax.autocompleter. I have it generating new IDs for all the elements, but it is still not working The new row generated by js has the same source as the initial row of the form that loads at run time, however it does not appear to be calling the autocomplete function. I think my problem lies in that I don't understand when/how the "new Ajax.Autocompleter" is called. Is it not possible to use ajax.autocompleter like this? TIA

    Read the article

  • Modify on-the-fly verbose_name in a model field on django admin

    - by PerroVerd
    Hi I have this sample model working with the admin class Author(models.Model): name = models.CharField(_('Text in here'), max_length=100) with verbose_name set as ugettext_lazy 'Text in here', but sometimes, depending on the site_id i want to present a diferent verbose name, so I modified the init in this way def __init__(self, *args, **kwargs): super(Author, self).__init__(*args, **kwargs) #some logic in here self._meta.get_field('name').verbose_name = _('Other text') It works, displaying the 'Other text' instead the 'Text in here'... except for the very first time the author/add view is used. ¿Is it the right way to do it? ¿How can i fix the first time problem? Thanks in advance

    Read the article

  • [C#] SQLite - Creating and changing databases on the fly

    - by Oskar Kjellin
    Today I use SQLite and send a database-file with the project. However I want the database to be created when the user first starts the software. Is there a way to copy the code needed to create a database based on the existing database? The problem is that when a user downloads a new version he might be tricked into copying over his last database and lose the data. I'd like a nice way to check the version of the database and modify it if I need new columns or tables etc. Or, if it does not exist at all, create a new database? I know I can probably make create the code to make the database from the beginning but I want it to be based on the existing database I have created by a gui.

    Read the article

  • On-the-fly lossless image compression

    - by geschema
    I have an embedded application where an image scanner sends out a stream of 16-bit pixels that are later assembled to a grayscale image. As I need to both save this data locally and forward it to a network interface, I'd like to compress the data stream to reduce the required storage space and network bandwidth. Is there a simple algorithm that I can use to losslessly compress the pixel data? I first thought of computing the difference between two consecutive pixels and then encoding this difference with a Huffman code. Unfortunately, the pixels are unsigned 16-bit quantities so the difference can be anywhere in the range -65535 .. +65535 which leads to potentially huge codeword lengths. If a few really long codewords occur in a row, I'll run into buffer overflow problems.

    Read the article

  • [javascript - jQuery] creating nested array's on the fly

    - by adardesign
    What i am trying to do is to loop this HTML and get an nested array of this HTML values that i want to grab. This script is just part of a whole function. html <div class="configureData"> <div title="Large"> <a href="yellow" title="true" rel="$55.00" name="sku22828"></a> <a href="green" title="true" rel="$55.00" name="sku224438"></a> <a href="Blue" title="true" rel="$55.00" name="sku22222"></a> </div> <div title="Large"> <a href="yellow" title="true" rel="$55.00" name="sku22828"></a> <a href="green" title="true" rel="$55.00" name="sku224438"></a> <a href="Blue" title="true" rel="$55.00" name="sku22222"></a> </div> <div title="Large"> <a href="yellow" title="true" rel="$55.00" name="sku22828"></a> <a href="green" title="true" rel="$55.00" name="sku224438"></a> <a href="Blue" title="true" rel="$55.00" name="sku22222"></a> </div> </div> javascript // this is part of a script..... parseData:function(dH){ dH.find(".configureData div").each(function(indA, eleA){ colorNSize.tempSizeArray[indA] = [eleA.title,[],[],[],[]] $(eleZ).find("a").each(function(indB, eleB){ colorNSize.tempSizeArray[indA][indB+1] = eleC.title }) }) }, I expect the end array should look like this. [ ["large", ["yellow", "green", "blue"], ["true", "true", "true"], ["$55", "$55","$55"] ], ["Medium", ["yellow", "green", "blue"], ["true", "true", "true"], ["$55", "$55","$55"] ] ] // and so on....

    Read the article

  • Database on the fly with scripting languages

    - by afilatun
    I have a set of .csv files that I want to process. It would be far easier to process it with SQL queries. I wonder if there is some way to load a .csv file and use SQL language to look into it with a scripting language like python or ruby. Loading it with something similar to ActiveRecord would be awesome. The problem is that I don't want to have to run a database somewhere prior to running my script. I souldn't have additionnal installations needed outside of the scripting language and some modules. My question is which language and what modules should I use for this task. I looked around and can't find anything that suits my need. Is it even possible?

    Read the article

  • Attaching event on the fly with prototype

    - by andreas
    Hi, I've been scratching my head over this for an hour... I have a list of todo which has done button on each item. Every time a user clicks on that, it's supposed to do an Ajax call to the server, calling the marking function then updates the whole list. The problem I'm facing is that the new list has done buttons as well on each item. And it doesn't attach the click event anymore after first update. How do you attach an event handler on newly updated element with prototype? Note: I've passed evalScripts: true to the updater wrapper initial event handler attach <script type="text/javascript"> document.observe('dom:loaded', function() { $$('.todo-done a').each(function(a) { $(a).observe('click', function(e) { var todoId = $(this).readAttribute('href').substr(1); new Ajax.Updater('todo-list', $.utils.getPath('/todos/ajax_mark/done'), { onComplete: function() { $.utils.updateList({evalScripts: true}); } }); }); }) }); </script> updateList: <script type="text/javascript"> var Utils = Class.create({ updateList: function(options) { if(typeof options == 'undefined') { options = {}; } new Ajax.Updater('todo-list', $.utils.getPath('/todos/ajax_get'), $H(options).merge({ onComplete: function() { $first = $('todo-list').down(); $first.hide(); Effect.Appear($first, {duration: 0.7}); new Effect.Pulsate($('todo-list').down(), {pulses: 1, duration: 0.4, queue: 'end'}); } }) ); } }) $.utils = new Utils('globals'); </script> any help is very much appreciated, thank you :)

    Read the article

  • Change MS Access to Exclusive on the fly

    - by Nate
    I have a process in an MS Acess database that the users will usually run once daily, but could be more or less. It takes several minutes and requires temporary exclusive access because it deletes and recreates the main table. I have code to check to see if there are other users in the db before the process starts, but is there a way to change the access to "exclusive" at the beginning, and then change it back to open access at the end? Thanks for any help.

    Read the article

  • Creating nested arrays on the fly

    - by adardesign
    I am trying to do is to loop this HTML and get a nested array of this HTML values that i want to grab. It might look complex at first but is a simple question... This script is just part of a Object containing methods. html <div class="configureData"> <div title="Large"> <a href="yellow" title="true" rel="$55.00" name="sku22828"></a> <a href="green" title="true" rel="$55.00" name="sku224438"></a> <a href="Blue" title="true" rel="$55.00" name="sku22222"></a> </div> <div title="Medium"> <a href="yellow" title="true" rel="$55.00" name="sku22828"></a> <a href="green" title="true" rel="$55.00" name="sku224438"></a> <a href="Blue" title="true" rel="$55.00" name="sku22222"></a> </div> <div title="Small"> <a href="yellow" title="true" rel="$55.00" name="sku22828"></a> <a href="green" title="true" rel="$55.00" name="sku224438"></a> <a href="Blue" title="true" rel="$55.00" name="sku22222"></a> </div> </div> javascript // this is part of a script..... parseData:function(dH){ dH.find(".configureData div").each(function(indA, eleA){ colorNSize.tempSizeArray[indA] = [eleA.title,[],[],[],[]] $(eleZ).find("a").each(function(indB, eleB){ colorNSize.tempSizeArray[indA][indB+1] = eleC.title }) }) }, I expect the end array should look like this. [ ["large", ["yellow", "green", "blue"], ["true", "true", "true"], ["$55", "$55","$55"] ], ["Medium", ["yellow", "green", "blue"], ["true", "true", "true"], ["$55", "$55","$55"] ] ] // and so on....

    Read the article

  • Change connection on the fly

    - by aron
    Hello, I have a SQL server with 50 databases. Each one has the exact same schema. I used the awesome Subsonic 2.2 create the DAL based on one of them. I need to loop though a list of database names and connect to each one and perform an update one at a time. If there a way to alter how subsonic uses the connection string. I believe I would need to store the connection string in memory that way it can keep changing. Is this possible? I tried doing a ConfigurationManager.ConnectionStrings["theConnStrName"].ConnectionString = updated-connection-string-here; .. but that did not work thanks!

    Read the article

  • Comparing two java objects on fly (data type not known)

    - by Narendra
    Hi All, I need to compare different data objects. Can any one tell me how can i do this. I don't know what are the data types i will get priorly. If i need to use any util from apache commons then please give reference to it. At present I am using .equals() for comparing equality of objects .It is working fine when I am comparing quality for two strings. If i am comparing java.sql.date data type then it is showing unequal even though both contains same values. Can any one suggest me on this regard. Thanks, Narendra

    Read the article

  • Initializing objects on the fly

    - by pocoa
    I have a vector called players and a class called Player. And what I'm trying to do is to write: players.push_back(Player(name, Weapon(bullets))); So I want to be able to create players in a loop. But I see an error message says "no matching function for call Player::Player..." Then I've changed that to: Weapon w(bullets); Player p(name, w); players.push_back(p); Here is my Player definition: class Player { public: Player(string &name, Weapon &weapon); private string name; Weapon weapon; } I'm just trying to learn what is the difference between these definitions. And is this the right way to pass an object to an object constructor. Note: These are not my actual class definitions. I'm just trying to learn something about object oriented programming in C++ with coding it. I mean I know that Weapon should be initialized in Player :)

    Read the article

  • change `dest` option on the fly

    - by Rikard
    I have some grunt tasks to compile files and would like to "recicle" them inside different tasks. I am trying to modify the destination directory without success... My idea is something like: grunt.registerTask('bower', ['compile:index', 'compile:core'], function(){ this.options({dest: 'dist/*.js'}); }); The compile:index task runs good by itself (i.e. when called alone) and has dest: 'index.js, other tasks have other filenames. I would like to change these inside the bowertask, adding a new directory but keeping the filename defined in the original task. Is this possible?

    Read the article

  • Change background colour of individual elements on the fly

    - by John
    Hi, Is there a way in CSS or JQuery where I can dynamically change the background of li tags so they get slightly lighter for each element until it gets to white. For example say I had a list of 10 li elements. The first would have a red (#ff0000) background, the next one would then be a lighter shade of red, and so on and so on until we got to the last one which would have a background of white (#FFFFFF) The list can be any length and i just want the background colour to go from one colour e.g. red to another colour e.g. white. My site uses JQuery so if I have to use that I don't mind. Thanks

    Read the article

  • Making sites on the fly, programatically

    - by dotnetdev
    Hi, Is it possible to create a site on demand? So in the response of an event, such as button click. I want users to be able to see one site (all users), but users with assigned to a certain group will see two sites. Also, when would I want to create a seperate web application? Thanks

    Read the article

  • Resharper 5 - enable/disable on the fly

    - by Cristi Diaconescu
    I want to disable ReSharper 5 when debugging - it slows things down more than I'm willing to take. Is there an automatic way to do this? The next best thing would be a toolbar button to manually enable/disable it. On the Tools - Options - ReSharper page there's a comment that the VS command Resharper_ToggleSuspended would do just this. The problem is, I can't find the command when I right-click a toolbar - Customize... - 'Commands' tab - Choose 'Resharper' category. Am I missing something?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >