Search Results

Search found 16230 results on 650 pages for 'three js'.

Page 31/650 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Query to find all bars that sell three different beers at the same price

    - by Eternal Learner
    Query to find "All bars that sell three different beers at the same price?" My Tables are Sells(bar,beer,price) - bar - foreign Key.. Bars(name,addr) - name primary key. I thought of something like this but that dosent seem to work ... Select A.bar As bar , B.bar as bar From Sells AS A, Sells AS B Where A.bar = B.bar and A.beer <> B.beer Group By(A.beer) Having Count(Distinct A.beer) >= 2 Is this the correct SQL query ?

    Read the article

  • Three boolean values saved in one tinyint

    - by Casper
    Hello, probably a simple question but I seem to be suffering from programmer's block. :) I have three boolean values: A, B, and C. I would like to save the state combination as an unsigned tinyint (max 255) into a database and be able to derive the states from the saved integer. Even though there are only a limited number of combinations, I would like to avoid hard-coding each state combination to a specific value (something like if A=true and B=true has the value 1). I tried to assign values to the variables so (A=1, B=2, C=3) and then adding, but I can't differentiate between A and B being true from i.e. only C being true. I am stumped but pretty sure that it is possible. Thanks

    Read the article

  • How can I use edit_in_place on three different models from a View for a model those three belong_to?

    - by Angela
    I have a model called Campaign. In the controller, I do the following to list, in order, the three Models that belong_to a Campaign: <% @campaign_events = campaign_events %> <% @campaign_events.each do |campaign_event| %> <% model_name = campaign_event.class.name.tableize.singularize %> <p> <%= link_to campaign_event.title, send("#{model_name}_path", campaign_event) %> <span class='model_name'>(<%= model_name.capitalize %>)</span> <%= campaign_event.days %> Days </p> <% end %> campaign_event is a campaign_helper defined as: module CampaignsHelper def campaign_events return (@campaign.calls + @campaign.emails + @campaign.letters).sort{|a,b| a.days <=> b.days} end end I want to be able to click on the numerical value for Days when looking at the view/campaign/show and edit the value for :days (in this case, displayed as campaign_event.days

    Read the article

  • MySQL GROUP BY with three tables

    - by Psaniko
    I have the following tables: posts (post_id, content, etc) comments (comment_id, post_id, content, etc) posts_categories (post_category_id, post_id, category_id) and this query: SELECT `p`.*, COUNT(comments.comment_id) AS cmts, posts_categories.*,comments.* FROM `posts` AS `p` LEFT JOIN `posts_categories` ON `p`.post_id = `posts_categories`.post_id LEFT JOIN `comments` ON `p`.post_id = `comments`.post_id GROUP BY `p`.`post_id` There are three comments on post_id=1 and four in total. In posts_categories there are two rows, both assigned to post_id=1. I have four rows in posts. But if I query the statement above I get a result of 6 for COUNT(comments.comment_id) at post_id=1. How is this possible? I guess the mistake is somewhere in the GROUP BY clause but I can't figure out where. Any suggestions?

    Read the article

  • which type is best for three radiobuttons?

    - by Manog
    Maybe you consider this question trivial but im just curious what is your opinion. I have three radiobuttons. "Show blue", "Show red" and "Show all". I did it with nullable boolean. There is collumn in database where blue is 0 and red is 1 so in metode i have to translate bool to int to compare those values (i do it in c#).Of course it works, but i wonder if it is the best solution. And question is wich type is best in this case? nullable bool, int, or maybe string?

    Read the article

  • Creating a row of Three Boxes Seperated

    - by Frank G.
    I am new to css and I have a menu bar that I am working on however I am having a problem with one of the menu ("LINKS") items. If you roll over the Links menu item your notice I have three boxes there that I am trying to separate into there own area. Right now they are over lapping each other. Could you please tell me what I am doing wrong? I have tried margin-left and padding-left and I find that they either move the box further to the right or widen the box more. But they don't space them out. You can find the menu bar here: http://jsfiddle.net/vtjPR/

    Read the article

  • Rails valiation among a three model relationship

    - by Andrew
    I'm working on a three model relationship with one aspect that I'm not sure how to approach. Here's the basic relationship: class Taxonomy has_many :terms # attribute: `inclusive`, default => false end class Term belongs_to :taxonomy has_and_belongs_to_many :photos end class Photo has_and_belongs_to_many :terms end This is pretty straightforward stuff except for one thing: A Taxonomy can be either 'Inclusive' or 'Exclusive'. Exclusive means the terms are mutually exclusive, Inclusive means they're not. So, if a Taxonomy is exclusive ie. taxonomy.inclusive = false, then there can only be one term from that taxonomy attached to a given photo. Now, I can handle this on the client-side without a problem, but I am not quite sure how to set up a validation on Photos (or somewhere else) that says basically: "validate that no more than one term from an exclusive taxonomy is associated with this record." Any ideas on how to do that?

    Read the article

  • algorithm to find the three majority elements in an array

    - by Qiang Li
    Let's say there are three elements in a non-sorted array all of which appear more than one-fourth times of the total number of elements. What is the most efficient way to find these elements? Both for non-online and online versions of this question. Thank you! Edit The non-online version I was referring to is: this array is specified in full. The online version means the array elements are coming one at a time. I require the space in addition to time complexity to be tight. disclaimer: THIS IS NOT HOMEWORK! I consider this as research-level question.

    Read the article

  • Resolving "not found" messages after doing ./configure building node.js

    - by duke
    Hello I am trying to install node.js on debian AMD64. I got node.js from git. When I do ./configure a bunch of "checking for program" messages say "not found". I want to resolve all these and ensure everything needed is present. Can anyone suggest what I need to do to resolve the "not found" messages? Thanks heaps. server:/devel/node# ./configure Checking for program g++ or c++ : /usr/bin/g++ Checking for program cpp : /usr/bin/cpp Checking for program ar : /usr/bin/ar Checking for program ranlib : /usr/bin/ranlib Checking for g++ : ok Checking for program gcc or cc : /usr/bin/gcc Checking for gcc : ok Checking for library dl : yes Checking for library execinfo : not found Checking for openssl : not found Checking for function SSL_library_init : yes Checking for header openssl/crypto.h : yes Checking for library rt : yes --- libeio --- Checking for library pthread : yes Checking for function pthread_create : yes Checking for function pthread_atfork : yes Checking for futimes(2) : yes Checking for readahead(2) : yes Checking for fdatasync(2) : yes Checking for pread(2) and pwrite(2) : yes Checking for sendfile(2) : yes Checking for sync_file_range(2) : yes --- libev --- Checking for header sys/inotify.h : yes Checking for function inotify_init : yes Checking for header sys/epoll.h : yes Checking for function epoll_ctl : yes Checking for header port.h : not found Checking for header poll.h : yes Checking for function poll : yes Checking for header sys/event.h : not found Checking for header sys/queue.h : yes Checking for function kqueue : not found Checking for header sys/select.h : yes Checking for function select : yes Checking for header sys/eventfd.h : not found Checking for SYS_clock_gettime : yes Checking for library rt : yes Checking for function clock_gettime : yes Checking for function nanosleep : yes Checking for function ceil : yes Checking for fdatasync(2) with c++ : yes 'configure' finished successfully (1.479s) server:/devel/node#

    Read the article

  • Gnome-shell fails to load on 12.10

    - by Githlar
    I'm usually the one answering questions, but in this I'm throughly stumped! My Setup: Ubuntu 12.10 (Dist upgrade form 12.04) ATI M96 [Mobility Radeon HD 4650] Upon the first installation of 12.10 I had all kinds of issues getting the Legacy ATI drivers to install (I guess the source for the drivers isn't kosher with kernel 3.5). So, I added the repository ppa:makson96/fglrx - which has a version of the ATI source patched to work with kernel 3.5. After installation of fglrx-legacy from that PPA, gnome-shell and all my graphics work fine... until today. The Problem I unsuspended my computer today and the screen was black (not off, the black from the gnome lock screen). I'd move my mouse/hit a key and the background would flash and then it'd go back to black. Restarted via VT1 Logged into Gnome (gnome-shell) session, but no gnome-shell! Investigation: First, I went to VT1 and tried export DISPLAY=:0;gnome-shell --replace. It appeared to work fine, switch back to X and nothing. Went back to VT1 and saw this error message: JS ERROR: !!! Exception was: TypeError: Object 0x7fc748129c30 is not a subclass of (null), it's a xO JS ERROR: !!! message = '"Object 0x7fc748129c30 is not a subclass of (null), it's a xO"' JS ERROR: !!! fileName = '"/usr/share/gnome-shell/js/ui/tweener.js"' JS ERROR: !!! lineNumber = '218' JS ERROR: !!! stack = '"()@/usr/share/gnome-shell/js/ui/tweener.js:218 wrapper()@/usr/share/gjs-1.0/lang.js:204 ()@/usr/share/gjs-1.0/lang.js:145 ()@/usr/share/gjs-1.0/lang.js:239 init()@/usr/share/gnome-shell/js/ui/tweener.js:49 init()@/usr/share/gnome-shell/js/ui/environment.js:96 @<main>:1 "' Window manager warning: Log level 32: Execution of main.js threw exception: TypeError: Object 0x7fc748129c30 is not a subclass of (null), it's a xO Note: Everywhere it says "it's a xO", xO is actually garbled and changes every time (I'm thinking memory corruption?) This error is thrown by line 96 of /usr/share/gnome-shell/js/ui/environment.js: tweener.Init() Did a purge of fglrx-legacy, reboot, reinstall fglrx-legacy, reboot... same thing. Did a ppa-purge of ppa:gnome3-team/gnome3, and reinstalled gnome-shell and ubuntu-desktop from the standard repositores... same thing. I'm really at a loss here. I love gnome-shell and after using it for nearly a year now gnome classic just seems so archaic. Additional Information Apt log from the day I first suspended my machine (these are upgrades from the gnome3-team/gnome3 ppa and ubuntu-wine/ppa ppa): Start-Date: 2012-11-24 17:30:28 Commandline: aptdaemon role='role-commit-packages' sender=':1.618' Install: gkbd-capplet:amd64 (3.6.0-0ubuntu1), gnome-control-center-unity:amd64 (1.0-0ubuntu1~ubuntu12.10.1) Upgrade: nautilus:amd64 (3.6.2-0ubuntu0.1~quantal1, 3.6.3-0ubuntu2~ubuntu12.10.1), libgnome-control-center1:amd64 (3.4.2-0ubuntu19, 3.6.3-0ubuntu6~ubuntu12.10.1), wine1.5-i386:i386 (1.5.17-0ubuntu4, 1.5.18-0ubuntu1), wine1.5:amd64 (1.5.17-0ubuntu4, 1.5.18-0ubuntu1), gnome-settings-daemon:amd64 (3.4.2-0ubuntu14, 3.6.3-0ubuntu1~ubuntu12.10.1), gnome-control-center-data:amd64 (3.4.2-0ubuntu19, 3.6.3-0ubuntu6~ubuntu12.10.1), gnome-accessibility-themes:amd64 (3.6.0.2-0ubuntu1, 3.6.2-0ubuntu2~ubuntu12.10.1), gnome-themes-standard:amd64 (3.6.0.2-0ubuntu1, 3.6.2-0ubuntu2~ubuntu12.10.1), wine1.5-amd64:amd64 (1.5.17-0ubuntu4, 1.5.18-0ubuntu1), nautilus-data:amd64 (3.6.2-0ubuntu0.1~quantal1, 3.6.3-0ubuntu2~ubuntu12.10.1), gnome-control-center:amd64 (3.4.2-0ubuntu19, 3.6.3-0ubuntu6~ubuntu12.10.1), libnautilus-extension1a:amd64 (3.6.2-0ubuntu0.1~quantal1, 3.6.3-0ubuntu2~ubuntu12.10.1) End-Date: 2012-11-24 17:31:32 fglrxinfo (driver appears to be working): display: :0 screen: 0 OpenGL vendor string: Advanced Micro Devices, Inc. OpenGL renderer string: ATI Mobility Radeon HD 4650 OpenGL version string: 3.3.11653 Compatibility Profile Context Does anybody have any further ideas?

    Read the article

  • Prolog: How to make three lists the same lenght (by adding leading zeros)

    - by sixtyfootersdude
    I am writing a prolog program to solve a problem. The problem takes three lists as input: solve( [L|Lr] , [R|Rr] , [S|Sr] ) :- Unfortunately the lists all need to be equal length for the program to work. So these work: ?- solve( [A, B, C, D] , [1, 3, 5, 6], [E, F, G, H]). ?- solve( [1] , [2], [3]). But these do not: ?- solve( [A, B, C, D], [1], [B, I, T] ). ?- solve( [A], [1, 2], [4, 5]). What I would like to do is write a predicate(?) to pad the smaller lists with leading zeros. So: solve( [A, B, C, D], [1], [B, I, T] ) would become: solve( [A, B, C, D], [0, 0, 0, 1], [0, B, I, T] ) Any points on how to accomplish this would be awesome. I am from a functional background so I am struggling. Is there a way tell the length of a list? I think I could do that recursively, but it seems like a pain. Thanks

    Read the article

  • Creating a WCF ServiceHost object takes three to four minutes on some PCs

    - by Steve
    Hello, I have created a WCF service which does not use the app.config to configure itself. However, it takes three to four minutes on some PCs to construct the ServiceHost object. Thinking there was something wrong with my service, I constructed a simple Hello, World service and tried it with that. I have the same issue. According to the profiler, all this time is spent reading in configuration for the service. So I have two questions really. Is it possible to disable reading config from the XML? More importantly, does anyone have any idea why this might be taking such an inordinate amount of time? Here is the sample service: [ServiceContract] public interface IMyService { [OperationContract] string GetString(); } [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)] public class MyService : IMyService { public string GetString() { return "Hello, world!"; } } class Program { static void Main(string[] args) { Uri epAddress = new Uri("http://localhost:8731/Test"); Uri[] uris = new Uri[] { epAddress }; MyService srv = new MyService(); ServiceHost host = new ServiceHost(srv, uris); // this line takes 3-4 minutes host.AddServiceEndpoint(typeof(IMyService), new WSHttpBinding(), "Test"); ServiceMetadataBehavior smb = new ServiceMetadataBehavior(); smb.HttpGetEnabled = true; host.Description.Behaviors.Add(smb); host.Open(); return; } } I need for design reasons to create the service and pass it in as an object, rather than passing it in as a type. If there's any more information that can be of use, please let me know. Many thanks.

    Read the article

  • 960 GridSystem, three grid_4 inside one grid_12

    - by Olle
    I've created a 16 column layout with 960gs with a div class="grid_12" and after that a grid_4 (12+4...) Inside that grid_12 I wanted a three column style (3 grid_4). But the grid_4 boxes don't fit inside the grid_12, the last box drop into a second row. Shouldn't the 960gs framework be able to do this layout for me, have i missed anything? Thanks in advance. <div class="container_16"> ... <div id="main" class="grid_12"> <div class="grid_12"> <div class="grid_4"></div> <div class="grid_4"></div> <div class="grid_4"></div> </div> <div id="right" class="grid_4"> </div> </div> ... </div>

    Read the article

  • Oracle Forms on-button-pressed trigger to solve three scenarios

    - by DBase486
    Hello, I'm writing a when-button-pressed trigger on a save button for an Oracle Forms 6i form, and it has to fulfill a couple of scenarios. Here's some background information: the fields we're primarily concerned with are: n_number, alert_id, end_date For all three scenarios we are comparing candidate records against the following records in the database (for the sake of argument, let's assume they're the only records in the database so far): alert_id|| n_number|| end_date ------------------------------------- 1|| 5|| _______ 2|| 6|| 10/25/2009 Scenario 1: The user enters a new record: alert_id 1 n_number 5 end_date NULL Objective: prevent the user from committing duplicate rows Scenario 2: The user enters a new record: alert_id 1 n_number 10 end_date NULL Objective: Notify the user that this alert_id already exists, but allow the user the ability to commit the row, if desired. Scenario 3: The user enters a new record: alert_id 2 n_number 6 end_date NULL Objective: Notify the user that this alert_id has occurred in the past (i.e. it has a not-null end_date), but allow the user to commit the row, if desired. I've written the code, which seems to comply with the first two scenarios, but prevents me from fulfilling the third. Issues: When I enter the third scenario case, I am prompted to commit the record, but when I attempt this, the "duplicate_stop" alert pops up, preventing me. Issues: I'm getting the following error: ORA-01843: not a valid month. While testing the code for the third scenario in Toad (hard-coding the values, etc) things seemed to be fine. Why would I encounter these problems at run-time? Help is very much appreciated. Thank you

    Read the article

  • Hash Code for a group of three fields

    - by Gauranga
    I have three fields namely Number1 Number2 Time I am trying to write a function in java that returns a unique hash value (long needs to be the return type of hash) for the above fields. This hash would then be used to store database rows corresponding to the above mentioned fields in a HashSet. I am new to writing a hash code function, can someone please review what I have. Any help would be appreciated. public class HashCode { private long Number1; private long Number2; String Time; public HashCode(long Number1, long Number2, String Time){ this.Number1 = Number1; this.Number2 = Number2; this.Time = Time; } public long getHashCode() { long hash = 3; hash = 47 * hash + (long) (this.Number1 ^ (this.Number1 >>> 32)); hash = 47 * hash + (long) (this.Number2 ^ (this.Number2 >>> 32)); hash = 47 * hash + (this.Time != null ? this.Time.hashCode() : 0); return hash; } }

    Read the article

  • Three most critical programming concepts

    - by Todd
    I know this has probably been asked in one form or fashion but I wanted to pose it once again within the context of my situation (and probably others here @ SO). I made a career change to Software Engineering some time ago without having an undergrad or grad degree in CS. I've supplemented my undergrad and grad studies in business with programming courses (VB, Java,C, C#) but never performed academic coursework in the other related disciplines (algorithms, design patterns, discrete math, etc.)...just mostly self-study. I know there are several of you who have either performed interviews and/or made hiring decisions. Given recent trends in demand, what would you say are the three most essential Comp Sci concepts that a developer should have a solid grasp of outside of language syntax? For example, I've seen blog posts of the "Absolute minimum X that every programmer must know" variety...that's what I'm looking for. Again if it's truly a redundancy please feel free to close; my feelings won't be hurt. (Closest ones I could find were http://stackoverflow.com/questions/164048/basic-programming-algorithmic-concepts- which was geared towards a true beginner, and http://stackoverflow.com/questions/648595/essential-areas-of-knowledge-which I didn't feel was concrete enough). Thanks in advance all! T.

    Read the article

  • Join with Three Tables

    - by John
    Hello, In MySQL, I am using the following three tables (their fields are listed after their titles): comment: commentid loginid submissionid comment datecommented login: loginid username password email actcode disabled activated created points submission: submissionid loginid title url displayurl datesubmitted I would like to display "datecommented" and "comment" for a given "username," where "username" equals a variable called $profile. I would also like to make the "comment" a hyperlink to http://www...com/.../comments/index.php?submission='.$rowc["title"].'&submissionid='.$rowc["submissionid"].'&url='.$rowc["url"].'&countcomments='.$rowc["countComments"].'&submittor='.$rowc["username"].'&submissiondate='.$rowc["datesubmitted"].'&dispurl='.$rowc["displayurl"].' where countComments equals COUNT(c.commentid) and $rowc is part of the query listed below. I tried using the code below to do what I want, but it didn't work. How could I change it to make it do what I want? Thanks in advance, John $sqlStrc = "SELECT s.loginid ,s.title ,s.url ,s.displayurl ,s.datesubmitted ,l.username ,l.loginid ,s.title ,s.submissionid ,c.comment ,c.datecommented ,COUNT(c.commentid) countComments FROM submission s INNER JOIN login l ON s.loginid = l.loginid LEFT OUTER JOIN comment c ON c.loginid = l.loginid WHERE l.username = '$profile' GROUP BY c.loginid ORDER BY s.datecommented DESC LIMIT 10"; $resultc = mysql_query($sqlStrc); $arrc = array(); echo "<table class=\"samplesrec1c\">"; while ($rowc = mysql_fetch_array($resultc)) { $dtc = new DateTime($rowc["datecommented"], $tzFromc); $dtc->setTimezone($tzToc); echo '<tr>'; echo '<td class="sitename3c">'.$dtc->format('F j, Y &\nb\sp &\nb\sp g:i a').'</a></td>'; echo '<td class="sitename1c"><a href="http://www...com/.../comments/index.php?submission='.$rowc["title"].'&submissionid='.$rowc["submissionid"].'&url='.$rowc["url"].'&countcomments='.$rowc["countComments"].'&submittor='.$rowc["username"].'&submissiondate='.$rowc["datesubmitted"].'&dispurl='.$rowc["displayurl"].'">'.stripslashes($rowc["comment"]).'</a></td>'; echo '</tr>'; } echo "</table>";

    Read the article

  • PHP: Three item validation comparison

    - by DavidYell
    I have 3 featured product panels on the homepage, and I'm writing a CMS page for it. I'm trying to validate the items. They are selected via three <select> elements, featured1, featured2 and featured3. The default is <option value="0" selected>Select an element</option> I need to validate the $_POST to ensure that the user hasn't selected the same product for more than one of the panels. I have worked out that each $_POST needs to be $_POST['featuredN'] > 0 but I can't seem to find a logical way of processing the 7 potential outcomes. Using a logic table, where 1 is a set value. 1 2 3 ------- 0 0 0 1 1 1 1 0 0 0 1 0 0 0 1 1 1 0 0 1 1 If an item is 0, then I will not update it, but I want the user to be able to update a single item if needs be. I cannot find a logical way to see if the item is not 0, and then compare it to another item if that also is not 0. So far my colleague suggested, adding up the values. Which works to see if condition 1 0 0 0 is not met. I have a vague feeling that some form of recursive function might be in order, but I can't quite get my brain to help me on this one! So to the collective brain! :)

    Read the article

  • Finding and marking the largest of three values in a two dimensional array

    - by DavidYell
    I am working on a display screen for our office, and I can't seem to think of a good way to find the largest numerical value in a set of data in a two dimensional array. I've looked at using max() and also asort() but they don't seem to cope with a two dimensional array. I'm returning my data through our mysql class, so the rows are returned in a two dimensional array. Array( [0] => Array( [am] => 12, [sales] => 981), [1] => Array( [am] => 43, [sales] => 1012), [2] => Array( [am] => 17, [sales] => 876) ) I need to output a class when foreaching the data in my table for the AM with the highest sales value. Short of comparing them all in if statements. I have tried to get max() on the array, but it returns an array, as it's look within the dimension. When pointing it at a specific dimension it returns the key not the value. I figured that I could asort() the array and pop the top value off, store it in a variable and then compare against that in my foreach() loop, but that seems to have trouble sorting across two dimensions. Lastly, I figured that I could foreach() the values, comparing them against the previous one each time, untill I found the largest. This approach however means storing every value, luckily only three, but then comparing against them all again. Surely there must be a simpler way to achieve this, short of converting it into a single dimension array, then doing an asort() on that?

    Read the article

  • LINQ Sorting - First three need to be different manufacturers

    - by Rob
    My OM has a 'product' object. Each product has a 'manufacturer id' (property, integer). When I have a list of products to display, the first three are displayed as the 'featured products'. The list is already sorted in a specific sort order, putting the 'featured' products first in the list. However, I now need to ensure the featured products in the listing are from different Manufacturers. I want to have a method to call to do this re-sorting. Trying to utilize LINQ to to the querying of the input 'products' and the 'results' public List<Product> SetFeatures(List<Product> products, int numberOfFeatures) { List<Product> result; // ensure the 2nd product is different manufacturer than the first .... // ensure the 3rd product is a different manufacturer than the first two... // ... etc ... for the numberOfFeatures return result; } Thanks in advance.

    Read the article

  • Problem with JS Selectbox Function

    - by Thomas
    I have a selectbox with three options. When a user selects one of the three options, I want a specific div to appear below it. I am trying to write the code that dictates which specific box is to appear when each of the three options is selected. So far, I have only worked on the code that pertains to the first option. However, whenever the user selects any of the three options from the selectbox, the function for the first option is triggered and the div is displayed. My question is two part: 1) How do I write a conditional function that specifically targets the selected option 2) What is the best way to accomplish what I have described above; How do I efficiently go about defining three different functions for three different options in a select box? Here is the function I was working on for the first option: $(document).ready(function(){ var subTableDiv = $("div.subTableDiv"); var subTableDiv1 = $("div.subTableDiv1"); var subTableDiv2 = $("div.subTableDiv2"); subTableDiv.hide(); subTableDiv1.hide(); subTableDiv2.hide(); var selectmenu=document.getElementById("customfields-s-18-s"); selectmenu.onchange=function(){ //run some code when "onchange" event fires var chosenoption=this.options[this.selectedIndex].value //this refers to "selectmenu" if (chosenoption.value ="Co-Op"){ subTableDiv1.slideDown("medium"); } } }); Html: <tr> <div> <select name="customfields-s-18-s" class="dropdown" id="customfields-s-18-s" > <option value="Condominium"> Condominium</option> <option value="Co-Op"> Co-Op</option> <option value="Condop"> Condop</option> </select> </div> </tr> <tr class="subTable"> <td colspan="2"> <div style="background-color: #EEEEEE; border: 1px solid #CCCCCC; padding: 10px;" id="Condominium" class="subTableDiv">Hi There! This is the first Box</div> </td> </tr> <tr class="subTable"> <td colspan="2"> <div style="background-color: #EEEEEE; border: 1px solid #CCCCCC; padding: 10px;" id="Co-Op" class="subTableDiv1">Hi There! This is the Second Box</div> </td> </tr> <tr class="subTable"> <td colspan="2"> <div style="background-color: #EEEEEE; border: 1px solid #CCCCCC; padding: 10px;" id="Condop" class="subTableDiv2">Hi There! This is the Third Box.</div> </td> </tr>

    Read the article

  • Rails 3: How do I call a javascript function from a js.erb file

    - by user321775
    Now that I've upgraded to Rails 3, I'm trying to figure out the proper way to separate and reuse pieces of javascript. Here's the scenario I'm dealing with: I have a page with two areas: one with elements that should be draggable, the other with droppables. When the page loads I use jQuery to setup the draggables and droppables. Currently I have the script in the head portion of application.html.erb, which I'm sure is not the right solution but at least works. When I press a button on the page, an ajax call is made to my controller that replaces the draggables with a new set of elements that should also be draggable. I have a js.erb file that renders a partial in the correct location. After rendering I need to make the new elements draggable, so I'd like to reuse the code that currently lives in application.html.erb, but I haven't found the right way to do it. I can only make the new elements draggable by pasting the code directly into my js.erb file (yuck). What I'd like to have: - a javascript file that contains the functions prepdraggables() and prepdroppables() - a way to call either function from application.html.erb or from a js.erb file I've tried using :content_for to store and reuse the code, but can't seem to get it working correctly. What I currently have in the head section of application.html.erb <% content_for :drag_drop_prep do %> <script type="text/javascript" charset="utf-8"> $(document).ready(function () { // declare all DOM elements with class draggable to be draggable $( ".draggable" ).draggable( { revert : 'invalid' }); // declare all DOM elements with class legal to be droppable $(".legal").droppable({ hoverClass : 'legal_hover', drop : function(event, ui) { var c = new Object(); c['die'] = ui.draggable.attr("id"); c['cell'] = $(this).attr("id"); c['authenticity_token'] = encodeURIComponent(window._token); $.ajax({ type: "POST", url: "/placeDie", data: c, timeout: 5000 }); }}); }); </script> <% end %> undo.js.erb $("#board").html("<%= escape_javascript(render :partial => 'shared/board', :locals => { :playable => true, :restartable => !session[:challenge]}) %>") // This is where I want to prepare draggables. <%= javascript_include_tag "customdragdrop.js" %> // assuming this file had the draggables code from above in a prepdraggables() function prepdraggables();

    Read the article

  • Debug JS from browser without a server/localhost

    - by sazpaz
    So something I do very frequently is writing random scripts in JS without really being part of an app. To run them I just paste them in the console of either Chrome of FF which works as a nice REPL, or if I really need more fancy debugging I just add it to my test app on localhost and browse it from the browser. Is there a way to get all the good debugging of a browser (breakpoints, locals, etc), without it being served from a server?, e.g by just copy-pasting my code into console or something?

    Read the article

  • Good HTML CSS JS editor for iPad ?

    - by xiamx
    I want to be able to edit HTML CSS and JS on my iPad. I noticed that there are a few applications in AppStore that does that. But I'm not sure which to use. I need grammar highlight, tag autocompletation and preview. Please suggest one.

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >