Search Results

Search found 13135 results on 526 pages for 'actor model'.

Page 99/526 | < Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >

  • What is the best way to create related types at runtime?

    - by SniperSmiley
    How do I determine the type of a class that is related to another class at runtime? I have figured out a solution, the only problem is that I ended up having to use a define that has to be used in all of the derived classes. Is there a simpler way to do this that doesn't need the define or a copy paste? Things to note: both the class and the related class will always have their respective base class, the different classes can share a related class, and as in the example I would like the control class to own the view. #include <iostream> #include <string> class model; class view { public: view( model *m ) {} virtual std::string display() { return "view"; } }; #define RELATED_CLASS(RELATED)\ typedef RELATED relatedType;\ virtual relatedType*createRelated(){\ return new relatedType(this);} class model { public: RELATED_CLASS(view) model() {} }; class otherView : public view { public: otherView( model *m ) : view(m) {} std::string display() { return "otherView"; } }; class otherModel : public model { public: RELATED_CLASS(otherView) otherModel() {} }; class control { public: control( model *m ) : m_(m), v_( m->createRelated() ) {} ~control() { delete v_; } std::string display() { return v_->display(); } model *m_; view *v_; }; int main( void ) { model m; otherModel om; model *pm = &om; control c1( &m ); control c2( &om ); control c3( pm ); std::cout << c1.display() << std::endl; std::cout << c2.display() << std::endl; std::cout << c3.display() << std::endl; }

    Read the article

  • How do I aggregate activerecord model data for a specific time period?

    - by gsiener
    I'm collecting data from a system every ~10s (this time difference varies due to communication time with networked devices). I'd like to calculate averages and sums of the stored values for this activerecord model on a daily basis. All records are stored in UTC. What's the correct way to sum and average values for, e.g., the previous day from midnight to midnight EST? I can do this in sql but don't know the "rails way" to make this calculation.

    Read the article

  • MVC2 Data Annotation Buddy Classes Doesn't seem to work when Classes and EOM Model is in separate Project

    - by Danish Ali
    Dear All Iam new to MVC2 and having a little problem with implementing validation via buddy classes. Iam using Repository pattern with dependency injection. My Entity Object Model is in Data Layer Project and Buddy Classes are in Business Layer project and MVC 2 Project as a separate Presentation Layer Project. Can any one help me out with implementing Buddy Classes in this Architecture. Thanks and Regards Dani

    Read the article

  • Navigation and Tab Bar both are in app, which model to follow?

    - by iPhoneDev
    Which model should I use, if my First view in Login view (NO Tab required) and then all other views are under Tab Bar. So as a rule should I create Navigation based template coz First view uses only Navigation not Tab Bar or is there any other way around? Please suggest First Screen with Nav bar in Top (MUST Needed) Second Screen Tab Bar view:

    Read the article

  • Is Paypal In-App model for Android legal on Android Market?

    - by sunil
    Hi, As you all might be knowing that Paypal has launched an in-App purchase model for Anroid. I will like to know whether this is legally allowed in Android market or not. I know this may not be the best place to ask this but being developers if anyone has developed an application which uses Paypal In-App and is on Android Market then it would be a great help. Regards Sunil

    Read the article

  • Kohana 3 Auto loading Models

    - by pigfox
    I'm attempting to use a Model but I get a fatal error so I assume it doesn't autoload properly. ErrorException [ Fatal Error ]: Class 'Properties_Model' not found The offending controller line: $properties = new Properties_Model; The model: class Properties_Model extends Model { public function _construct() { parent::_construct(); } } I also put the class in three different locations hoping one would work, all there failed. They are: application/classes/model application/model application/models What am I missing?

    Read the article

  • xna manual animation

    - by tasyjean
    i want to animate 3d model in xna programmatically ,i tried to transform bones but nothing to happen only the whole model transform not individual bones as i want i read the 3d model by basic model processor so how i do this ? and is there any need to extended model processor like skinnedModelSample please explain the steps

    Read the article

  • How do I make all the finders on the model ignorecase?

    - by Glex
    I have a model with several attributes, among them title and artist. The case of title and artist should be ignored in all the Active Record finders. Basically, if title or artist are present in the :conditions (or dynamically i.e. find_all_by_artist), then the WHERE artist = :artist should become WHERE UPPER(artist) = UPPER(:artist) or something along these lines. Is there a way of doing it with Rails?

    Read the article

  • How would you structure your entity model for storing arbitrary key/value data with different data t

    - by Nathan Ridley
    I keep coming across scenarios where it will be useful to store a set of arbitrary data in a table using a per-row key/value model, rather than a rigid column/field model. The problem is, I want to store the values with their correct data type rather than converting everything to a string. This means I have to choose either a single table with multiple nullable columns, one for each data type, or a set of value tables, one for each data type. I'm also unsure as to whether I should use full third normal form and separate the keys into a separate table, referencing them via a foreign key from the value table(s), or if it would be better to keep things simple and store the string keys in the value table(s) and accept the duplication of strings. Old/bad: This solution makes adding additional values a pain in a fluid environment because the table needs to be modified regularly. MyTable ============================ ID Key1 Key2 Key3 int int string date ---------------------------- 1 Value1 Value2 Value3 2 Value4 Value5 Value6 Single Table Solution This solution allows simplicity via a single table. The querying code still needs to check for nulls to determine which data type the field is storing. A check constraint is probably also required to ensure only one of the value fields contains non-nulll data. DataValues ============================================================= ID RecordID Key IntValue StringValue DateValue int int string int string date ------------------------------------------------------------- 1 1 Key1 Value1 NULL NULL 2 1 Key2 NULL Value2 NULL 3 1 Key3 NULL NULL Value3 4 2 Key1 Value4 NULL NULL 5 2 Key2 NULL Value5 NULL 6 2 Key3 NULL NULL Value6 Multiple-Table Solution This solution allows for more concise purposing of each table, though the code needs to know the data type in advance as it needs to query a different table for each data type. Indexing is probably simpler and more efficient because there are less columns that need indexing. IntegerValues =============================== ID RecordID Key Value int int string int ------------------------------- 1 1 Key1 Value1 2 2 Key1 Value4 StringValues =============================== ID RecordID Key Value int int string string ------------------------------- 1 1 Key2 Value2 2 2 Key2 Value5 DateValues =============================== ID RecordID Key Value int int string date ------------------------------- 1 1 Key3 Value3 2 2 Key3 Value6 How do you approach this problem? Which solution is better? Also, should the key column be separated into a separate table and referenced via a foreign key or be should it be kept in the value table and bulk updated if for some reason the key name changes?

    Read the article

  • nonatomic property in model class when using NSOperationQueue (iPhone)?

    - by Andrew B.
    I have a custom model class with an NSMutableData ivar that will be accessed by custom NSOperation subclasses (using an NSOperationQueue). I think I can guarantee thread-safe access to the ivar from multiple NSOperations by using dependencies, and I can guarantee that I don't access the ivar from other code (say my main app thread) by waiting until the Q has finished all operations. Should I use a nonatomic property specification, or leave it atomic? Is there a significant impact on performance?

    Read the article

  • Yii file upload issue

    - by user1289853
    Couple of months ago,I developed a simple app using YII,one of the feature was to upload file. The feature was working well in my dev machine,couple of days ago client found the file upload feature is not working in his server since deployment. And after that I test my dev machine that was not working too. My controller looks: public function actionEntry() { if (!Yii::app()->user->isGuest) { $model = new TrackForm; if (isset($_POST['TrackForm'])) { $entry = new Track; try { $entry->product_image = $_POST['TrackForm']['product_image']; $entry->product_image = CUploadedFile::getInstance($model, 'product_image'); if ($entry->save()) { if ($entry->product_image) { $entry->product_image->saveAs($entry->product_image->name, '/trackshirt/uploads'); } } $this->render('success', array('model' => $model)); // redirect to success page } } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } } else { $this->render('entry', array('model' => $model)); } } } Model is like below: <?php class Track extends CActiveRecord { public static function model($className=__CLASS__) { return parent::model($className); } public function tableName() { return 'product_details'; } } My view looks: <?php $form = $this->beginWidget('CActiveForm', array( 'id' => 'hide-form', 'enableClientValidation' => true, 'clientOptions' => array( 'validateOnSubmit' => true, ), 'htmlOptions' => array('enctype' => 'multipart/form-data'), )); ?> <p class="auto-style2"><strong>Administration - Add New Product</strong></p> <table align="center" style="width: 650px"><td class="auto-style3" style="width: 250px">Product Image</td> <td> <?php echo $form->activeFileField($model, 'product_image'); ?> </td> </tr> </table> <p class="auto-style1"> <div style="margin-leftL:-100px;"> <?php echo CHtml::submitButton('Submit New Product Form'); ?> </div> <?php $this->endWidget(); ?> Any idea where is the problem?I tried to debug it but every time it returns Null. Thanks.

    Read the article

< Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >