Search Results

Search found 18746 results on 750 pages for 'single sign on'.

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

  • Adding STI to Existing Table...

    - by keruilin
    I want to add STI to an existing table using a custom type column. Let's call this taste_type whose corresponding model is Fruit. In the Fruit model I have: set_inheritance_column :taste_type In my migration to add STI I have: class AddSTI < ActiveRecord::Migration def self.up add_column :fruits, :taste_type, :string, :limit => 100, :null => false Fruit.reset_column_information Fruit.find_by_id(1).update_attributes({:taste_type => 'Sour'}) end def self.down remove_column :fruits, :taste_type end end When I run the migration, I get the following error: Mysql::Error: Column 'taste_type' cannot be null: ... Any idea what's going? I can get the migration to run if I comment the set_inheritance_column in the Fruit model, then uncomment it after I run the migration. Obviously, I don't want to do this, however.

    Read the article

  • django powering multiple shops from one code base on a single domain

    - by imanc
    Hey, I am new to django and python and am trying to figure out how to modify an existing app to run multiple shops through a single domain. Django's sites middleware seems inappropriate in this particular case because it manages different domains, not sites run through the same domain, e.g. : domain.com/uk domain.com/us domain.com/es etc. Each site will need translated content - and minor template changes. The solution needs to be flexible enough to allow for easy modification of templates. The forms will also need to vary a bit, e.g minor variances in fields and validation for each country specific shop. I am thinking along the lines of the following as a solution and would love some feedback from experienced django-ers: In short: same codebase, but separate country specific urls files, separate templates and separate database Create a middleware class that does IP localisation, determines the country based on the URL and creates a database connection, e.g. /au/ will point to the au specific database and so on. in root urls.py have routes that point to a separate country specific routing file, e..g (r'^au/',include('urls_au')), (r'^es/',include('urls_es')), use a single template directory but in that directory have a localised directory structure, e.g. /base.html and /uk/base.html and write a custom template loader that looks for local templates first. (or have a separate directory for each shop and set the template directory path in middleware) use the django internationalisation to manage translation strings throughout slight variances in forms and models (e.g. ZA has an ID field, France has 'door code' and 'floor' etc.) I am unsure how to handle these variations but I suspect the tables will contain all fields but allowing nulls and the model will have all fields but allowing nulls. The forms will to be modified slightly for each shop. Anyway, I am keen to get feedback on the best way to go about achieving this multi site solution. It seems like it would work, but feels a bit "hackish" and I wonder if there's a more elegant way of getting this solution to work. Thanks, imanc

    Read the article

  • javascript to launch only ONE window for a Java applet with a given URL

    - by Jonathan Dugan
    I need a javascript solution to launch only one window, with a Java Applet in it, for a given URL. I found a solution posted here on Stack Overflow - here: http://stackoverflow.com/questions/528671/javascript-window-open-only-if-the-window-does-not-already-exist But it doesn't seem to work .. I get Error: launchApplication.winrefs is undefined Line: 29 I can't seem to post the code in this little box and make it look right below, so the code (my working code, plus the solution from above) is here: http://pastie.org/833879 Where is the error? As I understand it, the hash or array or whatever I use to store the called references to the windows opened this way will be lost if the calling window is closed. Is there a way to make this work even if the calling window is closed and reopened? To basically ask the browser: "Do you have a window open with the following URL?" and if so, "What is the reference to that window?" (so I can raise it).

    Read the article

  • Virgin STI Help

    - by Mutuelinvestor
    I am working on a horse racing application and I'm trying to utilize STI to model a horse's connections. A horse's connections is comprised of his owner, trainer and jockey. Over time, connections can change for a variety of reasons: The horse is sold to another owner The owner switches trainers or jockey The horse is claimed by a new owner As it stands now, I have model this with the following tables: horses connections (join table) stakeholders (stakeholder has three sub classes: jockey, trainer & owner) Here are my clases and associations: class Horse < ActiveRecord::Base has_one :connection has_one :owner_stakeholder, :through => :connection has_one :jockey_stakeholder, :through => :connection has_one :trainer_stakeholder, :through => :connection end class Connection < ActiveRecord::Base belongs_to :horse belongs_to :owner_stakeholder belongs_to :jockey_stakeholder belongs_to :trainer_stakeholder end class Stakeholder < ActiveRecord::Base has_many :connections has_many :horses, :through => :connections end class Owner < Stakeholder # Owner specific code goes here. end class Jockey < Stakeholder # Jockey specific code goes here. end class Trainer < Stakeholder # Trainer specific code goes here. end One the database end, I have inserted a Type column in the connections table. Have I modeled this correctly. Is there a better/more elegant approach. Thanks in advance for you feedback. Jim

    Read the article

  • Fluent NHibernate mapping List<Point> as value to single column

    - by Paja
    I have this class: public class MyEntity { public virtual int Id { get; set; } public virtual List<Point> Vectors { get; set; } } How can I map the Vectors in Fluent NHibernate to a single column (as value)? I was thinking of this: public class Vectors : ISerializable { public List<Point> Vectors { get; set; } /* Here goes ISerializable implementation */ } public class MyEntity { public virtual int Id { get; set; } public virtual Vectors Vectors { get; set; } } Is it possible to map the Vectors like this, hoping that Fluent NHibernate will initialize Vectors class as standard ISerializable? Or how else could I map List<Point> to a single column? I guess I will have to write the serialization/deserialization routines myself, which is not a problem, I just need to tell FNH to use those routines. I guess I should use IUserType or ICompositeUserType, but I have no idea how to implement them, and how to tell FNH to cooperate.

    Read the article

  • Two models, one STI and a Validation

    - by keruilin
    Let's say I have two tables -- Products and Orders. For the sake of simplicity assume that only one product can be purchased at a time so there is no join table like order_items. So the relationship is that Product has many orders, and Order belongs to product. Therefore, product_id is a fk in the Order table. The product table is STI -- with the subclasses being A, B, C. When the user orders subclass Product C, two special validations must be checked on the Order model fields order_details and order_status. These two fields can be nil for all other Product subclasses (ie A and B). In other words, no validation needs to run for these two fields when a user purchases A and B. My question is: How do I write validations (perhaps custom?) in the Order model so that the Order model knows to only run the validations for the two fields -- order_details and order_status -- when Product subclass C is being saved to the orders table?

    Read the article

  • Reducing decimal places in Delphi

    - by Hendriksen123
    I am storing a list of numbers (as Double) in a text file, then reading them out again. When I read them out of the text file however, the numbers are placed into the text box as 1.59993499 for example, instead of 1.6. AssignFile(Pipe, 'EconomicData.data'); Reset(Pipe); For i := 1 to 15 Do ReadLn(Pipe, SavedValue[i]); CloseFile(Pipe); Edit1.Text := FloatToStr(SavedValue[1]); The text in Edit1.text, from the code above, would be 1.59999... instead of the 1.6 in the text file. How can i make it so the text box displays the original value (1.6)?

    Read the article

  • Single developer, project organization

    - by poke
    I am looking for a good (and free) way to organize some of my personal projects. I am saying "organize" because I'm not sure, if the standard project management software solutions are exactly what I am looking for and especially something what I, as a single developer, need. In general, I just want to keep my progress of my projects organized in some way. I would like to be able to keep track of milestones and split those into multiple smaller tasks, so I can keep track of my progress. So some task/issue based system would probably be good, especially as I also want to keep track of issues/bugs with specific versions (although I alone will create those issues). I am and will be the only developer on those projects, so it doesn't matter if the software is offline or online, and I also don't need any collaboration features (like commenting on things, or assigning tasks to other developers etc). But if there is a good software that fits my needs, and in addition it has those things, I don't really care. After all it's easy enough to not use available features. Many online solutions also offer integrated code hosting. I am using git internally, but I don't plan to push any of the code, so such a feature is not needed either. In case of online solutions however I would like the projects to be closed to the public (some of the online utilities only offer open source projects for free and require payments for private projects). I have looked at some project management solutions already, I also read some similar questions here on SO. But given that I'm a single developer, my focus is probably a bit different as when others ask for a huge distributed software that supports many developers and different collaboration features. Some standard answers such as Trac (which also only supports one project), Redmine and FogBUGZ look interesting, but are a bit off my interest (although you may change my mind on that :P). Currently, I'm looking at Indefero which doesn't look too bad. But what do you think?

    Read the article

  • How do I Data-Bind dual DateTimePicker to a single DateTime object

    - by S.C. Madsen
    Hi, I have a simple form, with two DateTimePicker-controls: One for date, and one for time. The thing is these two controls are supposed to represent a single point in time. Hence I would like to "Bind" them to a single DateTime property on my form (for simplicity). I did the following: // Start is a DateTime property on the form _StartDate.DataBindings.Add("Value", this, "Start"); _StartTime.DataBindings.Add("Value", this, "Start"); But hooking into "ValueChanged" event, yields mixed results... Sometimes I get exactly what I want, sometimes the updates of the property are "sluggish". I figured this way of splitting into two DateTimePicker's was fairly common. So how to do it? Update: There is possibly multiple questions in there: How do I bind a DateTimePicker (Format: Date) to a DateTime Property on a form? Then, how do I bind yet another DateTimePicker (Format: Time) to the same property? I'm using Visual Studio Express 2008 (.NET 3.5), and I seemingly get ValueChanged events from the DateTimePickers before the value is changed?

    Read the article

  • Organizing a lot of models that use STI in rails

    - by DavidP6
    I have a scenario where I am going to be creating a large number of models that use STI and I'm wondering what the best way to organize this is. I already have other models using STI and I really do not want to add any more files to my models folder. Is there any way to create a folder and add the models using STI there (there could be upwards of 40 b/c each uses its own methods to scrape a different site, but they all save the same data)? This seems like it would be best, or I could add them all to one file but I would rather separate them.

    Read the article

  • Is it possible to prevent out-of-order execution by using single volatile

    - by Yan Cheng CHEOK
    By referring article, it is using a pair of volatile to prevent out-of-order execution. I was wondering, is it possible to prevent it using single volatile? void fun_by_thread_1() { this.isNuclearFactory = true; this.factory = new NuclearFactory(); } void fun_by_thread_2() { Factory _factory = this.factory; if (this.isNuclearFactory) { // Do not operate nuclear factory!!! return; } // If out-of-order execution happens, _factory might // be NuclearFactory instance. _factory.operate(); } Factory factory = new FoodFactory(); volatile boolean isNuclearFactory = false; The reason I ask, is because I have a single guard flag (similar to isNuclearFactory flag), to guard against multiple variables (similar to many Factory). I do not wish to mark all the Factory as volatile. Or, shall I fall into the following solution? void fun_by_thread_1() { try { writer.lock(); this.isNuclearFactory = true; this.factory = new NuclearFactory(); } finally { writer.unlock(); } } void fun_by_thread_2() { try { reader.lock(); Factory _factory = this.factory; if (this.isNuclearFactory) { // Do not operate nuclear factory!!! return; } } finally { reader.unlock(); } _factory.operate(); } Factory factory = new FoodFactory(); boolean isNuclearFactory = false; P/S: I know instanceof. Factory is just an example to demonstrate of out-of-order problem.

    Read the article

  • Using STI path with same controller

    - by TenJack
    I am using STI and am wondering, do I have to have a separate controller for each model? I have a situation where I only use the create and edit actions for one model in the STI relationship, but I get an 'undefined method' error if I try to do a form for. More specifically, I have two models that inherit from List: class RegularList < List class OtherList < List and I have a lists controller that handles these actions, but I only create new models with RegularList using forms. i.e. the only situation where I use a form_for to create a new List object is with RegularList. What I would like to do is something like: class ListsController < ApplicationController def new @list = RegularList.new end otherwise the route for creating a new list looks like regular_list/new but I would like it to just be list/new. Thoughts?

    Read the article

  • SRP & "axis of change"?

    - by lance
    I'm reading Bob Martin's principles of OOD, specifically the SRP text, and I understand the spirit of what it's saying pretty well, but I don't quite understand a particular phrasing, from page 2 of the link (page 150 of the book): I paraphrase: It is important to separate these two responsibilities into separate classes because each responsibility is an axis of change. What exactly is meant here by "axis of change"?

    Read the article

  • Running single test class or group with Surefire and TestNG

    - by Slartibartfast
    I want to run single test class from command line using Maven and TestNG Things that doesn't work: mvn -Dtest=ClassName test I have defined groups in pom.xml, and this class isn't in one of those groups. So it got excluded on those grounds. mvn -Dgroups=skipped-group test mvn -Dsurefire.groups=skipped-group test when config is <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.7.1</version> <configuration> <groups>functest</groups> </configuration> </plugin> Parameters work fine in there are no groups defined in pom.xml. Similarly, when surefire is configured with <configuration> <includes> <include>**/*UnitTest.java</include> </includes> </configuration> I can add another test with -Dtest parameter, but cannot add group. In any combination, I can narrow down tests to be executed with groups, but not expand them. What's wrong with my configuration? Is there a way to run a single test or group outside of those defined in pom.xml? Tried on Ubuntu 10.04 with Maven 2.2.1, TestNG 5.14.6 and Surefire 2.7.1

    Read the article

  • how to achieve this single line css format....

    - by metal-gear-solid
    I tried many formats but this is best to find classes and IDs easily without using "Find". but it is good if width of editor is wide. I use this tool to format my css in single line http://www.newmediacampaigns.com/files/posts/css-formatting/clean.php #wrapper {width:800px; margin:0 auto;} #header {height:100px; position:relative;} #feature .post {width:490px; float:left;} #feature .link {width:195px; display:inline; margin:0 10px 0 0;float:right;border-bottom:1px solid red} #footer {clear:both; font-size:93%; float:none;} I need like this. see selector #feature .link i need if any selector has more than 3 properties then it should go at next line like in this example.because i work in cms where width of textbox where i write cssis not much wide. Is there any tool/software can format CSS like this. or after getting single line format can we this formatting for big lines. in automated way #wrapper {width:800px; margin:0 auto;} #header {height:100px; position:relative;} #feature .post {width:490px; float:left;} #feature .link {width:195px; display:inline; margin:0 10px 0 0; float:right;bottom:1px solid red} #footer {clear:both; font-size:93%; float:none;}

    Read the article

  • Single log file for multiple webapps

    - by Ashish Aggarwal
    In my tomcat there are multiple webapps deployed and they communicate with each other. Currently they all have their own log file. But when there is some issue comes from call I have to 1st check with the app to whom I made a call and check log file of respective apps involved in the call. So I want that, as all apps is deployed in same tomcat and sharing a common log4j, if a call made to any app then all logs should be in a single log file and no matters how my webapps are involved all error comes from any webapp during the call should be in a single log file. I have no idea how can I achieve this. So any help is appreciable. Edited: I think my question is not cleared so updated with use case: I have three webapps A, B, C having logs files as A.log, B.log and C.log. I made two calls. 1st one to A (that internally calls C) and 2nd to B (that internally calls C). Now logging of first call must be in A.log (with the logs of every step performed inside the webapp c) and second call must be in B.log (with the logs of every step performed inside the webapp c).

    Read the article

  • flex data provider not working if XML has single node value or less

    - by Rees
    hello, i get this error when i retrieve an XML that only has 1 node (no repeating nodes) and i try to store in an ArrayCollection. -When I have MORE than 1 "name" nodes...i do NOT get an error. My test show that XMLListCollection does NOT work either. TypeError: Error #1034: Type Coercion failed: cannot convert "XXXXXX" to mx.collections.ArrayCollection. this error occurs as the line of code: myList= e.result.list.name; Why can't ArrayCollection work with a single node? I'm using this ArrayCollection as a dataprovider for a Component -is there an alternative I can use that will take BOTH single and repeating nodes as well as work as a dataprovider? Thanks in advance! code: [Bindable] private var myList:ArrayCollection= new ArrayCollection(); private function getList(e:Event):void{ var getStudyLoungesService:HTTPService = new HTTPService(); getStuffService.url = "website.com/asdf.php"; getStuffService.addEventListener(ResultEvent.RESULT, onGetList); getStuffService.send(); } private function onGetList(e:ResultEvent):void{ myList= e.result.list.name; }

    Read the article

  • You are only allowed to have a single MapView in a MapActivity

    - by ProNeticas
    I have a function that shows a map page so I can get the user to choose their current location. But if you run this function twice it crashes the App with the Single MapView in a MapActivity error (i.e. opening that settings view again). public void showMapSetterPage(View v) { Log.i(DEBUG_TAG, "Settings screen, set map center launched"); // Set which view object we fired off from set_pv(v); // Show Map Settings Screen setContentView(R.layout.set_map_center); // Initiate the center point map if (mapView == null) { mapView = (MapView) findViewById(R.id.mapview); } mapView.setLongClickable(true); mapView.setStreetView(true); mapView.setBuiltInZoomControls(false); mapView.setSatellite(false); mapController = mapView.getController(); mapController.setZoom(18); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Location location = lm .getLastKnownLocation(LocationManager.GPS_PROVIDER); int lat = (int) (location.getLatitude() * 1E6); int lng = (int) (location.getLongitude() * 1E6); Log.i(DEBUG_TAG, "The LAT and LONG is: " + lat + " == " + lng); point = new GeoPoint(lat, lng); // mapController.setCenter(point); mapController.animateTo(point); } So I have a button that shows this View and onClick="showMapSetterPage". But if you go back to the settings screen out of the map and click the button again I get this error: 03-06 20:55:54.091: ERROR/AndroidRuntime(28014): Caused by: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity How can I delete the MapView and recreate it?

    Read the article

  • ActiveRecord Validations for Models with has_many, belongs_to associations and STI

    - by keruilin
    I have four models: User Award Badge GameWeek The associations are as follows: User has many awards. Award belongs to user. Badge has many awards. Award belongs to badge. User has many game_weeks. GameWeek belongs to user. GameWeek has many awards. Award belongs to game_week. Thus, user_id, badge_id and game_week_id are foreign keys in awards table. Badge implements an STI model. Let's just say it has the following subclasses: BadgeA and BadgeB. Some rules to note: The game_week_id fk can be nil for BadgeA, but can't be nil for BadgeB. Here are my questions: For BadgeA, how do I write a validation that it can only be awarded one time? That is, the user can't have more than one -- ever. For BadgeB, how do I write a validation that it can only be awarded one time per game week?

    Read the article

  • How to override the attr_protected?

    - by KandadaBoggu
    I have STI implementation as follows: class Automobile < ActiveRecord::Base end class Car < Automobile end class Truck < Automobile end class User < ActiveRecord::Base has_many :automobiles accepts_nested_attributes_for :automobiles end I am creating a list of automobiles for a user. For each automobile, the UI sets the type field and the properties associated with the automobile.While form submission, the type field is ignored as it is a protected attribute. How do I work around this issue? Is there a declarative way to unprotect a protected attribute?

    Read the article

  • WPF Single Selection Across Multiple ItemsControls

    - by gregsdennis
    Part of my app has a month-view calendar interface, but I'm having trouble with item selection. The interface is set up so that each of the days in the view contains a ListBox of items, much like the month view in Outlook. The problem I'm experiencing is that I need to maintain a single item selection across all of the ListBoxes. Below is a sample window that should adequately describe my situation. I need to maintain a single selection between both ListBoxes. <Window x:Class="StackOverflow.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <ListBox ItemsSource="{Binding Numbers}" SelectedItem="{Binding SelectedObject"/> <ListBox Grid.Column="1" ItemsSource="{Binding Dates}" SelectedItem="{Binding SelectedObject"/> </Grid> </Window> In this primitive example, I would expect that when the SelectedObject property of my view model gets set to an item that's not in one ListBox, the selection would be removed in that ListBox, but that doesn't happen. I understand that I can simply name each ListBox, and hook into the SelectionChanged event. I'd prefer to not have to do that with an entire month-view calendar. There has to be a better way. In a previous iteration of the app, I was able to create a SelectionManager static class with an attached property that was used to maintain selection. However, I can't use this now as the classes I'm using for my items are not DependencyObjects, and I'd really prefer not to have to create DependencyObject wrapper classes as this will considerably complicate my architecture. Thanks.

    Read the article

  • Rails object inheritence with belongs_to

    - by Rabbott
    I have a simple has_many/belongs_to relationship between Report and Chart. The issue I'm having is that my Chart model is a parent that has children. So in my Report model I have class Report < ActiveRecord::Base has_many :charts end And my Chart model is a parent, where Pie, Line, Bar all inherit from Chart. I'm not sure where the belongs_to :report belongs within the chart model, or children of chart model. I get errors when I attempt to access chart.report because the object is of type "Class" undefined local variable or method `report' for #< Class:0x104974b90 The Chart model uses STI so its pulling say.. 'Pie' from the chart_type column in the charts table.. what am I missing?

    Read the article

  • jQuery selectable with a single element deselected by clicking

    - by BerggreenDK
    I would like to be able to deselect a selected item by clicking or using lasso, just like in Photoshop where I keep another key down to "deselect" parts of an existing selection. Is this possible? As I understand "jQuery UI selectable". There is only "single click" with or without CTRL to add multiple and then the quick lasso. I am trying to see how it would be possible to deselect, one or two elements of a whole selection by clicking them off again. Eg, you drag the lasso and get 30 elements but finds that 1 does not need to be part of this selection. You click it and deselects it. So something that reacts to the existing selection and removes the choosen element. Or with the lasso, you make a lasso selection. Gets 30 elements. Then you draw a new lasso, this time starting on an already selected element, now it default deselects and so does the rest of the group marked. I believe this should be customizable behaviour for the jQueryUI if anything. But is the "single deselect" possible with a simple jQuery hack or will it demand a lot of code?

    Read the article

  • How to combine two separate unrelated Git repositories into one with single history timeline

    - by Antony
    I have two unrelated (not sharing any ancestor check in) Git repositories, one is a super repository which consists a number of smaller projects (Lets call it repository A). Another one is just a makeshift local Git repository for a smaller project (lets call it repository B). Graphically, it would look like this A0-B0-C0-D0-E0-F0-G0-HEAD (repo A) A0-B0-C0-D0-E0-F0-G0-HEAD (remote/master bare repo pulled & pushed from repo A) A1-B1-C1-D1-E1-HEAD (repo B) Ideally, I would really like to merge repo B into repo A with a single history timeline. So it would appear that I originally started project in repo A. Graphically, this would be the ideal end result A0-A1-B1-B0-D1-C0-D0-E0-F0-G0-E1-H(from repo B)-HEAD (new repo A) A0-A1-B1-B0-D1-C0-D0-E0-F0-G0-E1-H(from repo B)-HEAD (remote/master bare repo pulled & pushed from repo A) I have been doing some reading with submodules and subtree (Pro Git is a pretty good book by the way), but both of them seem to cater solution towards maintaining two separate branch with sub module being able to pull changes from upstream and subtree being slightly less headache. Both solution require additional and specialized git commands to handle check ins and sync between master and sub tree/module branch. Both solution also result in multiple time-lines (with --squash you even get 3 timelines with subtree). The closest solution from SO seems to talk about "graft", but is that really it? The goal is to have a single unified repository where I can pull/push check-ins, so that there are no more repo B, just repo A in the end.

    Read the article

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