Search Results

Search found 105 results on 5 pages for 'datamodel'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • Datamodel for a MVC learning project

    - by Dofs
    Hi, I am trying to learn Microsoft MVC 2, and have in that case found a small project I wanted to deploy it on. My idea was to simulate a restaurant where you can order a table. Basics: A user can only reserve a full table, so I don't have the trouble of merging people on different tables. A person can order a table for a certain amount of hours. My question was how I could make the data model the smartest way. I thought of just having a my database like this: Table { Id, TableName } Reservations { Id TableId ReservedFrom ReservedTo UserId } User { UserId UserName ... } By doing it this way I would have to program a lot of the logic in e.g. the business layer, to support which tables are occupied at what time, instead of having the data model handle it. Therefore do you guys have a better way to do this?

    Read the article

  • Removing table prefixes on ASP.NET MVC DataModel entities

    - by Tim Shults
    My database tables have prefixes on them and when the DataModel generates the EntityObjects they have the prefixes at the beginning of the class name. Is there anyway that I can have those prefixes ignored when the DataModel is updating/creating the classes? I've found the below question, but with no solution. http://stackoverflow.com/questions/1800065/removing-table-prefix-in-linq2sql-setup/2525827#2525827 Thanks in advance, Tim Shults

    Read the article

  • Datamodel diagram-software

    - by megala
    I have nearly 20 tables.I want to draw datamodel diagram for this table.But it take more time.Is it possible to draw the diagram using any datamodel software.My constraint is i give dataonly it draw the diagram automatically,please suggest any softwsre related to my constraints

    Read the article

  • Can a List<> be casted to a DataModel

    - by Ignacio
    I'm trying to do the following: public String createByMarcas() { items = (DataModel) ejbFacade.findByMarcas(current.getIdMarca().getId()); updateCurrentItem(); return "List"; } public List<Modelos> findByMarcas(int idMarca){ return em.createQuery("SELECT id, descripcion FROM Modelos WHERE id_marca ="+idMarca+"").getResultList(); } But I keep getting this expection: Caused by: javax.ejb.EJBException at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5070) at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:4968) at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4756) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1955) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1906) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:198) at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84) at $Proxy347.findByMarcas(Unknown Source) at controladores.EJB31_Generated_ModelosFacade_Intf_Bean_.findByMarcas(Unknown Source) Can anyone give a hand please? Thank you very much

    Read the article

  • EJB failure to update datamodel

    - by Ignacio
    Here my EJB @Entity @Table(name = "modelos") @NamedQueries({ @NamedQuery(name = "Modelos.findAll", query = "SELECT m FROM Modelos m"), @NamedQuery(name = "Modelos.findById", query = "SELECT m FROM Modelos m WHERE m.id = :id"), @NamedQuery(name = "Modelos.findByDescripcion", query = "SELECT m FROM Modelos m WHERE m.descripcion = :descripcion")}) public class Modelos implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Basic(optional = false) @Column(name = "descripcion") private String descripcion; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idModelo") private Collection produtosCollection; @JoinColumn(name = "id_marca", referencedColumnName = "id") @ManyToOne(optional = false) private Marcas idMarca; public Modelos() { } public Modelos(Integer id) { this.id = id; } public Modelos(Integer id, String descripcion) { this.id = id; this.descripcion = descripcion; } public Modelos(Integer id, Marcas idMarca) { this.id = id; this.idMarca = idMarca; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public Collection<Produtos> getProdutosCollection() { return produtosCollection; } public void setProdutosCollection(Collection<Produtos> produtosCollection) { this.produtosCollection = produtosCollection; } public Marcas getIdMarca() { return idMarca; } public void setIdMarca(Marcas idMarca) { this.idMarca = idMarca; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Modelos)) { return false; } Modelos other = (Modelos) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "" + descripcion + ""; } } And the method accesing from the Modelosfacade public List findByMarcas(Marcas idMarca){ return em.createQuery("SELECT id, descripcion FROM Modelos WHERE idMarca = "+idMarca.getId()+"").getResultList(); } And the calling method from the controller public String createByMarcas() { //recreateModel(); items = new ListDataModel(ejbFacade.findByMarcas(current.getIdMarca())); updateCurrentItem(); System.out.println(current.getIdMarca()); return "List"; } I do not understand why I keep falling in an EJB exception.

    Read the article

  • Typescript + requirejs: How to handle circular dependencies?

    - by Aymeric Gaurat-Apelli
    I am in the process of porting my JS+requirejs code to typescript+requirejs. One scenario I haven't found how to handle is circular dependencies. Require.js returns undefined on modules that are also dependent on the current and to solve this problem you can do: MyClass.js define(["Modules/dataModel"], function(dataModel){ return function(){ dataModel = require("Modules/dataModel"); ... } }); Now in typescript, I have: MyClass.ts import dataModel = require("Modules/dataModel"); class MyClass { dataModel: any; constructor(){ this.dataModel = require("Modules/dataModel"); // <- this kind of works but I lose typechecking ... } } How to call require a second time and yet keep the type checking benefits of typescript? dataModel is a module { ... }

    Read the article

  • Eclipse Error Exporting Web Project as WAR

    - by Anand
    Hi I have the following error when I export my war file org.eclipse.core.runtime.CoreException: Extended Operation failure: org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard.performFinish(DataModelWizard.java:189) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:752) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at org.eclipse.ui.internal.handlers.WizardHandler$Export.executeHandler(WizardHandler.java:97) at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:273) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241) at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157) at org.eclipse.ui.internal.actions.CommandAction.run(CommandAction.java:171) at org.eclipse.ui.actions.ExportResourcesAction.run(ExportResourcesAction.java:116) at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311) Caused by: org.eclipse.core.commands.ExecutionException: Error exportingWar File at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.execute(J2EEArtifactExportOperation.java:131) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:376) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:401) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:352) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:242) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:214) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:202) at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard$1$CatchThrowableRunnableWithProgress.run(DataModelWizard.java:218) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Caused by: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException: Error opening archive for export.. at org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation.export(WebComponentExportOperation.java:64) at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.execute(J2EEArtifactExportOperation.java:123) ... 10 more Caused by: org.eclipse.jst.jee.archive.ArchiveSaveFailureException: Error saving archive: WebComponentArchiveLoadAdapter, Component: P/Nautilus2 to output path: D:/Nautilus2.war at org.eclipse.jst.jee.archive.internal.ArchiveFactoryImpl.saveArchive(ArchiveFactoryImpl.java:84) at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.saveArchive(J2EEArtifactExportOperation.java:306) at org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation.export(WebComponentExportOperation.java:50) ... 11 more Caused by: java.io.FileNotFoundException: D:\myproject.war (Access is denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at org.eclipse.jst.jee.archive.internal.ArchiveFactoryImpl.createSaveAdapterForJar(ArchiveFactoryImpl.java:108) at org.eclipse.jst.jee.archive.internal.ArchiveFactoryImpl.saveArchive(ArchiveFactoryImpl.java:74) ... 13 more Contains: Extended Operation failure: org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation org.eclipse.core.commands.ExecutionException: Error exportingWar File at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.execute(J2EEArtifactExportOperation.java:131) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:376) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:401) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:352) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:242) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:214) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:202) at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard$1$CatchThrowableRunnableWithProgress.run(DataModelWizard.java:218) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Caused by: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException: Error opening archive for export.. at org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation.export(WebComponentExportOperation.java:64) at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.execute(J2EEArtifactExportOperation.java:123) ... 10 more Caused by: org.eclipse.jst.jee.archive.ArchiveSaveFailureException: Error saving archive: WebComponentArchiveLoadAdapter, Component: P/Nautilus2 to output path: D:/Nautilus2.war at org.eclipse.jst.jee.archive.internal.ArchiveFactoryImpl.saveArchive(ArchiveFactoryImpl.java:84) at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.saveArchive(J2EEArtifactExportOperation.java:306) at org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation.export(WebComponentExportOperation.java:50) ... 11 more Caused by: java.io.FileNotFoundException: D:\myproject.war (Access is denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at org.eclipse.jst.jee.archive.internal.ArchiveFactoryImpl.createSaveAdapterForJar(ArchiveFactoryImpl.java:108) at org.eclipse.jst.jee.archive.internal.ArchiveFactoryImpl.saveArchive(ArchiveFactoryImpl.java:74) ... 13 more Can anyone help me out with this ?

    Read the article

  • Obj-C: Passing pointers to initialized classes in other classes

    - by FnGreg7
    Hey all. I initialized a class in my singleton called DataModel. Now, from my UIViewController, when I click a button, I have a method that is trying to access that class so that I may add an object to one of its dictionaries. My get/set method passes back the pointer to the class from my singleton, but when I am back in my UIViewController, the class passed back doesn't respond to methods. It's like it's just not there. I think it has something to do with the difference in passing pointers around classes or something. I even tried using the copy method to throw a copy back, but no luck. UIViewController: ApplicationSingleton *applicationSingleton = [[ApplicationSingleton alloc] init]; DataModel *dataModel = [applicationSingleton getDataModel]; [dataModel retrieveDataCategory:dataCategory]; Singleton: ApplicationSingleton *m_instance; DataModel *m_dataModel; - (id) init { NSLog(@"ApplicationSingleton.m initialized."); self = [super init]; if(self != nil) { if(m_instance != nil) { return m_instance; } NSLog(@"Initializing the application singleton."); m_instance = self; m_dataModel = [[DataModel alloc] init]; } NSLog(@"ApplicationSingleton init method returning."); return m_instance; } -(DataModel *)getDataModel { DataModel *dataModel_COPY = [m_dataModel copy]; return dataModel_COPY; } For the getDataModel method, I also tried this: -(DataModel *)getDataModel { return m_dataModel; } In my DataModel retrieveDataCategory method, I couldn't get anything to work. I even just tried putting a NSLog in there but it never would come onto the console. Any ideas?

    Read the article

  • JList not showing items or showing selectively.

    - by Avrahamshuk
    I have a Java Swing application using a JList to show some data from a DB. I am using DefaulListModel as the data model for the list in this way: void PopulateSoldiersList() { try { soldiersListModel = new DefaultListModel(); for (Soldier i : myBackEnd.GetAllSoldiers()) { soldiersListModel.addElement(i); } this.listSoldiers.setModel(soldiersListModel); } catch (Exception ex) {// Error Message} } And for some reason, the list just stays empty... I even did make sure at runtime that all the data is set up properly in the data model and even in the "dataModel" property of the JList! In other place at the app i have a similar problem, but there, sometimes the list show few items from the model (but not all of them) I have no idea where to go from here... please help. Thanks!

    Read the article

  • New to MVC. Actionscript 3.0 Appreciate your help.

    - by Combustion007
    Hello Everyone, I am new to design patterns and am trying to learn the MVC implementation. I have written four classes: DataModel DataView DataController Main Main serves as the application facade. The main FLA is called HelloWorld. I have a symbol called "Box" in HelloWorld. I just would like to add an instance of the "Box" on the stage. Eventually I would like to place a button and when the button is clicked, the Box instance color will be changed. I would appreciate any help, please help me figure out what am I doing wrong. Here are my Classes: DATAMODEL CLASS: package { import flash.events.*; public class DataModel extends EventDispatcher { public static const UPDATE:String = "modelUpdate"; private var _color:Number = (Math.round(Math.random()* 0xffffff)); public function DataModel() { trace("DATA MODEL INIT"); } public function get color():Number { return _color; } public function set color(p:Number):void { _color = p; notifyObserver(); } public function notifyObserver():void { dispatchEvent(new Event(DataModel.UPDATE)); } } } //DATACONTROLLER CLASS: package { import flash.events.; import flash.display.; import flash.errors.*; public class DataController { private var _model:DataModel; public function DataController(m:DataModel) { trace("DATACONTROLLER INIT"); _model = m; } } } DATAVIEW CLASS: package { import flash.events.; import flash.display.; import flash.errors.*; public class DataView extends Sprite { private var _model:DataModel; private var _controller:DataController; private var b:Box; public function DataView(m:DataModel, c:DataController) { _model = m; _controller = c; b = new Box(); b.x = b.y = 100; addChild(b); } } } And Finally THE FACADE: package { import flash.display.; import flash.events.; import flash.text.; import flash.errors.; public class Main extends Sprite { private var _model:DataModel; private var _controller:DataController; private var _view:DataView; public function Main(m:DataModel, c:DataController, v:DataView) { _model = m; _controller = c; _view = v; addChild(v); } } } When I test the movie: I get this error: ArgumentError: Error #1063: Argument count mismatch on Main(). Expected 3, got 0. Thanks alot.

    Read the article

  • Intersection() and Except() is too slow with large collections of custom objects

    - by Theo
    I am importing data from another database. My process is importing data from a remote DB into a List<DataModel> named remoteData and also importing data from the local DB into a List<DataModel> named localData. I am then using LINQ to create a list of records that are different so that I can update the local DB to match the data pulled from remote DB. Like this: var outdatedData = this.localData.Intersect(this.remoteData, new OutdatedDataComparer()).ToList(); I am then using LINQ to create a list of records that no longer exist in remoteData, but do exist in localData, so that I delete them from local database. Like this: var oldData = this.localData.Except(this.remoteData, new MatchingDataComparer()).ToList(); I am then using LINQ to do the opposite of the above to add the new data to the local database. Like this: var newData = this.remoteData.Except(this.localData, new MatchingDataComparer()).ToList(); Each collection imports about 70k records, and each of the 3 LINQ operation take between 5 - 10 minutes to complete. How can I make this faster? Here is the object the collections are using: internal class DataModel { public string Key1{ get; set; } public string Key2{ get; set; } public string Value1{ get; set; } public string Value2{ get; set; } public byte? Value3{ get; set; } } The comparer used to check for outdated records: class OutdatedDataComparer : IEqualityComparer<DataModel> { public bool Equals(DataModel x, DataModel y) { var e = string.Equals(x.Key1, y.Key1) && string.Equals(x.Key2, y.Key2) && ( !string.Equals(x.Value1, y.Value1) || !string.Equals(x.Value2, y.Value2) || x.Value3 != y.Value3 ); return e; } public int GetHashCode(DataModel obj) { return 0; } } The comparer used to find old and new records: internal class MatchingDataComparer : IEqualityComparer<DataModel> { public bool Equals(DataModel x, DataModel y) { return string.Equals(x.Key1, y.Key1) && string.Equals(x.Key2, y.Key2); } public int GetHashCode(DataModel obj) { return 0; } }

    Read the article

  • Python: Implementing slicing in __getitem__

    - by nicotine
    I am trying to implement slice functionality for a class I am making that creates a vector representation. I have this code so far, which I believe will properly implement the slice but whenever I do a call like v[4] where v is a vector python returns an error about not having enough parameters. So I am trying to figure out how to define the getitem class to handle both plain indexes and slicing. def __getitem__(self, start, stop, step): indx = start if stop == None: end = start + 1 else: end = stop if step == None: stride = 1 else: stride = step return self.__data[indx:end:stride]

    Read the article

  • How is the 'is' keyword implemented in Python?

    - by Srikanth
    ... the is keyword that can be used for equality in strings. >>> s = 'str' >>> s is 'str' True >>> s is 'st' False I tried both __is__() and __eq__() but they didn't work. >>> class MyString: ... def __init__(self): ... self.s = 'string' ... def __is__(self, s): ... return self.s == s ... >>> >>> >>> m = MyString() >>> m is 'ss' False >>> m is 'string' # <--- Expected to work False >>> >>> class MyString: ... def __init__(self): ... self.s = 'string' ... def __eq__(self, s): ... return self.s == s ... >>> >>> m = MyString() >>> m is 'ss' False >>> m is 'string' # <--- Expected to work, but again failed False >>> Thanks for your help!

    Read the article

  • Struggling with a data modeling problem

    - by rpat
    I am struggling with a data model (I use MySQL for the database). I am uneasy about what I have come up with. If someone could suggest a better approach, or point me to some reference matter I would appreciate it. The data would have organizations of many types. I am trying to do a 3 level classification (Class, Category, Type). Say if I have 'Italian Restaurant', it will have the following classification Food Services Restaurants Italian However, an organization may belong to multiple groups. A restaurant may also serve Chinese and Italian. So it will fit into 2 classifications Food Services Restaurants Italian Food Services Restaurants Chinese The classification reference tables would be like the following: ORG_CLASS (RowId, ClassCode, ClassName) 1, FOOD, Food Services ORG_CATEGORY(RowId, ClassCode, CategoryCode, CategoryName) 1, FOOD, REST, Restaurants ORG_TYPE (RowId, ClassCode, CategoryCode, TypeCode, TypeName) 100, FOOD, REST, ITAL, Italian 101, FOOD, REST, CHIN, Chinese 102, FOOD, REST, SPAN, Spanish 103, FOOD, REST, MEXI, Mexican 104, FOOD, REST, FREN, French 105, FOOD, REST, MIDL, Middle Eastern The actual data tables would be like the following: I will allow an organization a max of 3 classifications. I will have 3 GroupIds each pointing to a row in ORG_TYPE. So I have my ORGANIZATION_TABLE ORGANIZATION_TABLE (OrgGroupId1, OrgGroupId2, OrgGroupId3, OrgName, OrgAddres) 100,103,NULL,MyRestaurant1, MyAddr1 100,102,NULL,MyRestaurant2, MyAddr2 100,104,105, MyRestaurant3, MyAddr3 During data add, a dialog could let the user choose the clssa, category, type and the corresponding GroupId could be populated with the rowid from the ORG_TYPE table. During Search, If all three classification are chosen, It will be more specific. For example, if Food Services Restaurants Italian is the criteria, the where clause would be 'where OrgGroupId1 = 100' If only 2 levels are chosen Food Services Restaurants I have to do 'where OrgGroupId1 in (100,101,102,103,104,105, .....)' - There could be a hundred in that list I will disallow class level search. That is I will force selection of a class and category The Ids would be integers. I am trying to see performance issues and other issues. Overall, would this work? or I need to throw this out and start from scratch.

    Read the article

  • python __getattr__ help

    - by Stefanos Tux Zacharakis
    Reading a Book, i came across this code... # module person.py class Person: def __init__(self, name, job=None, pay=0): self.name = name self.job = job self.pay = pay def lastName(self): return self.name.split()[-1] def giveRaise(self, percent): self.pay = int(self.pay *(1 + percent)) def __str__(self): return "[Person: %s, %s]" % (self.name,self.pay) class Manager(): def __init__(self, name, pay): self.person = Person(name, "mgr", pay) def giveRaise(self, percent, bonus=.10): self.person.giveRaise(percent + bonus) def __getattr__(self, attr): return getattr(self.person, attr) def __str__(self): return str(self.person) It does what I want it to do, but i do not understand the __getattr__ function in the Manager class. I know that it Delegates all other attributes from Person class. but I do not understand the way it works. for example why from Person class? as I do not explicitly tell it to. person(module is different than Person(class) Any help is highly appreciated :)

    Read the article

  • Relationship Modelling in Core Data

    - by Stevie
    Hi there, I'm fairly new to Objective C and Core Data and have a problem designing a case where players team up one-on-one and have multiple matches that end up with a specific result. With MySQL, I would have a Player table (player primary key, name) and a match table (player A foreign key, player B foreign key, result). Now how do I do this with Core Data? I can easily tie a player entity to a match entity using a relationship. But how do I model the inverse direction for the second player ref. in the match entity? Player Name: Attribute Match: Relationship Match Match Result: Attribute PlayerA: Relationship to Player (<- Inverse to Player.Match) PlayerB: Relationship to Player (<- Inverse to ????) Would be great if someone could give me an idea on this! Thanks, Stevie.

    Read the article

  • Webbased data modelling and management tool

    - by pixeldude
    Is there a web-based tool available, where I am able to... ...define data models (like in a database admin tool) ...fill in data (in custom web forms, not too generic) with basic features like completion ...import data from CSV oder Excel Sheets ...export data to CSV or SQL ...create snapshots of my data models (versions, diff, etc.) ...share my data models ...discuss/collaborate with other people about my data models Well, I can develop something like this in PHP or with Ruby or whatever. But this is such a common task, where the application support could be a lot better. And it would be language and database independent. This would help to maintain data models in different versions and you can maybe share your data models with others, extend it with your team members, etc. There is a website called FreeBase, which allows you to define a data entity model and fill in data, which also has export features, but I need to define my own data model with my own granularity and structure. And it should not be shared in public if I don't want to. How do you solve problems like this yourself?

    Read the article

  • iPhone: Using a NSMutableArry in the AppDelegate as a Global Variable

    - by aahrens
    What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate. I then have two UIViewControllers. One view is responsible for displaying the array from the AppDelegate. The other view is used to add items to the array. So the array starts out to be empty. View1 doesn't display anything because the array is empty. The User goes to View2 and adds an item to the array in AppDelegate. Then when the user goes back to View1 it now displays one item. Here is how I'm trying to accomplish this @interface CalcAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UITabBarController *tabBarController; NSMutableArray *globalClasses; } @property (nonatomic,retain) NSMutableArray *globalClasses; My other view In the viewDidload I set the array in my View to be the one in the AppDelegate. In an effort to retain values. allCourses = [[NSMutableArray alloc]init]; CalcAppDelegate *appDelegate = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; allCourses = appDelegate.globalClasses; Then I would update my allCourses array by adding a new item. Then try to set the array in the AppDelegate to be equal to the modified one. CalcAppDelegate *appDel = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; NSLog(@"Size before reset %d",[appDel.globalClasses count]); appDel.globalClasses = allCourses; NSLog(@"Size after reset %d",[appDel.globalClasses count]); What I'm seeing that's returned is 2 in the before, and 2 after. So it doesn't appear to be getting updated properly. Any suggestions?

    Read the article

  • Problems with CoreDataBooks Example from Apple

    - by eemceebee
    Hi I am currently playing with CoreData and have a problem with the CoreDataBooks Example from Apple. Basically I just wanted to extend the data model. I updated the model class aswell and no compiler error, butr a crash when I want to start the example. Unresolved error Error Domain=NSCocoaErrorDomain Code=134130 UserInfo=0x1316ce0 "Operation could not be completed. (Cocoa error 134130.)", { URL = file://localhost/.../CoreDataBooks.sqlite; ...some nonsense info ... reason = "Can't find model for source store"; } Do I need to updat the sqlite database ? Thanks

    Read the article

  • Suddenly unable to export to war file from exclipse

    - by Codeguy007
    I been working on this Servlet project all morning and now suddenly I cannot get eclipse to export the project to a war file. I tried restarting eclipse and cleaning the project but I just get the same result. Any ideas? org.eclipse.core.runtime.CoreException: Extended Operation failure: org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard.performFinish(DataModelWizard.java:182) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.jface.window.Window.runEventLoop(Window.java:820) at org.eclipse.jface.window.Window.open(Window.java:796) at org.eclipse.ui.actions.ExportResourcesAction.run(ExportResourcesAction.java:180) at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447) at org.eclipse.equinox.launcher.Main.run(Main.java:1173) org.eclipse.core.runtime.CoreException[0]: org.eclipse.core.commands.ExecutionException: Error exportingWar File at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.execute(J2EEArtifactExportOperation.java:103) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:376) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:401) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:352) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:242) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:214) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89) at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:202) at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard$1$CatchThrowableRunnableWithProgress.run(DataModelWizard.java:211) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) Caused by: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException: IWAE0017E Unable to replace original archive: C:\Users\mark\uploads\myfirstjsp.war at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.cleanupAfterTempSave(ArchiveImpl.java:322) at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.saveAsNoReopen(ArchiveImpl.java:1182) at org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation.export(WebComponentExportOperation.java:54) at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.execute(J2EEArtifactExportOperation.java:95) ... 10 more

    Read the article

1 2 3 4 5  | Next Page >