Search Results

Search found 926 results on 38 pages for 'ignoring'.

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

  • Ignoring a model with all blank fields in Ruby on Rails

    - by aguynamedloren
    I am trying to create multiple items (each with a name value and a content value) in a single form. The code I have is functioning, but I cannot figure out how to ignore items that are blank. Here's the code: #item.rb class Item < ActiveRecord::Base attr_accessible :name, :content validates_presence_of :name, :content end #items_controller.rb class ItemsController < ApplicationController def new @items = Array.new(3){ Item.new } end def create @items = params[:items].values.collect{|item|Item.new(item)} if @items.each(&:save!) flash[:notice] = "Successfully created item." redirect_to root_url else render :action => 'new' end end #new.html.erb <% form_tag :action => 'create' do %> <%@items.each_with_index do |item, index| %> <% fields_for "items[#{index}]", item do |f| %> <p> Name: <%= f.text_field :name %> Content: <%= f.text_field :content %> </p> <% end %> <% end %> <%= submit_tag %> <% end %> This code works when all fields for all items are filled out in the form, but fails if any fields are left blank (due to validations). The goal is that 1 or 2 items could be saved, even if others are left blank. I'm sure there is a simple solution to this, but I've been tinkering for hours with no avail. Any help is appreciated!

    Read the article

  • ignoring saturday and sunday

    - by bsandrabr
    I am pulling in all the records from my customer database(mysql) for the last ten days $offset1 =strtotime("-10 day"); $date3=date("Y-m-d",$offset1); SELECT * FROM customers WHERE date between '$date3' and '$date' AND customer.custid = '$custid' ORDER by date DESC I would like to leave out the dates falling on a saturday or sunday and would like to put this in my query rather than the php If you can help thanks

    Read the article

  • Ignoring build number when referencing dll

    - by brickner
    I have one solution with a .NET 4.0 project (C#) that produces a delayed signed dll, that I dotfuscate and sign. EDIT: This is how I version the dll: [assembly: AssemblyVersion("0.7.0.*")] [assembly: AssemblyFileVersion("0.7.0.0")] I have another solution with a .NET 4.0 project (C++/CLI) that references the signed dll and produces a signed dll (actually, delayed signed and signed in a post build because of a flaw in the C++ build system). The problem is that the reference to the dll contains a specific version number, which includes even the build number (I want to have a build number). Every time I build the referenced dll, I have to change the project settings file (.vcxproj) so it reference the new version dll. Since I work with source control, this is very inconvenient (different computers might have different build numbers since each computer build its own referenced dll - the referenced dll is not in the source control). If I don't change the reference, I get a warning: warning MSB3245: Could not resolve this reference. Could not locate the assembly... And many errors like this: error C3083: 'Foo': the symbol to the left of a '::' must be a type These are resolved once I change the reference. How do I make the reference ignore the build number or even the entire version number?

    Read the article

  • Android ignoring my setWidth() and setHeight()

    - by popoffka
    So, why does this code: package org.popoffka.apicross; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class Game extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Button testButton = new Button(this); testButton.setBackgroundResource(R.drawable.cell); testButton.setWidth(20); testButton.setHeight(20); setContentView(testButton); } } ...produce this thing: http://i42.tinypic.com/2hgdzme.png even though there's a setWidth(20) and setHeight(20) in the code? (R.drawable.cell is actually a 20x20 PNG image containing a white cell with a silver border)

    Read the article

  • C# WPF Paginator printer ignoring user's printer selection

    - by Anders
    I am using the following code in my project. The print dialog shows, but it always prints on the default printer regardless of the user's selection. I have read similar topics but none of them seem to use the SerializerWriterCollator. What is the problem? PrintQueue printQueue = LocalPrintServer.GetDefaultPrintQueue(); XpsDocumentWriter xpsWriter = PrintQueue.CreateXpsDocumentWriter(printQueue); SerializerWriterCollator batchPrinter = xpsWriter.CreateVisualsCollator(); var printDialog = new PrintDialog(); if (printDialog.ShowDialog() == true) { PrintTicket ticket = printDialog.PrintTicket; ticket.PageOrientation = PageOrientation.Landscape; var paginator1 = new PagePrinter(winchFlightsCount, new Size(printDialog.PrintableAreaWidth, printDialog.PrintableAreaHeight), winchFlights); var paginator2 = new PagePrinter(tugFlightCount, new Size(printDialog.PrintableAreaWidth, printDialog.PrintableAreaHeight), tugFlights); var paginator3 = new PagePrinter(selfFlightCount, new Size(printDialog.PrintableAreaWidth, printDialog.PrintableAreaHeight), selfFlights); batchPrinter.BeginBatchWrite(); for (int i = 0; i < paginator1.PageCount; i++) { batchPrinter.Write(paginator1.GetPage(i).Visual, ticket); } for (int i = 0; i < paginator2.PageCount; i++) { batchPrinter.Write(paginator2.GetPage(i).Visual, ticket); } for (int i = 0; i < paginator3.PageCount; i++) { batchPrinter.Write(paginator3.GetPage(i).Visual, ticket); } batchPrinter.EndBatchWrite(); } }

    Read the article

  • Search and highlight html - ignoring and maintaining tags

    - by Sleepwalker
    I am looking for a good way to highlight key words in a block of html with stripping the html tags. I can regex to search for key words within html tags, but I haven't found a great way to search across tags. For example, if the key word phrase is "not bound" I want to be able to make this <p>I am not<strong>bound to please thee</strong> with my answers.</p> become wrapped in highlight tags, without breaking the "strong" tag (and making the html invalid) and become: <p>I am <span class="highlight">not</span><strong><span class="highlight">bound</span> to please thee</strong> with my answers.</p> The main issue is maintaining the html as it is AND wrapping blocks of text with highlight tags. I need to maintain the original html. Otherwise I would strip the tags. The best solution to this that I can think of right now would entail making a copy of the html and placing counter tokens where each space occurs, then stripping all tags and search for matching phrases, then looking back to the original and the tokenized strings and figuring out where to start building the highlight tags, then start walking forward, starting and ending highlight spans as needed from the beginning of the match until the end. This seems like overkill. I would like to something more elegant if possible. The solution would be written in C# or perhaps javascript, depending.

    Read the article

  • ASP.Net partially ignoring my Custom error section in web.config

    - by weevie
    Here's my web.config customErrors section (you'll notice I've switched the mode to 'On' so I can see the redirect on my localhost): <customErrors defaultRedirect="~/Application/ServerError.aspx" mode="On" redirectMode="ResponseRewrite"> <error statusCode="403" redirect="~/Secure/AccessDenied.aspx" /> </customErrors> and here's the code that throws: Catch adEx As AccessDeniedException Throw New HttpException(DirectCast(HttpStatusCode.Forbidden, Integer), adEx.Message) End Try and here's what I end up with: Which is not my pretty AccessDenied.aspx page but it is a forbidden error page so at least I know my throw is working. I've removed the entry for 403 in IIS (7.0) as a desperate last attempt and unsuprisingly that made no difference. I've run out of ideas now so any suggestions will be gratefully appreciated!

    Read the article

  • Committing file deletions to svn repository whilst ignoring some other local mods

    - by TheJuice
    I have svn repository where I have scheduled some files and folders to be moved in the repository with svn mv. I also have some files that are peers of the files to be moved that have local modifications of which I only want a subset of those files to be committed along with the moves. e.g. the output of svn st would look like: D foo/bar D foo/bar/a.txt D foo/bar/b.txt M foo/exclude.txt M foo/include.txt A foo/whiz/bar A + foo/whiz/bar/c.txt A + foo/whiz/bar/d.txt To commit to the moves to the repository, I would need to perform the commit on foo but that would also commit the modifications to foo/exclude.txt and foo/include.txt. How would I commit only the deletions/additions as a result of the move plus the mods to foo/include.txt whilst excluding foo/exclude.txt? I have a feeling the answer lies with the --depth argument to svn ci but it's not clear to me how it will operate.

    Read the article

  • Ignoring extra keys in a hash passed in to create

    - by denniss
    Does rails provide a way to ignore extra keys that are passed in to create. Supposed User has two attributes, first_name and last_name. When I do User.create({ :first_name => "first", :last_name => "last", :age => 10}) that line gives me an UknonwnAttributeError. Well, that makes sense, it happens cause age is not one of the attributes. But is there a way to just ignore key-value pair that is not one of the attributes for User?

    Read the article

  • Postgre database ignoring created index ?!

    - by drasto
    I have an Postgre database and a table called my_table. There are 4 columns in that table (id, column1, column2, column3). The id column is primary key, there are no other constrains or indexes on columns. The table has about 200000 rows. I want to print out all rows which has value of column column2 equal(case insensitive) to 'value12'. I use this: SELECT * FROM my_table WHERE column2 = lower('value12') here is the execution plan for this statement(result of set enable_seqscan=on; EXPLAIN SELECT * FROM my_table WHERE column2 = lower('value12')): Seq Scan on my_table (cost=0.00..4676.00 rows=10000 width=55) Filter: ((column2)::text = 'value12'::text) I consider this to be to slow so I create an index on column column2 for better prerformance of searches: CREATE INDEX my_index ON my_table (lower(column2)) Now I ran the same select: SELECT * FROM my_table WHERE column2 = lower('value12') and I expect it to be much faster because it can use index. However it is not faster, it is as slow as before. So I check the execution plan and it is the same as before(see above). So it still uses sequential scen and it ignores the index! Where is the problem ?

    Read the article

  • IE6 ignoring active link CSS style

    - by Leah
    The CSS active link style is being correctly applied in IE7, FF, and Safari but is not applied IE6. .side_nav a.active { color:#FFFFFF; background-color:#9F1F63; } Interestingly the background color (background-color:#9F1F63;) is being applied in IE6 but not the font color (color:#FFFFFF;) Any ideas on why this is happening and how I can fix it appreciated. The complete styling for the nav below: .side_nav { text-align : left; margin-left: -10px; } .side_nav ul { list-style-type: none; list-style-position:inside; margin-left:0px; } .side_nav li { margin-top: 10px; display: list-item; list-style-type:none; } .side_nav a, .side_nav a:visited { text-decoration: none; color : #9F1F63; font-weight : bold; padding: 5px 10px 5px 10px; } .side_nav a:hover { color:#B26D7F; } .side_nav a.active { color:#FFFFFF; background-color:#9F1F63; } EDIT: Thanks but the suggestions haven't helped. When I change to a:active the active effect does not work in any browser. I think this might be due to how I have applied the style in the HTML. <div class="side_nav"> <a class="active" href="Page1.aspx">Page1</a><br /> <a href="Page2.aspx">Page2</a><br /> <a href="Page3.aspx">Page3</a><br /> </div>

    Read the article

  • Git is ignoring .git directories in subdirectories

    - by Danny
    I'm using git as a backup tool and 'roaming profile' for my $HOME directory between laptop and desktop. My problem is that under my $HOME I have a Development directory with multiple git projects I'm working on. Git will not allow me to add the subdirectories .git folders. So to commit to these projects I have to push the changes into my $HOME git repo, pull on laptop (where they were created and .git dir exsits) and commit. I've read about submodules, but it's not really what I want. I just want the children .git folders to be treated like any old directory so I can move them around and back them up. Has anyone done this or have an idea how I would?

    Read the article

  • IE7 ignoring margin in a div following an absolute positioned div

    - by 0al0
    I have two divs inside a container, the first one has absolute positioning. In ie7, the second div apparently ignores the top margin. Padding seems to work fine, but for visual reasons I have to use margin. I know the culprit is the absolute positioned div because if i remove it the following div works fine. This is only happening in ie7 (not even in ie6). Help! Edit: I just found a solution which consists of giving the parent div padding-top just for ie7. So I would just like to know why does this happen, and if there is one, a cleaner solution, but I dont need more dirty hacks..

    Read the article

  • Ignoring unclosed tags from another <div>?

    - by Mike
    I have a website where members can input text using a limited subset of HTML. When a page is displayed that contains a user's text, if they have any unclosed tags, the formatting "bleeds" across into the next area. For example, if the user entered: Hi, my name is <b>John Then, the rest of the page will be bold. Ideally, there'd be someting I could do that would be this simple: <div contained>Hi, my name is <b>John</div> And no tags could bleed out of that div. Assuming there isn't anything this simple, how would I accomplish a similar effect? Or, is there something this easy? Importantly, I do not want to validate the user's input and return an error if they have unclosed tags, since I want to provide the "easiest" user interface possible for my users. Thanks!

    Read the article

  • Replace whitespaces using PHP preg_replace function ignoring quoted strings

    - by Saiful
    Look at the following string: SELECT column1 , column2, column3 FROM table1 WHERE column1 = 'text, "FROM" \'from\\\' x' AND column2 = "sample text 'where' \"where\\\" " AND ( column3 = 5 ) I need to escape unnecessary white space characters from the string like: removing white space from beginning and ending position of , ( ) etc removing newline (\r\n) and tabs (\t) But one thing. The remove process could not remove white spaces from the quoted string like: 'text, "FROM" \'from\\' x' "sample text 'where' \"where\\" " etc. i need to use the PHP function: preg_replace($pattern, $replacement, $string); So what will be the value of $pattern and $replacement where the value of $string is the given SQL.

    Read the article

  • Java: Ignoring escapes when parsing XML

    - by Personman
    I'm using a DocumentBuilder to parse XML files. However, the specification for the project requires that within text nodes, strings like " and < be returned literally, and not turned into the corresponding ASCII values. A previous similar question, http://stackoverflow.com/questions/1979785/read-escaped-quote-as-escaped-quote-from-xml, received one answer that seems to be specific to Apache, and another that appears to simply not not do what it says it does. I'd love to be proven wrong on either count, however :) For reference, here is some code: file = new File(fileName); DocBderFac = DocumentBuilderFactory.newInstance(); DocBder = DocBderFac.newDocumentBuilder(); doc = DocBder.parse(file); NodeList textElmntLst = doc.getElementsByTagName(text); Element textElmnt = (Element) textElmntLst.item(0); NodeList txts = textElmnt.getChildNodes(); String txt = ((Node) txts.item(0)).getNodeValue(); System.out.println(txt); I would like that println() to produce things like &quot;3&gt;2&quot; instead of "3>2" which is what currently happens. Thanks!

    Read the article

  • Ignoring a character along with word boundary in regex

    - by DavidP6
    I am using gsub in Ruby to make a word within text bold. I am using a word boundary so as to not make letters within other words bold, but am finding that this ignores words that have a quote after them. For example: text.gsub(/#{word}\b/i, "<b>#{word}</b>") text = "I said, 'look out below'" word = below In this case the word below is not made bold. Is there any way to ignore certain characters along with a word boundary?

    Read the article

  • ignoring folders in mercurial

    - by damian
    Caveat: I try all the posibilities listed here: http://stackoverflow.com/questions/254002/how-can-i-ignore-everything-under-a-folder-in-mercurial. None works as I hope. I want to ignore every thing under the folder test. But not ignore srcProject\test\TestManager I try syntax: glob test/** And it ignores test and srcProject\test\TestManager With: syntax: regexp ^/test/ It's the same thing. Also with: syntax: regexp test\\* I have install TortoiseHG 0.4rc2 with Mercurial-626cb86a6523+tortoisehg, Python-2.5.1, PyGTK-2.10.6, GTK-2.10.11 in Windows

    Read the article

  • Ignoring generated files when using "Treat warnings as errors"

    - by krystan honour
    We have started a new project but also have this problem for an existing project. The problem is that when we compile with a warning level of 4 we also want to switch on 'Treat all warnings as errors' We are unable to do this at the moment because generated files (in particular reference.cs files) are missing things like XML comments and this generates a warning, we do not want to suppress the xml comment warnings totally out of all files just for specific types of files (namely generated code). I have thought of a way this could be achieved but am not sure if these are the best way to do this or indeed where to start :) My thinking is that we need to do something with T4 templates for the code that is generated such that it does fill in XML documentation for generated code. Does anyone have any ideas, currently I'm at well over 2k warnings (its a big project) :(

    Read the article

  • xVal ignoring fields that are hidden

    - by gmcalab
    I have a form where a user can toggle receiving funds either via check or via electronic transfer. When they choose either way in a list box, the respective part of the form hides. If they choose electronic transfer only bank info fields show, if they choose via check only address info shows and the bank fields are hidden. Well, since they choose one way or another I want to, not validate for something that is hidden. (Client Side) Is there a way to set xVal to only validate fields that are not visible? I tried to override validate with the following but no dice... $('#EditPayment').validate({ elementwhichishidden: { required: function(element) { return ($(element).parent().parent().css('display') != 'none'); } } });

    Read the article

  • rsyncing - ignoring checksums

    - by paulj3000
    Trying to copy a bunch of data over and time, unfortunately, is of the essence. I'd like to do an rsync of all the data in one direction, pretty much rsync just clobbers what's over on the destination server. Is there a way to do an rsync and just say, "overwrite all files" Is there a better way of doing this? We're talking 500GB of data that only has to go in one direction.

    Read the article

  • Complex pattern replacement using PHP preg_replace function ignoring quoted strings

    - by Saiful
    Consider the following string: this is a STRING WHERE some keywords ARE available. 'i need TO format the KEYWORDS from the STRING' In the above string keywords are STRING and WHERE Now i need to get an output as follows: this is a <b>STRING</b> <b>WHERE</b> some keywords ARE available. 'i need TO format the KEYWORDS from the STRING' So that the html output will be like: this is a STRING WHERE some keywords ARE available. 'i need TO format the KEYWORDS from the STRING' Note that the keywords within a quoted ('...') string will be ignored. in the above example i ignored the STRING keyword within the quoted string. Please give a modified version of the following PHP script so that I can have my desired result as above : $patterns = array('/STRING/','/WHERE/'); $replaces = array('<b>STRING</b>', '<b>WHERE</b>'); $string = "this is a STRING WHERE some keywords ARE available. 'i need TO format the KEYWORDS from the STRING'"; preg_replace($patterns, $replaces, $string);

    Read the article

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