Search Results

Search found 154 results on 7 pages for 'misha moroshko'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • Why the vertical scroll bar moves automatically ?

    - by Misha Moroshko
    I don't understand why the vertical scroll bar moves automatically to the most top position when "Line 9" clicked, for example. Further clicks does not move the scroll bar. Could anyone explain why, and how to fix this ? I work with Firefox 3.6.3. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <body> <div> <table> <tr row='0'><td class='column1'>Line 0</td></tr> <tr row='1'><td class='column1'>Line 1</td></tr> <tr row='2'><td class='column1'>Line 2</td></tr> <tr row='3'><td class='column1'>Line 3</td></tr> <tr row='4'><td class='column1'>Line 4</td></tr> <tr row='5'><td class='column1'>Line 5</td></tr> <tr row='6'><td class='column1'>Line 6</td></tr> <tr row='7'><td class='column1'>Line 7</td></tr> <tr row='8'><td class='column1'>Line 8</td></tr> <tr row='9'><td class='column1'>Line 9</td></tr> </table> </div> </body> $(document).ready(function() { $(".column1").each(function(index) { $(this).after("<td class='column2'>Details " + index + "</td>"); $(this).toggle(function() { $("[row='" + index + "'] .column2").fadeIn("fast") }, function() { $("[row='" + index + "'] .column2").fadeOut("fast") }); }); }); div { overflow: auto; height: 100px; width: 300px; border: 1px solid blue; } .column1 { cursor: pointer; } .column2 { display: none; }

    Read the article

  • HTML table with fixed cells size

    - by misha-moroshko
    I have an HTML table which has equally divided rows and columns. I would like each cell to be of a fixed size, say 40px width and 30px height. When I change the size of the browser window, the cells size changes also. How can I prevent it ? I would expect to see the scroll bars if browser's window become too small. Is that right to set the height and the width of the cell in pixels ? Thanks !

    Read the article

  • Ruby on Rails: How to create associated models on the fly ?

    - by Misha Moroshko
    I have the following models: class Product < ActiveRecord::Base belongs_to :brand belongs_to :model accepts_nested_attributes_for :brand, :model ... end class Brand < ActiveRecord::Base has_many :products has_many :models ... end class Model < ActiveRecord::Base has_many :products belongs_to :brand accepts_nested_attributes_for :brand ... end I have a problem to create a new product. Here is the relevant code in the controller: class ProductsController < ApplicationController ... def create @product = Product.new(params[:product]) if @product.save ... # Here is the error end ... end When user adds a new brand and a new model, params[:product] contains the following: "brand_attributes"=>{"name"=>"my_new_brand"} "model_attributes"=>{"model_no"=>"my_new_model"} and I got the following error: Mysql2::Error: Column 'brand_id' cannot be null: INSERT INTO `models` ... because model has a foreign key brand_id which is not set. I can't set it because the brand (like the model) is created on the fly when the product is created. I don't want to create the brand before the product, because then I the product has errors, I will need to delete the created brand. Then I tried to change params[:product] like this: "brand_attributes"=>{"name"=>"my_new_brand", "model_attributes"=>{"model_no"=>"my_new_model"}} but I end up with this: unknown attribute: model_attributes What would be the proper way to handle this ?

    Read the article

  • Need advice with HTML table

    - by misha-moroshko
    I would like to code an HTML table with messages like this: The table will contain messages that will spread over first N columns (N may change). Lets call these N columns, the message area. Each message is located on X contiguous cells in the message area. X may also change. Each message has a name that contains words separated with underscores. How would you recommend to code this table in Javascript/jQuery such that: It would be easy to define a message (start cell, end cell, color, name) The name will break only after underscores (rather than in the middle of the word)

    Read the article

  • How to run Rails 3 application on localhost/<my_port> ?

    - by Misha Moroshko
    To run Rails application on Windows I do: cd < app_dir rails server I see the following: => Booting WEBrick => Rails 3.0.1 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2011-01-12 20:32:07] INFO WEBrick 1.3.1 [2011-01-12 20:32:07] INFO ruby 1.9.2 (2010-08-18) [i386-mingw32] [2011-01-12 20:32:07] INFO WEBrick::HTTPServer#start: pid=5812 port=3000 Question 1 Why port 3000 is selected ? Where is it configured ? Question 2 How could I run 2 applications in parallel ? I guess I need to configure one of them to be on other port (like 3001). How should I do this ?

    Read the article

  • Rails 3: How not to include column's name in a validation message without plugins ?

    - by Misha Moroshko
    I have the following validation: validates_presence_of :price, :message => "my message" and I get the following error when the price is blank: Price my message Is there a way not to include the column name (price) in the message ? I tried to do: validates_presence_of :price, :message => "^ my message" as suggested here, but it didn't work for me. I got the following message: Price ^ my message

    Read the article

  • How not to lose focus on a login page

    - by Misha Moroshko
    I have a simple login form with 2 input fields: "username" and "password". "username" field is focused by default. The problem is that when user clicks outside "username" or "password" fields, the focus is gone (it is neither on "username" nor on "password" fields"). How can I force the focus to be on these 2 fields only ? In my case, this is a really annoying behavior, so I really want to do this :) Can I do something like: $("*").focus(function() { if (!$(this).hasClass("my_inputs_class")) { // How to stop the focusing process here ? } }); ?

    Read the article

  • Long task in Javascript

    - by Misha Moroshko
    Why in the following code I see the whole page at once ? Thanks ! HTML: <div></div> CSS: div { width: 100px; height: 300px; border: 1px solid black; text-align: center; } Javascript: $(function() { for (var i=0; i<15; i++) { sleep(100); $("div").append("<span>--- " + i + " ---<br /></span>"); } function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } } } });

    Read the article

  • jQuery .parent() does not work

    - by Misha Moroshko
    Why the following code fails with: Error: class_a_jquery_objects[0].parent is not a function ? HTML: <div> <div class='a b'></div> <div class='b c'></div> <div class='c a'></div> </div> <div id='log'></div> JS: $(function() { var class_a_jquery_objects = $(".a"); $("#log").append(class_a_jquery_objects.length + "<br />"); $("#log").append(class_a_jquery_objects[0] + "<br />"); $("#log").append(class_a_jquery_objects[0].parent() + "<br />"); });

    Read the article

  • How to set cell's background in HTML table ?

    - by misha-moroshko
    I would like to set the background of a cell in HTML table to be like this. What are my options besides using an image as background ? Are there any predefined backgrounds like this ? Maybe dotted, or diagonal lines backgrounds ? In case of image background, if I don't know in advance what would be the size of the cell, what image size should I take ? How to make it be repetitive so it would look nice ? Any HTML/CSS/Javascript/jQuery suggestions are welcome :)

    Read the article

  • Rails 3: How to validate that A < B where A and B are both model attributes ?

    - by Misha Moroshko
    I would like to validate that customer_price >= my_price. I tried the following: class Product < ActiveRecord::Base attr_accessor :my_price validates_numericality_of :customer_price, :greater_than_or_equal_to => my_price ... end (customer_price is a column in the Products table in the database, while my_price isn't.) Here is the result: NameError in ProductsController#index undefined local variable or method `my_price' for #<Class:0x313b648> What is the right way to do this in Rails 3 ?

    Read the article

  • What is the fastest method to calculate substring

    - by Misha Moroshko
    I have a huge "binary" string, like: 1110 0010 1000 1111 0000 1100 1010 0111.... It's length is 0 modulo 4, and may reach 500,000. I have also a corresponding array: {14, 2, 8, 15, 0, 12, 10, 7, ...} (every number in the array corresponds to 4 bits in the string) Given this string, this array, and a number N, I need to calculate the following substring string.substr(4*N, 4), i.e.: for N=0 the result should be 1110 for N=1 the result should be 0010 I need to perform this task many many times, and my question is what would be the fastest method to calculate this substring ? One method is to calculate the substring straight forward: string.substr(4*N, 4). I'm afraid this one is not efficient for such huge strings. Another method is to use array[N].toString(2) and then wrap the result with zeros if needed. I'm not sure how fast is this. May be you have any other ideas ?

    Read the article

  • Javascript for loop efficiency

    - by Misha Moroshko
    Is for (var i=0, cols=columns.length; i<cols; i++) { ... } more efficient than for (var i=0; i<columns.length; i++) { ... } ? In the second variant, is columns.length calculated each time the condition i<columns.length is checked ?

    Read the article

  • How to handle huge table ?

    - by misha-moroshko
    I would like to display to user a table which contains ~500,000 rows. The table should be calculated based on a file (i.e. the table is known at the beginning, and does not change). I guess that building the HTML text of this table is not a good idea in terms of memory performance. So how can I build such table ? I would like user to be able to scroll the table using a vertical scroll bar. Is it possible to build on the fly only the visible part of the table ? I'm afraid to see delays because of this. Is it a better idea to use server side programming rather than Javascript ? Any advise would be appreciated.

    Read the article

  • Long task in Javascript / jQuery

    - by Misha Moroshko
    I have a long task in Javascript that should be performed before the web page content is displayed. During the execution of this task I would like to show an image whose opacity will grow up to 100% (when the task is done). How this can be achieved ?

    Read the article

  • Looking for nice Javascript/jQuery code for displaying large tables

    - by misha-moroshko
    I have an HTML table which may contain thousands of rows (number of columns is not a problem here). I would like to be able to browse this table easily and be able to do the following: Decide how many rows will be presented Jump to the next/previous X number of rows Scroll the table using the scroll bars to any desired line Be able to customize/extend easily this Javascript/jQuery code Has anyone seen something similar ? Thank you very much !

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >