Search Results

Search found 4252 results on 171 pages for 'david 85'.

Page 120/171 | < Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >

  • Iteratively creating multiple file input fields in Rails

    - by David
    I have a column of product views in a database (e.g. top, bottom, front, back). I'm trying to generate a series of file inputs to allow the user to upload an image for each view. This is the result I'm after: ... <label>Top</label> <input type="file" name="image[Top]"><br> <label>Bottom</label> <input type="file" name="image[Bottom]"><br> <label>Front</label> <input type="file" name="image[Front']"><br> ... This is what I'm trying: <%= views = View.order('name ASC').all.map { |view| [view.name, view.id] } %> <%= views.each { |view| label(view); file_field('image', view) } %> However, all this does is print out the views array a couple of times. Hopefully you Rails experts can point me in the right direction. (I apologize in advance if I'm butchering Ruby.)

    Read the article

  • Flex/Flash: Don't show 'bar' cursor when dragging over a TextField/TextArea?

    - by David Wolever
    As the title suggests, how can I prevent the "bar" cursor from appearing when I click-and-drag over a TextField? For example, consider this interaction: I'd like to prevent the cursor changing to the "bar" in step "2". How can I do that? I've tried fiddling with the selectable flag: protected static function fixMouseOverAfordance(field:TextField):void { var iOwnClick:Boolean = false; function handleMouseOver(event:MouseEvent):void { if (event.buttonDown) { field.selectable = iOwnClick; } else { field.selectable = true; iOwnClick = false; } } field.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver, false, EventPriority.CURSOR_MANAGEMENT+1); field.addEventListener(MouseEvent.ROLL_OVER, handleMouseOver, false, EventPriority.CURSOR_MANAGEMENT+1); field.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseOver, false, EventPriority.CURSOR_MANAGEMENT+1); field.addEventListener(MouseEvent.MOUSE_DOWN, function(event:MouseEvent):void { iOwnClick = true; field.selectable = true; }); } But the "bar" cursor still appears the first time the mouse is moved over the text field (however, after it has been moved out then moved back in, it does the right thing).

    Read the article

  • Why are C, C++, and LISP so prevalent in embedded devices and robots?

    - by David
    It seems that the software language skills most sought for embedded devices and robots are C, C++, and LISP. Why haven't more recent languages made inroads into these applications? For example, Erlang would seem particularly well-suited to robotic applications, since it makes concurrent programming easier and allows hot swapping of code. Python would seem to be useful, if for no other reason than its support of multiple programming paradigms. I'm even surprised that Java hasn't made a foray into general robotic programming. I'm sure one argument would be, "Some newer languages are interpreted, not compiled" - implying that compiled languages are quicker and use fewer computational resources. Is this still the case, in a time when we can put a Java Virtual Machine on a cell phone or a SunSpot? (and isn't LISP interpreted anyway?)

    Read the article

  • Anyway to find out the current Windows is in lock mode?

    - by David.Chu.ca
    I have a windows application written in VS 2005. The application makes queries against to sql database in a timer cycle every 2 minutes. If there any data changes, the window will be refreshed with new data. If the user leaves the window, the windows will be automatically locked after a while. There is no sense to keep querying data in ever 2 minutes when the windows is locked; therefore I would like to stop the query when lock is on so that the network data trafic will be reduced and also saves the current windows resources such as memory and CPUs. I am not sure if there is any way to find out the current windows is locked? Not sure if there is any Windows APIs for this purpose if no .Net classes available? My project is in .Net 2.0 and all users are in Windows XP.

    Read the article

  • php clean up regex

    - by David
    hey can i clean up a preg_match in php from this: preg_match_all("/(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?(".$this->reg['wat'].")?/",$value,$match); to look like this: preg_match_all("/ (".$this->reg['wat'].")? (".$this->reg['wat'].")? (".$this->reg['wat'].")? (".$this->reg['wat'].")? (".$this->reg['wat'].")? (".$this->reg['wat'].")? (".$this->reg['wat'].")? /",$value,$match); right now each space, it counts as a ling break so it wont return any finds when searching. but it just looks cleaner and easier to read is why i ask you know. i was looking for one of those letters to add after the closing "/" in the regex. thanks

    Read the article

  • Losing jQuery functionality after postback

    - by David Lozzi
    I have seen a TON of people reporting this issue online, but no actual solutions. I'm not using AJAX or updatepanels, just a dropdown that posts back on selected index change. My HTML is <div id="myList"> <table id="ctl00_PlaceHolderMain_dlFields" cellspacing="0" border="0" style="border-collapse:collapse;"> <tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_PlaceHolderMain_dlFields_ctl00_lblDestinationField">Body</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$PlaceHolderMain$dlFields$ctl00$txtSource" type="text" id="ctl00_PlaceHolderMain_dlFields_ctl00_txtSource" class="ms-input" style="width:230px" /> <select name="ctl00$PlaceHolderMain$dlFields$ctl00$ddlSourceFields" id="ctl00_PlaceHolderMain_dlFields_ctl00_ddlSourceFields" class="ms-input"> <option value="Some Field Name 1">Some Field Name 1</option> <option value="Some Field Name 2">Some Field Name 2</option> <option value="Some Field Name 3">Some Field Name 3</option> <option value="Some Field Name 4">Some Field Name 4</option> </select> <a href="#" id="appendSelect">append</a> </td> </tr> </td> </tr><tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_PlaceHolderMain_dlFields_ctl01_lblDestinationField">Expires</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$PlaceHolderMain$dlFields$ctl01$txtSource" type="text" id="ctl00_PlaceHolderMain_dlFields_ctl01_txtSource" class="ms-input" style="width:230px" /> <select name="ctl00$PlaceHolderMain$dlFields$ctl01$ddlSourceFields" id="ctl00_PlaceHolderMain_dlFields_ctl01_ddlSourceFields" class="ms-input"> <option value="Some Field Name 1">Some Field Name 1</option> <option value="Some Field Name 2">Some Field Name 2</option> <option value="Some Field Name 3">Some Field Name 3</option> <option value="Some Field Name 4">Some Field Name 4</option> </select> <a href="#" id="appendSelect">append</a> </td> </tr> </td> </tr><tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_PlaceHolderMain_dlFields_ctl02_lblDestinationField">Title</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$PlaceHolderMain$dlFields$ctl02$txtSource" type="text" id="ctl00_PlaceHolderMain_dlFields_ctl02_txtSource" class="ms-input" style="width:230px" /> <select name="ctl00$PlaceHolderMain$dlFields$ctl02$ddlSourceFields" id="ctl00_PlaceHolderMain_dlFields_ctl02_ddlSourceFields" class="ms-input"> <option value="Some Field Name 1">Some Field Name 1</option> <option value="Some Field Name 2">Some Field Name 2</option> <option value="Some Field Name 3">Some Field Name 3</option> <option value="Some Field Name 4">Some Field Name 4</option> </select> <a href="#" id="appendSelect">append</a> </td> </tr> </td> </tr> </table></div> The above Div tag is static, and the table is generated from a DataList object. On postback the datalist reloads using a new dataset, for example <div id="myList"> <table id="ctl00_PlaceHolderMain_dlFields" cellspacing="0" border="0" style="border-collapse:collapse;"> <tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_PlaceHolderMain_dlFields_ctl00_lblDestinationField">Notes</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$PlaceHolderMain$dlFields$ctl00$txtSource" type="text" id="ctl00_PlaceHolderMain_dlFields_ctl00_txtSource" class="ms-input" style="width:230px" /> <select name="ctl00$PlaceHolderMain$dlFields$ctl00$ddlSourceFields" id="ctl00_PlaceHolderMain_dlFields_ctl00_ddlSourceFields" class="ms-input"> <option value="Some Field Name 1">Some Field Name 1</option> <option value="Some Field Name 2">Some Field Name 2</option> <option value="Some Field Name 3">Some Field Name 3</option> <option value="Some Field Name 4">Some Field Name 4</option> </select> <a href="#" id="appendSelect">append</a> </td> </tr> </td> </tr><tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_PlaceHolderMain_dlFields_ctl01_lblDestinationField">URL</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$PlaceHolderMain$dlFields$ctl01$txtSource" type="text" id="ctl00_PlaceHolderMain_dlFields_ctl01_txtSource" class="ms-input" style="width:230px" /> <select name="ctl00$PlaceHolderMain$dlFields$ctl01$ddlSourceFields" id="ctl00_PlaceHolderMain_dlFields_ctl01_ddlSourceFields" class="ms-input"> <option value="Some Field Name 1">Some Field Name 1</option> <option value="Some Field Name 2">Some Field Name 2</option> <option value="Some Field Name 3">Some Field Name 3</option> <option value="Some Field Name 4">Some Field Name 4</option> </select> <a href="#" id="appendSelect">append</a> </td> </tr> </td> </tr> </table></div> After the postback and the datalist is reloaded, my JQuery doesn't work anymore. No errors, nothing. I don't see any actual changes in the objects in the HTML that should cause this. How do I fix this? Any workarounds or bandaides I can apply? My JQuery is below <script type='text/javascript'> $(document).ready(function () { $('#myList a').live("click", function () { var $selectValue = $(this).siblings('select').val(); var $thatInput = $(this).siblings('input'); var val = $thatInput.val() + ' |[' + $selectValue + ']|'; $thatInput.val(jQuery.trim(val)); }) }); </script> Thanks!!

    Read the article

  • jquery mouseleave issue when moving too slow

    - by David
    Hello. I am using the jQuery mouseenter and mouseleave events to slide a div down and up. Everything works well except for the mouseleave which doesn't appear to fire ONLY if the mouse of moved off of the div quite slowly. If i move the mouse at a relatively normal or fast speed then it works as expected. Can anyone explain this or provide any info on how to get around this? Code: $(document).ready(function() { $('header').mouseenter(function() { $(this).stop().animate({'top' : '25px'}, 500, function() { $(this).delay(600).animate({'top' : '-50px'}, 500); }); }). mouseleave(function(e) { var position = $(this).position(); if (e.pageY > position.top + $(this).height()) { $(this).stop().delay(600).animate({'top' : '-75px'}, 500) ; } }); });

    Read the article

  • Regex "or" Expression

    - by David
    This is probably a really basic question, but I can't find any answers. I need to match a string by either one or more spaces OR an equals sign. When I split this string: 9 x 13 = (8.9 x 13.4) (89 x 134) with ( +) I get: part 0: 9 x 13 = (8.9 x 13.4) part 1: (89 x 134) When I split it with (=) I get: part 0: 9 x 13 part 1: (8.9 x 13.4) (89 x 134) How can split by BOTH? Something like: (=)OR( +) Edit: This does not work(=)|( +) Test it here: http://myregexp.com/ under "split".

    Read the article

  • converting a form from text to textarea

    - by David Cook
    I have a form created to pull PHP values into my database. I created the form with all type="text" constructions. What follows is the code that used to set up the input of data and confirmed that it is functional. <label>About Me: <input type="text" name="BIO_info"/></label> I converted the input to a textarea and adjusted some parameters for proper display. Unfortunately, it has broken the ability for the script to function. What follows is the code I wrote to convert and store from a text area input. <label for="BIO_info" style=" margin-bottom: 500px; margin-top: 2000px; ">About Me: <textarea name="BIO_info" rows="20" cols="60" style="resize: none; overflow-y: hidden;vertical-align:middle;"></textarea> <p> I would appreciate any suggestions.

    Read the article

  • Hidden links are still clickable on the Android browser

    - by David
    I've got a contextual menu that appears when a button is clicked. This menu has some links and after some seconds is hidden again. The problem is that after the menu has disappeared the links are still there. They are not shown but are clickable and the green border appears. And after some seconds they disappear. I've tryied many ways of hiding the menu: display: none, visibility: hidden, width: 0, height: 0, jquery hide, jquery fadeout... but none worked. Also hidding the links. Does anyone have a idea about what's happening? With the rest of the browsers it works without problem Thanks

    Read the article

  • And now for a complete change of direction from C++ function pointers

    - by David
    I am building a part of a simulator. We are building off of a legacy simulator, but going in different direction, incorporating live bits along side of the simulated bits. The piece I am working on has to, effectively route commands from the central controller to the various bits. In the legacy code, there is a const array populated with an enumerated type. A command comes in, it is looked up in the table, then shipped off to a switch statement keyed by the enumerated type. The type enumeration has a choice VALID_BUT_NOT_SIMULATED, which is effectively a no-op from the point of the sim. I need to turn those no-ops into commands to actual other things [new simulated bits| live bits]. The new stuff and the live stuff have different interfaces than the old stuff [which makes me laugh about the shill job that it took to make it all happen, but that is a topic for a different discussion]. I like the array because it is a very apt description of the live thing this chunk is simulating [latching circuits by row and column]. I thought that I would try to replace the enumerated types in the array with pointers to functions and call them directly. This would be in lieu of the lookup+switch.

    Read the article

  • conflicting cygwin and windows path

    - by David
    if my windows path looks like this: c:\ruby\bin;c:\cygwin\bin then when i go into cgywin and enter "ruby" it will execute the ruby from c:\ruby\bin, failing to find the ruby installed in my cygwin. I have to exclude that path so cygwin would execute the one from /usr/bin. But i need those 2 paths, since i want to run ruby in windows too. Anyway to have cygwin have its own path and not inherit those in windows? thanks.

    Read the article

  • How do I make an iframe 100% height of a containing div in Firefox?

    - by David
    I'm having some trouble figuring out how to extend an iframe to 100% of it's container element in Firefox and IE (it works fine in Chrome). From searching around, it makes sense that there has to be a width specified on the containing div (and possibly body and html as well). However, I have done that, and the iframe is still not extending. Do all of the parent divs have to have a specified width and position for this to work, or just the containing parent? Any fix for this would be greatly appreciated! Here's what I have: <!DOCTYPE html> <html> <head> <style> html, body {margin:0; padding:0; height:100%} #container {width: 1000px; min-height: 550px; position: relative} #smallContainer {position:relative} /*no width specified*/ #iframeContainer {height: 100%; position: relative} #iframe {height: 100%; width: 100%; display: block} </style> </head> <body> <div id="container"> <div id="smallContainer"> <div id="iframeContainer"> <iframe id="iframe" src="foo.com"></iframe> </div> </div> </div> </body> </html>

    Read the article

  • Proper structure for dependency injection (using Guice)

    - by David B.
    I would like some suggestions and feedback on the best way to structure dependency injection for a system with the structure described below. I'm using Guice and thus would prefer solutions centered around it's annotation-based declarations, not XML-heavy Spring-style configuration. Consider a set of similar objects, Ball, Box, and Tube, each dependent on a Logger, supplied via the constructor. (This might not be important, but all four classes happen to be singletons --- of the application, not Gang-of-Four, variety.) A ToyChest class is responsible for creating and managing the three shape objects. ToyChest itself is not dependent on Logger, aside from creating the shape objects which are. The ToyChest class is instantiated as an application singleton in a Main class. I'm confused about the best way to construct the shapes in ToyChest. I either (1) need access to a Guice Injector instance already attached to a Module binding Logger to an implementation or (2) need to create a new Injector attached to the right Module. (1) is accomplished by adding an @Inject Injector injectorfield to ToyChest, but this feels weird because ToyChest doesn't actually have any direct dependencies --- only those of the children it instantiates. For (2), I'm not sure how to pass in the appropriate Module. Am I on the right track? Is there a better way to structure this? The answers to this question mention passing in a Provider instead of using the Injector directly, but I'm not sure how that is supposed to work. EDIT: Perhaps a more simple question is: when using Guice, where is the proper place to construct the shapes objects? ToyChest will do some configuration with them, but I suppose they could be constructed elsewhere. ToyChest (as the container managing them), and not Main, just seems to me like the appropriate place to construct them.

    Read the article

  • mysql select where count = 0

    - by david parloir
    Hi, In my db, I have a "sales" table and a "sales_item". Sometimes, something goes wrong and the sale is recorded but not the sales item's. So I'm trying to get the salesID from my table "sales" that haven't got any rows in the sales_item table. Here's the mysql query I thought would work, but it doesn't: SELECT s.* FROM sales s NATURAL JOIN sales_item si WHERE s.date like '" . ((isset($_GET['date'])) ? $_GET['date'] : date("Y-m-d")) . "%' AND v.sales_id like '" . ((isset($_GET['shop'])) ? $_GET['shop'] : substr($_COOKIE['shop'], 0, 3)) ."%' HAVING count(si.sales_item_id) = 0; Any thoughts?

    Read the article

  • Problem with modifying a page with ajax, and the browser keeping the unmodified page in cache.

    - by David Lawson
    Hey there, I have a situation where my page loads some information from a database, which is then modified through AJAX. I click a link to another page, then use the 'back' button to return to the original page. The changes to the page through AJAX I made before don't appear, because the browser has the unchanged page stored in the cache. Is there a way of fixing this without setting the page not to cache at all? Thanks :)

    Read the article

  • How to SUM columns on multiple conditions in a GROUP BY

    - by David Liddle
    I am trying to return a list of Accounts with their Balances, Outcome and Income Account Transaction ------- ----------- AccountID TransactionID BankName AccountID Locale Amount Status Here is what I currently have. Could someone explain where I am going wrong? select a.ACCOUNT_ID, a.BANK_NAME, a.LOCALE, a.STATUS, sum(t1.AMOUNT) as BALANCE, sum(t2.AMOUNT) as OUTCOME, sum(t3.AMOUNT) as INCOME from ACCOUNT a left join TRANSACTION t1 on t1.ACCOUNT_ID = a.ACCOUNT_ID left join TRANSACTION t2 on t1.ACCOUNT_ID = a.ACCOUNT_ID and t2.AMOUNT < 0 left join TRANSACTION t3 on t3.ACCOUNT_ID = a.ACCOUNT_ID and t3.AMOUNT > 0 group by a.ACCOUNT_ID, a.BANK_NAME, a.LOCALE, a.[STATUS]

    Read the article

  • How can I change a connection string, or other app settings, at test time in Visual Studio 2008?

    - by David
    I need to test a class library project in VS. This project, itself, does not have a web.config file, but the classes do on the web server to which it's deployed. I access these like this: ConfigurationManager.ConnectionStrings["stringname"].ConnectionString; Can I adjust these strings while running unit tests in VS? Should I have considered a different design method to avoid this problem?

    Read the article

  • using empty on inaccessible object with __isset and __get

    - by David
    <?php class Magic_Methods { protected $meta; public function __construct() { $this->meta = (object) array( 'test' => 1 ); } public function __isset($name) { echo "pass isset {$name} \n"; return isset($this->$name); } public function __get($name) { echo "pass get {$name} \n"; return $this->$name; } } $mm = new Magic_Methods(); $meta = empty($mm->meta->notExisting); var_dump($meta); echo "||\n"; $meta = empty($mm->meta); var_dump($meta); The snippet above does not work as expected for me. Why would the first empty() ommit the __isset? I get this: pass get meta bool(true) || pass isset meta pass get meta bool(false) I would expected identical results or another pass at the __isset, but not a direct call to __get. Or am I missing something here?

    Read the article

  • Trouble with go tour crawler exercise

    - by David Mason
    I'm going through the go tour and I feel like I have a pretty good understanding of the language except for concurrency. On slide 71 there is an exercise that asks the reader to parallelize a web crawler (and to make it not cover repeats but I haven't gotten there yet.) Here is what I have so far: func Crawl(url string, depth int, fetcher Fetcher, ch chan string) { if depth <= 0 { return } body, urls, err := fetcher.Fetch(url) if err != nil { ch <- fmt.Sprintln(err) return } ch <- fmt.Sprintf("found: %s %q\n", url, body) for _, u := range urls { go Crawl(u, depth-1, fetcher, ch) } } func main() { ch := make(chan string, 100) go Crawl("http://golang.org/", 4, fetcher, ch) for i := range ch { fmt.Println(i) } } The issue I have is where to put the close(ch) call. If I put a defer close(ch) somewhere in the Crawl method, then I end up writing to a closed channel in one of the spawned goroutines, since the method will finish execution before the spawned goroutines do. If I omit the call to close(ch), as is shown in my example code, the program deadlocks after all the goroutines finish executing but the main thread is still waiting on the channel in the for loop since the channel was never closed.

    Read the article

  • Sorting a list of numbers with modified cost

    - by David
    First, this was one of the four problems we had to solve in a project last year and I couldn’t find a suitable algorithm so we handle in a brute force solution. Problem: The numbers are in a list that is not sorted and supports only one type of operation. The operation is defined as follows: Given a position i and a position j the operation moves the number at position i to position j without altering the relative order of the other numbers. If i j, the positions of the numbers between positions j and i - 1 increment by 1, otherwise if i < j the positions of the numbers between positions i+1 and j decreases by 1. This operation requires i steps to find a number to move and j steps to locate the position to which you want to move it. Then the number of steps required to move a number of position i to position j is i+j. We need to design an algorithm that given a list of numbers, determine the optimal (in terms of cost) sequence of moves to rearrange the sequence. Attempts: Part of our investigation was around NP-Completeness, we make it a decision problem and try to find a suitable transformation to any of the problems listed in Garey and Johnson’s book: Computers and Intractability with no results. There is also no direct reference (from our point of view) to this kind of variation in Donald E. Knuth’s book: The art of Computer Programing Vol. 3 Sorting and Searching. We also analyzed algorithms to sort linked lists but none of them gives a good idea to find de optimal sequence of movements. Note that the idea is not to find an algorithm that orders the sequence, but one to tell me the optimal sequence of movements in terms of cost that organizes the sequence, you can make a copy and sort it to analyze the final position of the elements if you want, in fact we may assume that the list contains the numbers from 1 to n, so we know where we want to put each number, we are just concerned with minimizing the total cost of the steps. We tested several greedy approaches but all of them failed, divide and conquer sorting algorithms can’t be used because they swap with no cost portions of the list and our dynamic programing approaches had to consider many cases. The brute force recursive algorithm takes all the possible combinations of movements from i to j and then again all the possible moments of the rest of the element’s, at the end it returns the sequence with less total cost that sorted the list, as you can imagine the cost of this algorithm is brutal and makes it impracticable for more than 8 elements. Our observations: n movements is not necessarily cheaper than n+1 movements (unlike swaps in arrays that are O(1)). There are basically two ways of moving one element from position i to j: one is to move it directly and the other is to move other elements around i in a way that it reaches the position j. At most you make n-1 movements (the untouched element reaches its position alone). If it is the optimal sequence of movements then you didn’t move the same element twice.

    Read the article

< Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >