Search Results

Search found 17924 results on 717 pages for 'z order'.

Page 36/717 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • Params order in Foo.new(params[:foo]), need one before the other (Rails)

    - by Jeena
    I have a problem which I don't know how to fix. It has to do with the unsorted params hash. I have a object Reservation which has a virtual time= attribute and a virtual eating_session= attribute when I set the time= I also want to validate it via an external server request. I do that with help of the method times() which makes a lookup on a other server and saves all possible times in the @times variable. The problem now is that the method times() needs the eating_session attribute to find out which times are valid, but rails sometimes calls the times= method first, before there is any eating_session in the Reservation object when I just do @reservation = Reservation.new(params[:reservation]) class ReservationsController < ApplicationController def new @reservation = Reservation.new(params[:reservation]) # ... end end class Reservation < ActiveRecord::Base include SoapClient attr_accessor :date, :time belongs_to :eating_session def time=(time) @time = times.find { |t| t[:time] == time } end def times return @times if defined? @times @times = [] response = call_soap :search_availability { # eating_session is sometimes nil :session_id => eating_session.code, # <- HERE IS THE PROBLEM :dining_date => date } response[:result].each do |result| @times << { :time => "#{DateTime.parse(result[:time]).strftime("%H:%M")}", :correlation_data => result[:correlation_data] } end @times end end I have no idea how to fix this, any help is apriciated.

    Read the article

  • Rendering order in ContentControl - WPF

    - by Eden
    Hi, There is something that I don't understand regarding ContentControl: I've a class that inherits from ContentControl, and it overrides the OnRender method. And although I don't call base.OnRender(drawingContext) still the content is being rendered... How come? What am I missing? Thanks, Eden

    Read the article

  • First order logic formula

    - by user177883
    R(x) is a red block B(x) is a blue block T(x,y) block x is on top of block y Question: Write a formula asserting that if no red block is on top of a red block then no red block is on top of itself. My answer: (Ax)(Ay)(R(x) and R(y) - ~T(x,y))-(Ax)(R(x)- ~T(x,x)) A = For all

    Read the article

  • Problem with order by in LINQ

    - by vikitor
    Hi, I'm passing from the controller an array generated by the next code: public ActionResult GetClasses(bool ajax, string kingdom) { int _kingdom = _taxon.getKingdom(kingdom); var query = (from c in vwAnimalsTaxon.All() orderby c.ClaName select new { taxRecID = c.ClaRecID, taxName = c.ClaName }).Distinct(); return Json(query, JsonRequestBehavior.AllowGet); } The query List should be ordered, but it doesn't work, I get the names of the classes ordered wrong in the array, because I've seen it debugging that the names are not ordered.The view is just a dropdownbox loaded automatically, so I'm almost sure the problem is with the action. Do you see anything wrong?Am I missing something?

    Read the article

  • Wrong IO actions order using putStr and getLine

    - by QWRp
    I have a code : main = do putStr "Test input : " content <- getLine putStrLn content And when I run it (with runhaskell) or compile it (ghc 6.10.4) result is like this: asd Test input : asd I'm new to haskell and in my opinion printing should be first. Am I right? In code sample on http://learnyouahaskell.com/ which used putStr then getLine presented output is different than mine (IMHO correct). When I use putStrLn program works as expected (print then prompt and print). Is it a bug in ghc, or it is the way that it should work?

    Read the article

  • need to print 5 column list in alpha order, vertically

    - by Brad
    Have a webpage that will be viewed by mainly IE users, so CSS3 is out of the question. I want it to list like: A D G B E H C F I Here is the function that currently lists like: A B C D E F G H I function listPhoneExtensions($group,$group_title) { $adldap = new adLDAP(); $group_membership = $adldap->group_members(strtoupper($group),FALSE); sort($group_membership); print " <a name=\"".strtolower($group_title)."\"></a> <h2>".$group_title."</h2> <ul class=\"phone-extensions\">"; foreach ($group_membership as $i => $username) { $userinfo = $adldap->user_info($username, array("givenname","sn","telephonenumber")); $displayname = "<span class=\"name\">".substr($userinfo[0]["sn"][0],0,9).", ".substr($userinfo[0]["givenname"][0],0,9)."</span><span class=\"ext\">".$userinfo[0]["telephonenumber"][0]."</span>"; if($userinfo[0]["sn"][0] != "" && $userinfo[0]["givenname"][0] != "" && $userinfo[0]["telephonenumber"][0] != "") { print "<li>".$displayname."</li>"; } } print "</ul><p class=\"clear-both\"><a href=\"#top\" class=\"link-to-top\">&uarr; top</a></p>"; } Example rendered html: <ul class="phone-extensions"> <li><span class="name">Barry Bonds</span><span class="ext">8281</span></li> <li><span class="name">Gerald Clark</span><span class="ext">8211</span></li> <li><span class="name">Juan Dixon</span><span class="ext">8282</span></li> <li><span class="name">Omar Ebbs</span><span class="ext">8252</span></li> <li><span class="name">Freddie Flank</span><span class="ext">2281</span></li> <li><span class="name">Jerry Gilmore</span><span class="ext">4231</span></li> <li><span class="name">Kim Moore</span><span class="ext">5767</span></li> <li><span class="name">Barry Bonds</span><span class="ext">8281</span></li> <li><span class="name">Gerald Clark</span><span class="ext">8211</span></li> <li><span class="name">Juan Dixon</span><span class="ext">8282</span></li> <li><span class="name">Omar Ebbs</span><span class="ext">8252</span></li> <li><span class="name">Freddie Flank</span><span class="ext">2281</span></li> <li><span class="name">Jerry Gilmore</span><span class="ext">4231</span></li> <li><span class="name">Kim Moore</span><span class="ext">5767</span></li> <li><span class="name">Barry Bonds</span><span class="ext">8281</span></li> <li><span class="name">Gerald Clark</span><span class="ext">8211</span></li> <li><span class="name">Juan Dixon</span><span class="ext">8282</span></li> <li><span class="name">Omar Ebbs</span><span class="ext">8252</span></li> <li><span class="name">Freddie Flank</span><span class="ext">2281</span></li> <li><span class="name">Jerry Gilmore</span><span class="ext">4231</span></li> <li><span class="name">Kim Moore</span><span class="ext">5767</span></li> </ul> Any help is appreciated to getting it to list alpha vertically.

    Read the article

  • MVVM - implementing 'IsDirty' functionality to a ModelView in order to save data

    - by Brendan
    Hi, Being new to WPF & MVVM I struggling with some basic functionality. Let me first explain what I am after, and then attach some example code... I have a screen showing a list of users, and I display the details of the selected user on the right-hand side with editable textboxes. I then have a Save button which is DataBound, but I would only like this button to display when data has actually changed. ie - I need to check for "dirty data". I have a fully MVVM example in which I have a Model called User: namespace Test.Model { class User { public string UserName { get; set; } public string Surname { get; set; } public string Firstname { get; set; } } } Then, the ViewModel looks like this: using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Windows.Input; using Test.Model; namespace Test.ViewModel { class UserViewModel : ViewModelBase { //Private variables private ObservableCollection<User> _users; RelayCommand _userSave; //Properties public ObservableCollection<User> User { get { if (_users == null) { _users = new ObservableCollection<User>(); //I assume I need this Handler, but I am stuggling to implement it successfully //_users.CollectionChanged += HandleChange; //Populate with users _users.Add(new User {UserName = "Bob", Firstname="Bob", Surname="Smith"}); _users.Add(new User {UserName = "Smob", Firstname="John", Surname="Davy"}); } return _users; } } //Not sure what to do with this?!?! //private void HandleChange(object sender, NotifyCollectionChangedEventArgs e) //{ // if (e.Action == NotifyCollectionChangedAction.Remove) // { // foreach (TestViewModel item in e.NewItems) // { // //Removed items // } // } // else if (e.Action == NotifyCollectionChangedAction.Add) // { // foreach (TestViewModel item in e.NewItems) // { // //Added items // } // } //} //Commands public ICommand UserSave { get { if (_userSave == null) { _userSave = new RelayCommand(param => this.UserSaveExecute(), param => this.UserSaveCanExecute); } return _userSave; } } void UserSaveExecute() { //Here I will call my DataAccess to actually save the data } bool UserSaveCanExecute { get { //This is where I would like to know whether the currently selected item has been edited and is thus "dirty" return false; } } //constructor public UserViewModel() { } } } The "RelayCommand" is just a simple wrapper class, as is the "ViewModelBase". (I'll attach the latter though just for clarity) using System; using System.ComponentModel; namespace Test.ViewModel { public abstract class ViewModelBase : INotifyPropertyChanged, IDisposable { protected ViewModelBase() { } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { var e = new PropertyChangedEventArgs(propertyName); handler(this, e); } } public void Dispose() { this.OnDispose(); } protected virtual void OnDispose() { } } } Finally - the XAML <Window x:Class="Test.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:Test.ViewModel" Title="MainWindow" Height="350" Width="525"> <Window.DataContext> <vm:UserViewModel/> </Window.DataContext> <Grid> <ListBox Height="238" HorizontalAlignment="Left" Margin="12,12,0,0" Name="listBox1" VerticalAlignment="Top" Width="197" ItemsSource="{Binding Path=User}" IsSynchronizedWithCurrentItem="True"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=Firstname}"/> <TextBlock Text="{Binding Path=Surname}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <Label Content="Username" Height="28" HorizontalAlignment="Left" Margin="232,16,0,0" Name="label1" VerticalAlignment="Top" /> <TextBox Height="23" HorizontalAlignment="Left" Margin="323,21,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" Text="{Binding Path=User/UserName}" /> <Label Content="Surname" Height="28" HorizontalAlignment="Left" Margin="232,50,0,0" Name="label2" VerticalAlignment="Top" /> <TextBox Height="23" HorizontalAlignment="Left" Margin="323,52,0,0" Name="textBox2" VerticalAlignment="Top" Width="120" Text="{Binding Path=User/Surname}" /> <Label Content="Firstname" Height="28" HorizontalAlignment="Left" Margin="232,84,0,0" Name="label3" VerticalAlignment="Top" /> <TextBox Height="23" HorizontalAlignment="Left" Margin="323,86,0,0" Name="textBox3" VerticalAlignment="Top" Width="120" Text="{Binding Path=User/Firstname}" /> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="368,159,0,0" Name="button1" VerticalAlignment="Top" Width="75" Command="{Binding Path=UserSave}" /> </Grid> </Window> So basically, when I edit a surname, the Save button should be enabled; and if I undo my edit - well then it should be Disabled again as nothing has changed. I have seen this in many examples, but have not yet found out how to do it. Any help would be much appreciated! Brendan

    Read the article

  • Derivative of a Higher-Order Function

    - by Claudiu
    This is in the context of Automatic Differentiation - what would such a system do with a function like map, or filter - or even one of the SKI Combinators? Example: I have the following function: def func(x): return sum(map(lambda a: a**x, range(20))) What would its derivative be? What will an AD system yield as a result? (This function is well-defined on real-number inputs).

    Read the article

  • What's the order of execution when using IDataErrorInfo?

    - by Benny Jobigan
    Many times with WPF, we use INotifyPropertyChanged and IDataErrorInfo to enable binding and validation on our data objects. I've got a lot of properties that look like this: public SomeObject SomeData { get { return _SomeData; } set { _SomeData = value; OnPropertyChanged("SomeData"); } } Of course, I have an appropriate overridden IDataErrorInfo.this[] in my class to do validation. Question 1) In a binding situation, what happens? For example: User enters new data. Binding writes data to property. Property set method is executed. Binding checks this[] for validation. If the data is invalid, the binding sets the property back to the old value. Property set method is executed again. This is important if you are adding "hooks" into the set method, like: public string PathToFile { get { return _PathToFile; } set { if (_PathToFile != value && // prevent unnecessary actions OnPathToFileChanging(value)) // allow subclasses to do something or stop the setter { _PathToFile = value; OnPathToFileChanged(); // allow subclasses to do something afterwards OnPropertyChanged("PathToFile"); } } }

    Read the article

  • How to convert thousands of PDF files to a single Postscript file in a specified order

    - by tggagne
    I've discovered multiple options for convert a few to serveral PDFs into Postscript, but many are command-line programs with command-line limitations (this application lives on .NET). Our application generates tens-of-thousands of PDFs that we need to send to a printer, except BEFORE the Postscript is printed we need to edit the Postscript to insert print command instructions (duplex, tray-pulls, highlight color, etc.) I think a perfect solution might allow us to write the PDFs to a stream, and simultaneously allow us to read the output stream so we may edit the Postscript before writing it to a file. Of course, if I must create the file first containing all 10,000 PDFs and edit it in an additional pass, I'm OK with that, too. I should mention that speed is important. I need to print 10,000 at a time, but need to keep the printers busy 24-hours/day.

    Read the article

  • Win32 call order

    - by DD
    Hi all, I have two windows that I send scripted input to. The procedure goes as this BringWindowToTop( window1 ); i = Build input structures( window1 ); SendInput(i); BringWindowToTop( window2 ); i = Build input structures( window2 ); SendInput(i); I was having trouble with inputs not being sent and the correct time. I put delays after each call and saw that input from the first SendInput() was processed after window2 is brought to top. Same thing at the end of the loop as well. Are SendInput calls buffered? If so, how can I make sure of a serial execution of this code? Thanks

    Read the article

  • Correct order of overrides for a composite control based on an abstract one

    - by mattdwen
    I'm writing a set of C# composite web server controls for displaying dialog boxes. I want to have one abstract class which handles the basic layout and things like titles of the control, then have a set of derived ones which render child controls at a specific point. I forsee three distincts methods: renderOpeningHtml handled by the abstract class, renderCustomControls as done by the derived class, and renderClosingHtml by the abstract class again, except I can't figure the life cycle of a CompositeControl and what methods to use when.

    Read the article

  • In what order does DOJO handles ajax requests?

    - by mm2887
    Hi, Using a form in a dialog box I am using Dojo in jsp to save the form in my database. After that request is completed using dojo.xhrPost() I am sending in another request to update a dropdown box that should include the added form object that was just saved, but for some reason the request to update the dropdown is executed before saving the form in the database even though the form save is called first. Using Firebug I can see that the getLocations() request is completed before the sendForm() request. This is the code: Add Team sendForm("ajaxResult1", "addTeamForm"); dijit.byId("addTeamDialog").hide(); getLocations("locationsTeam"); </script> function sendForm(target, form){ var targetNode = dojo.byId(target); var xhrArgs = { form: form, url: "ajax", handleAs: "text", load: function(data) { targetNode.innerHTML = data; }, error: function(error) { targetNode.innerHTML = "An unexpected error occurred: " + error; } } //Call the asynchronous xhrGet var deferred = dojo.xhrPost(xhrArgs); } function getLocations(id) { var targetNode = dojo.byId(id); var xhrArgs = { url: "ajax", handleAs: "text", content: { location: "yes" }, load: function(data) { targetNode.innerHTML = data; }, error: function(error) { targetNode.innerHTML = "An unexpected error occurred: " + error; } } //Call the asynchronous xhrGet var deferred = dojo.xhrGet(xhrArgs); } Why is this happening? Is there way to make the first request complete first before the second executes? To reduce the possibilities of why this is happening I tried setting the cache property in xhrGet to false but the result is still the same. Please help!

    Read the article

  • How to build Lucene / Solr from source code in windows environment in order to add patches

    - by Simon
    I have successfully implemented Apache’s Solr for free text searching a database driven web site build for windows platforms using Visual Studio in c#. I am trying to get a version Solr working with field collapsing (which is not in the release version). There are patches available from apache and discussions on the web of people successfully doing this for the version I am using but my problem is cannot get the build to work. I am a c# coder on windows platforms so java development is new to me. I understand I need to get the correct source code (and revision) from SVN, add the appropriate patches, then build the war file to deploy to my system. I cannot seem to get the source to build and produce the deployment code including jar (and subsequent war) files. My system is: Windows 7 Ultimate for development Visual Studio 2010 for c# / javascript development MyEclipse 8.6 / Eclipse 3.5 for the java build from source Subecplise 1.6x SVN plugin to get the source from apache’s SVN Apache Solr 1.4.1 So far I have: Found the right patches for the function I need: https://issues.apache.org/jira/browse/SOLR-236 Specifically I need to patch: field_collapsing_1.1.0.patch HTTPS //issues.apache.org/jira/secure/attachment/12357681/field_collapsing_1.1.0.patch and SOLR-236-1_4_1.patch HTTPS //issues.apache.org/jira/secure/attachment/12448216/SOLR-236-1_4_1.patch I downloaded the Lucene trunk version from the day before the patch was released (revision 958303 from 28/6/10) via subeclipse into a java package in myeclipse from: HTTPS //svn.apache.org/repos/asf/lucene/dev/trunk (Solr is the web implementation of Lucene and is in the subfolder solr/) I can apply patches to the solr directory once it has downloaded but the parent Lucene project doesn’t build the war files, copy the jar or other files into the bin folder (it stays empty). The build process starts, but doesn’t do anything apart from creating the folders bin and src. I am building the whole Lucene project, which contains Solr. I have tried building the source without patching and the same happens. If I copy out the Solr directory into a new project, it runs the build and copies all the related files, tests, etc but fails with 4,500 errors and does not produce the jar files or war file, which I assume is because it can’t find the Lucene trunk files which it depends on. I have two interrelated problems 1) I can't get the Lucene downloaded trunk to build 2) The jar, war and associated files are not created Can anyone help with what I am missing to build the war file? I have spent 2 days to get this far as the help online is extremely patchy and I can’t find a walk though tutorial on building a java war file from source in a windows environment. Any help will be much appreciated. Simon

    Read the article

  • Classloading order in JBoss

    - by Spiderman
    I'd like to know if the default behavior of JBoss server (4.2.3.GA in my case) is loading the classes in parent-first or parent-last mode. And in case it work as I suspect in parent-last mode (i.e. first trying to load classes from the application's WEB-INF/lib and only if they are not found go to server\lib), how can I configure it to work in the opposite- first trying to load classes from outside and only looking inside the application afterwards.

    Read the article

  • How to order a TimeZone list in .NET?

    - by reallyJim
    I have an ASP.NET web application that requires users to select their appropriate time zone so that it can correctly show local times for events. In creating a simple approach for selecting the time zone, I started by just using the values from TimeZoneInfo.GetSystemTimeZones(), and showing that list. The only problem with this is that since our application is primarily targeted at the United States, I'd like to show those entries first, basically starting with Eastern Time and working backwards (West) until I reach Atlantic time. What's a good approach to do this in code?

    Read the article

  • T-SQL out of order insert

    - by tearman
    Basically I have a User-Defined Table Type (for use as a table-valued variable) which I'm referencing in a stored procedure that effectively just calls two other stored procedures, then inserts those values into the table type. Id est INSERT INTO @tableValuedVariable (var1, var2, var3, var4, var5) EXEC [dbo].StoredProcedure1; INSERT INTO @tableValuedVariable (var1, var2, var5) EXEC [dbo].StoredProcedure2; You can probably already tell what I'm going to ask. Basically StoredProcedure2 only returns a few of the values the table is set to hold, and I'd like those other variables to just be null (as defined as default). Only SQL is complaining that I'm not specifying all the variables available to that table. The return datasets can be quite sizable so I'd like to avoid loops and such for obvious reasons. Thanks for any help.

    Read the article

  • Subclassing NSArrayController in order to limit size of arrangedObjects

    - by Simone Manganelli
    I'm trying to limit the number of objects in an array controller, but I still want to be able to access the full array, if necessary. A simple solution I came up with was to subclass NSArrayController, and define a new method named "limitedArrangedObjects", that returns a limited number of objects from the real set of arranged objects. (I've seen http://stackoverflow.com/questions/694493/limiting-the-number-of-objects-in-nsarraycontroller , but that doesn't address my problem.) I want this property to be observable via bindings, so I set a dependency to arrangedObjects on it. Problem is, when arrangedObjects is updated, limitedArrangedObjects seems not to be observing the value change in arrangedObjects. I've hooked up an NSCollectionView to limitedArrangedObjects, and zero objects are being displayed. (If I bind it to arrangedObjects instead, all the objects show up as expected.) What's the problem? Here's the relevant code: @property (readonly) NSArray *limitedArrangedObjects; - (NSArray *)limitedArrangedObjects; { NSArray *arrangedObjects = [super arrangedObjects]; NSUInteger upperLimit = 10000; NSUInteger count = [arrangedObjects count]; if (count > upperLimit) count = upperLimit; arrayToReturn = [arrangedObjects subarrayWithRange:NSMakeRange(0, count)]; return arrayToReturn; } + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key; { NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key]; if ([key isEqualToString:@"limitedArrangedObjects"]) { NSSet *affectingKeys = [NSSet setWithObjects:@"arrangedObjects",nil]; keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKeys]; } return keyPaths; }

    Read the article

  • Smoothing Small Data Set With Second Order Quadratic Curve

    - by Rev316
    I'm doing some specific signal analysis, and I am in need of a method that would smooth out a given bell-shaped distribution curve. A running average approach isn't producing the results I desire. I want to keep the min/max, and general shape of my fitted curve intact, but resolve the inconsistencies in sampling. In short: if given a set of data that models a simple quadratic curve, what statistical smoothing method would you recommend? If possible, please reference an implementation, library, or framework. Thanks SO!

    Read the article

  • Using Full-Text-Search in order to find partial words (SQL SERVER 2008)

    - by dig
    Hello, I'm trying to build a facebook like search for my software. I'd like to query the table customers. I've set up a FULLTEXT Index and tried the next query SELECT * FROM Customer where CONTAINS(*,'*ann*') The query does return all the customers named Ann, but it doesn't return all the customers name Anne. Is there a way to create prefix search on SQL SERVER 2008 using FTS? Thanks.

    Read the article

  • Employing elegance in order to evade importing elephants: a case of excessive dll Imports

    - by user994179
    I am writing C# code that interfaces to a legacy (Feb 2012) C program, using DllImport. It works fine, but I need to call more than 30 different functions, turning my normally impeccable, exquisite code into something of near-elephantine proportions. Surely there must be a way around this? [Warning: those with weak stomachs may want to avert their eyes from what follows]: [DllImport("C:\\Users\\mitt\\Documents\\Visual Studio 2010\\Projects\\mrSolution\\mr\\x64\\Debug\\mrDll.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] public static extern bool mrEngine_initialize( [In, Out, MarshalAs(UnmanagedType.LPStruct)] PLOT_SPEC PlotSpec); [DllImport("C:\\Users\\mitt\\Documents\\Visual Studio 2010\\Projects\\mrSolution\\mr\\x64\\Debug\\mrDll.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] public static extern bool mrEngine_getDataPoint( [In, Out, MarshalAs(UnmanagedType.LPStruct)] PLOT_SPEC PlotSpec);

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >