Search Results

Search found 5915 results on 237 pages for 'practices'.

Page 122/237 | < Previous Page | 118 119 120 121 122 123 124 125 126 127 128 129  | Next Page >

  • jQuery Animation and Classes

    - by ehdv
    Assume you have a list item, <li id="foo"> which you want to fade from one color to another when moused over, and that you are using jQuery. This is fairly easy: $('li#foo').bind('mouseenter' , function(e) { $(this).animate({backgroundColor: '#F00'} , 300); }); However, what if you wanted to get the resulting color or other style rules from a class defined in CSS without also declaring them in JavaScript? It seems there's no way to learn style information from CSS rules without having an example of the rule already in the document, which would require you to animate the <li> to the target appearance, then in the animation-finished callback, set the class which leads to redundant style declarations and can foul up your CSS at "runtime". Sorry if this question's unclear: It doesn't occur in the context of any specific project, I'm just curious how you'd go about this. Also, I know CSS3 hypothetically includes support for such transitions but using CSS for dynamic behavior like this seems such an ugly hack.

    Read the article

  • -Wextra how useful is it really?

    - by Helper Method
    I'm reading the gcc manual at the moment, especially the part about warning/error flags. After reading the part about the -Wextra flag, I wonder if it is useful at all. It seems that it complains about things which seem to be rather subjective or a matter of taste. I'm not that experienced with gcc, I only use it from time to time for some small projects at university, so to all experienced C/C++ (or for whatever language you use gcc), what's the deal with -Wextra?

    Read the article

  • How can I pad part of a string with spaces, in Perl?

    - by sid_com
    Hello! Which version would you prefer? #!/usr/bin/env perl use warnings; use strict; use 5.010; my $p = 7; # 33 my $prompt = ' : '; my $key = 'very important text'; my $value = 'Hello, World!'; my $length = length $key . $prompt; $p -= $length; Option 1: $key = $key . ' ' x $p . $prompt; Option 2: if ( $p > 0 ) { $key = $key . ' ' x $p . $prompt; } else { $key = $key . $prompt; } say "$key$value"

    Read the article

  • add objects with different name through for loop

    - by Gandalf StormCrow
    What is the best way to do the following: List<MyObject> list = new LinkedList<MyObject>(); for(int i=0; i<30;i++) { MyObject o1 = new MyObject(); list.add(o1); } But the things is I don't wanna create objects with same name, I wanna create them with different name like o1,o2,o3,o4,o5,o6,o7,o8,o9,o10 and I wanna add each to the list. What is the best way to do this ?

    Read the article

  • When to Use Properties & When to Use Methods?

    - by DaveDev
    Hi Guys I was looking at the following line of code foreach (PropertyInfo prop in t.GetProperties()) and I noticed that tprovides a method to return the type's properties instead of a property like t.Properties This makes me wonder why sometimes people use properties to make a type's data avilable and other times there's a method provided? Is there some logic behind the decision? Thanks Dave

    Read the article

  • Does specifying image size in CSS allow the browser to do layout before download is complete?

    - by eaolson
    I've always tried to specify the height and width attributes for img tags in HTML. Not for style reasons, but because the browser then expects the size of the image and can do page layout even before the image has finished downloading. From the HTML spec: The height and width attributes give user agents an idea of the size of an image or object so that they may reserve space for it and continue rendering the document while waiting for the image data. I don't know why this has never occurred to me, but does specifying height and width in CSS, rather than inside the img tag, do the same thing?

    Read the article

  • Calculate sum of objects for each unique object property in Ruby

    - by macek
    I was helping with an answer in this question and it sparked a question of my own. Pie is an object that has a pieces array made of of PiePiece objects. Each PiePiece has a flavor attribute How do I create a hash that looks like this: # flavor => number of pieces { :cherry => 3 :apple => 1 :strawberry => 2 } This works, but I think it could be improved def inventory hash = {} pieces.each do |p| hash[p.flavor] ||= 0 hash[p.flavor] += 1 end hash end Any ideas?

    Read the article

  • Migrating Application Configuration from Windows Registry to SQLite

    - by baris_a
    Currently, I am working on the migration mentioned in the title line. Problem is application configuration that is kept in registry has a tree like structure, for example: X |->Y |->Z |->SomeKey someValue W |->AnotherKey anotherValue and so on. How can I model this structure in SQLite (or any other DB)? If you have experience in similar problems, please send posts. Thanks in advance.

    Read the article

  • Which Browsers don't support ids for in page navigation (fragid)?

    - by dshaw
    In HTML5, name is no longer a valid attribute of the anchor tag (<a name="yadayada">). It has been mentioned that older browsers do not recognize the the new recommended approach (<a id="yadaya"> or any id for that matter). What are the browsers which don't recognize ids for in page navigation (fragids)? Are we talking about Netscape-era browsers or the usual suspect, Internet Explorer 6?

    Read the article

  • Implementing prompts in text-input

    - by AntonAL
    Hi, I have a form with some text-inputs: login, password. If user sees this form the first time, input-texts should "contain" prompts, like "enter login", "enter password". If user clicks text-input, it's prompt should disappear to allow typing. I have seen various examples, that uses background image with prerendered text on it. Those images are appearing with following jQuery: $("form > :text").focus(function(){ // hide image }).blur(function(){ // show image, if text-input is still empty if ( $(this).val() == "" ) // show image with prompt }); This approach has following problems: localization is impossible need to pre-render images for various textual prompts overhead with loading images How do you overcomes such a problems ?

    Read the article

  • Confusing If Statement?

    - by NetSide
    I always use If statement (In C#) as (1. Alternative); if (IsSuccessed == true) { // } I know that there is no need to write "== true" as (2. Alternative)); if (IsSuccessed) { // } But, I use it because it is more readable and cause no performance issue. Of course, this is my choice and I know many software developers prefer first alternative. What is the best usage, and Why?

    Read the article

  • What to do if 2 (or more) relationship tables would have the same name?

    - by primehunter326
    So I know the convention for naming M-M relationship tables in SQL is to have something like so: For tables User and Data the relationship table would be called UserData User_Data or something similar (from here) What happens then if you need to have multiple relationships between User and Data, representing each in its own table? I have a site I'm working on where I have two primary items and multiple independent M-M relationships between them. I know I could just use a single relationship table and have a field which determines the relationship type, but I'm not sure whether this is a good solution. Assuming I don't go that route, what naming convention should I follow to work around my original problem?

    Read the article

  • What would be the best way to store the questions and responses for a survey where I need to keep th

    - by Ian Roke
    Background I am writing a survey that is going to a large audience. It contains 15 questions and there are five possible answers to each question along with potential comments. The user can cycle through all 15 questions answering them in any order and is allowed to leave the survey at any point and return to answer the remaining questions. Once an answer has been attempted on all 15 questions a submit button appears which allows them to submit the questions as final answers. Until that stage all answers are required to be retrievable whenever the user loads the survey page up. The requirement is that the user only sees one question on a page and 'Previous' and 'Next' buttons allow the user to scroll through the questions. Requirement I could request the question each time the user clicks a button and save the current response and so on but that would be a large number of hits to a database that is already heavily used. I don't have the time to procure a new server etc so I have to make do with what I have. Is there any way I can cache the questions on the user machine and/or responses? Obviously I need the response data to be secure and only known to the user so I feel a little bit stuck as for the best way of doing this. Any pointers? I am prepared to offer a bounty of 100 points on this question if it means I get some good quality discussion and feedback going.

    Read the article

  • Should I use an interface or factory (and interface) for a cross-platform implementation?

    - by nbolton
    Example A: // pseudo code interface IFoo { void bar(); } class FooPlatformA : IFoo { void bar() { /* ... */ } } class FooPlatformB : IFoo { void bar() { /* ... */ } } class Foo : IFoo { IFoo m_foo; public Foo() { if (detectPlatformA()} { m_foo = new FooPlatformA(); } else { m_foo = new FooPlatformB(); } } // wrapper function - downside is we'd have to create one // of these for each function, which doesn't seem right. void bar() { m_foo.bar(); } } Main() { Foo foo = new Foo(); foo.bar(); } Example B: // pseudo code interface IFoo { void bar(); } class FooPlatformA : IFoo { void bar() { /* ... */ } } class FooPlatformB : IFoo { void bar() { /* ... */ } } class FooFactory { IFoo newFoo() { if (detectPlatformA()} { return new FooPlatformA(); } else { return new FooPlatformB(); } } } Main() { FooFactory factory = new FooFactory(); IFoo foo = factory.newFoo(); foo.bar(); } Which is the better option, example A, B, neither, or "it depends"?

    Read the article

  • Fastest way to convert a binary file to SQLite database

    - by chown
    I've some binary files and I'm looking for a way to convert each of those files to a SQLite database. I've already tried C# but the performance is too slow. I'm seeking an advice on how and what programming language should be the best to perform this kind of conversion. Though I prefer any Object Oriented Language more (like C#, Java etc), I'm open for any programming language that boosts up the conversion. I don't need a GUI frontend for the conversion, running the script/program from console is okay. Thanks in advance

    Read the article

  • int foo(type& bar); is a bad practice?

    - by Earlz
    Well, here we are. Yet another proposed practice that my C++ book has an opinion on. It says "a returning-value(non-void) function should not take reference types as a parameter." So basically if you were to implement a function like this: int read_file(int& into){ ... } and used the integer return value as some sort of error indicator (ignoring the fact that we have exceptions) then that function would be poorly written and it should actually be like void read_file(int& into, int& error){ } Now to me, the first one is much clearer and nice to use. If you want to ignore the error value, you do so with ease. But this book suggests the later. Note that this book does not say returning value functions are bad. It rather says that you should either only return a value or you should only use references. What are your thoughts on this? Is my book full of crap? (again)

    Read the article

  • Is it wrong for a context (right click) menu be the only way a user can perform a certain task?

    - by Eric
    I'd like to know if it ever makes sense to provide some functionality in a piece of software that is only available to the user through a context (right click) menu. It seems that in most software I've worked with the right click menu is always used as a quick way to get to features that are otherwise available from other buttons or menus. Below is a screen shot of the UI I'm developing. The tree view on the right shows the user's library of catalogs. Users can create new catalogs, or add and remove existing catalogs to and from their library. Catalogs in their library can then be opened or closed, or set to read-only. The screen shot shows the context menu I've created for the browser. Some commands can be executed independently from any specific catalog (New, Add). Yet the other commands must be applied to a specifically selected catalog (Close, Open, Remove, ReadOnly, Refresh, Clean UP, Rename). Currently the "Catalog" menu at the top of the window looks identical to this context menu. Yet I think this may be confusing to the users as the tree view which shows the currently selected catalog may not always be visible. The user may have switched to the Search or Filters tab, or the left pane may be hidden entirely. However, I'm hesitant to change the UI so that the commands that depends on a specifically selected catalog are only available through the context menu.

    Read the article

  • Clarifying... So Background Jobs don't Tie Up Application Resources (in Rails)?

    - by viatropos
    I'm trying to get a better grasp of the inner workings of background jobs and how they improve performance. I understand that the goal is to have the application return a response to the user as fast as it can, so you don't want to, say, parse a huge feed that would take 10 seconds because it would prevent the application from being able to process any other requests. So it's recommended to put any operations that take more than say 500ms to execute, into a queued background job. What I don't understand is, doesn't that just delay the same problem? I know the user who invoked that background job will get an immediate response, but what if another user comes right when that background job starts (and it takes 10 seconds to finish), wont that user have to wait? Or is the main issue that, requests are the only thing that can happen one-at-a-time, while on the other hand a request can start while one+ background jobs are in the middle of running? Is that correct?

    Read the article

  • Where to keep config data other than config file (Windows App)?

    - by user144842
    My Windows application GUI is accepting some required application configuration fields from the user. I need to store them of course, but I wanna hide these fields from the user. I cannot use database to store these configs. I want to avoid using app.config either. (No app.config encryption) Any suggestions, Where and in which format i should store fields. (Field example is: Accepting database User credentials, Task Schedule info etc.)

    Read the article

  • Do we still need backup code for people who have javascript disabled?

    - by SLC
    I hear about it a bit in tutorials that I watch, that certain things won't work if javascript is disabled. Occasionally I see workarounds. The question is, are these relevent? I can't imagine anyone not having a javascript enabled browser nowadays, except the most ancient of phones, and chances are your page won't render on them properly anyway. Do people still bother to write backup code for javascript being disabled?

    Read the article

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