Search Results

Search found 1594 results on 64 pages for 'initialization'.

Page 8/64 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • How to control the order of module initialization in Prism

    - by Robert Taylor
    I'm using Prism V2 with a DirectoryModuleCatalog and I need the modules to be initialized in a certain order. The desired order is specified with an attribute on each IModule implementation. This is so that as each module is initialized, they add their View into a TabControl region and the order of the tabs needs to be deterministic and controlled by the module author. The order does not imply a dependency, but rather just an order that they should be initialized in. In other words: modules A, B, and C may have priorities of 1, 2, and 3 respectively. B does not have a dependency on A - it just needs to get loaded into the TabControl region after A. So that we have a deterministic and controllable order of the tabs. Also, B might not exist at runtime; so they would load as A, C because the priority should determine the order (1, 3). If i used the ModuleDependency, then module "C" will not be able to load w/o all of it's dependencies. I can manage the logic of how to sort the modules, but i can't figure out where to put said logic.

    Read the article

  • jQuery Mobile ScrollView "initialization"

    - by Fabio B.
    I'm using the scrollview experimental feature of jQuery Mobile: <div class="carousel" data-scroll="xp"> ... my position:absolute very large div ... </div> as described here: http://jquerymobile.com/test/experiments/scrollview/ Now I need to change the ".carousel" content dynamically: I make an ajax call in order to retrieve my new scrollview content. The content loads and shows in my div correctly, but it's not scrollable anymore! How can I rebind my "carousel" to its scrolling original behavior? Does a ".scrollview()" function actually exist? Thank you

    Read the article

  • MXML composite container initialization error

    - by mkorpela
    I'm getting an odd error from my composite canvas component: An ActionScript error has occurred: Error: null at mx.core::Container/initialize()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:2560] at -REMOVED THIS FOR STACK OVERFLOW-.view::EditableCanvas/initialize()[.../view/EditableCanvas .... It seems to be related to the fact that my composite component has a child and I'm trying to add one in the place I'm using the component. So how can I do this correctly? Component code looks like this (EditableCanvas.mxml): <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <mx:Image id="editTextImage" source="@Embed('/../assets/icons/small/edit.png')"/> </mx:Canvas> The code that is using the code looks like this: <view:EditableCanvas width="290" height="120" backgroundColor="#FFFFFF" horizontalScrollPolicy="off" borderStyle="solid" cornerRadius="3"> <mx:Text id="textContentBox" width="270" fontFamily="nautics" fontSize="12" text="{_text}"/> </view:EditableCanvas>

    Read the article

  • get static initialization block to run in a java without loading the class

    - by TP
    I have a few classes as shown here public class TrueFalseQuestion implements Question{ static{ QuestionFactory.registerType("TrueFalse", "Question"); } public TrueFalseQuestion(){} } ... public class QuestionFactory { static final HashMap<String, String > map = new HashMap<String,String>(); public static void registerType(String questionName, String ques ) { map.put(questionName, ques); } } public class FactoryTester { public static void main(String[] args) { System.out.println(QuestionFactory.map.size()); // This prints 0. I want it to print 1 } } How can I change TrueFalseQuestion Type so that the static method is always run so that I get 1 instead of 0 when I run my main method? I do not want any change in the main method. I am actually trying to implement the factory patterns where the subclasses register with the factory but i have simplified the code for this question.

    Read the article

  • Initialization of components with interdependencies - possible antipattern?

    - by Rosarch
    I'm writing a game that has many components. Many of these are dependent upon one another. When creating them, I often get into catch-22 situations like "WorldState's constructor requires a PathPlanner, but PathPlanner's constructor requires WorldState." Originally, this was less of a problem, because references to everything needed were kept around in GameEngine, and GameEngine was passed around to everything. But I didn't like the feel of that, because it felt like we were giving too much access to different components, making it harder to enforce boundaries. Here is the problematic code: /// <summary> /// Constructor to create a new instance of our game. /// </summary> public GameEngine() { graphics = new GraphicsDeviceManager(this); Components.Add(new GamerServicesComponent(this)); //Sets dimensions of the game window graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 600; graphics.ApplyChanges(); IsMouseVisible = true; screenManager = new ScreenManager(this); //Adds ScreenManager as a component, making all of its calls done automatically Components.Add(screenManager); // Tell the program to load all files relative to the "Content" directory. Assets = new CachedContentLoader(this, "Content"); inputReader = new UserInputReader(Constants.DEFAULT_KEY_MAPPING); collisionRecorder = new CollisionRecorder(); WorldState = new WorldState(new ReadWriteXML(), Constants.CONFIG_URI, this, contactReporter); worldQueryUtils = new WorldQueryUtils(worldQuery, WorldState.PhysicsWorld); ContactReporter contactReporter = new ContactReporter(collisionRecorder, worldQuery, worldQueryUtils); gameObjectManager = new GameObjectManager(WorldState, assets, inputReader, pathPlanner); worldQuery = new DefaultWorldQueryEngine(collisionRecorder, gameObjectManager.Controllers); gameObjectManager.WorldQueryEngine = worldQuery; pathPlanner = new PathPlanner(this, worldQueryUtils, WorldQuery); gameObjectManager.PathPlanner = pathPlanner; combatEngine = new CombatEngine(worldQuery, new Random()); } Here is an excerpt of the above that's problematic: gameObjectManager = new GameObjectManager(WorldState, assets, inputReader, pathPlanner); worldQuery = new DefaultWorldQueryEngine(collisionRecorder, gameObjectManager.Controllers); gameObjectManager.WorldQueryEngine = worldQuery; I hope that no one ever forgets that setting of gameObjectManager.WorldQueryEngine, or else it will fail. Here is the problem: gameObjectManager needs a WorldQuery, and WorldQuery needs a property of gameObjectManager. What can I do about this? Have I found an anti-pattern?

    Read the article

  • Grails domain class initialization

    - by Don
    Hi, My Grails app has the following Spring bean defined in spring/resources.groovy calendarService(CalendarService) { bean -> bean.initMethod = "init" } This method looks something like: class CalendarService { void init() { User.findByEmail("[email protected]") } } When I call the dynamic finder findByEmail I get a MissingMethodException. My guess is that I'm trying to call this method too early, i.e. before the domain classes have had the dynamic finders added to their metaclass. One solution would be to call CalendarService.init() myself from Bootstrap.init, rather than instructing Spring to call it, but is there a better solution? Thanks, Don

    Read the article

  • Initialization problem

    - by zp26
    I have a problem. This is my code. When i try to use the IBAction SavePosition the "arrayPosition" isn't update. Else if i initialize the "arrayPosition" in "SavePosition" the value is stored in the array. Why this anomaly? #import <UIKit/UIKit.h> @interface AccelerometroViewController : UIViewController <UIAccelerometerDelegate, UITextFieldDelegate, UIAlertViewDelegate>{ //..... NSMutableArray *arrayPosizioni; NSMutableArray *arrayPosizioniCorrenti; NSString *nomePosizioneCorrente; } -(IBAction)salvaPosizione; //... @property (nonatomic, assign) NSMutableArray *arrayPosizioni; @property (nonatomic, assign) NSMutableArray *arrayPosizioniCorrenti; @property (nonatomic, assign) NSString *nomePosizioneCorrente; @end #import "AccelerometroViewController.h" #import "Position.h" @implementation AccelerometroViewController float actualX; float actualY; float actualZ; @synthesize arrayPosition; @synthesize arrayCurrentPosition; @synthesize nameCurrentPosition; -(id)init { self = [super init]; if (self != nil) { arrayPosition = [[NSMutableArray alloc]init]; arrayCurrentPosition = [[NSMutableArray alloc]init]; nameCurrentPosition = [NSString stringWithFormat:@"noPosition"]; actualX = 0; actualY = 0; actualZ = 0; } return self; } -(void)updateTextView:(NSString*)nomePosizione { NSString *string = [NSString stringWithFormat:@"%@", nameCurrentPosition]; textEvent.text = [textEvent.text stringByAppendingString:@"\n"]; textEvent.text = [textEvent.text stringByAppendingString:string]; } -(IBAction)savePosition{ Posizione *newPosition; newPosition = [[Position alloc]init]; if([newPosition setValue:(NSString*)fieldNomePosizione.text:(float)actualX:(float)actualY:(float)actualZ]){ //setValue is a method of Position. I'm sure that this method is correct UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Salvataggio Posizione" message:@"Posizione salvata con successo" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; [arrayPosition addObject:newPosition]; } else{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Salvataggio osizione" message:@"Errore nel salvataggio" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; } }

    Read the article

  • python / sets / dictionary / initialization

    - by Mario D
    Can someone explain help me understand how the this bit of code works? Particularly how the myHeap assignment works. I know the freq variable is assigned as a dictionary. But what about my myHeap? is it a Set? exe_Data = { 'e' : 0.124167, 't' : 0.0969225, 'a' : 0.0820011, 'i' : 0.0768052, } freq = exe_Data) myHeap = [[pct, [symbol, ""]] for symbol, pct in freq.items()]

    Read the article

  • Makefile variable initialization and export

    - by Michael
    somevar := apple export somevar update := $(shell echo "v=$$somevar") all: @echo $(update) I was hoping to apple as output of command, however it's empty, which makes me think export and := variable expansion taking place on different phases. how to overcome this?

    Read the article

  • Template Parameter Initialization

    - by isurulucky
    Hi, I wrote some C++ code in which I used Templates. Since I used templates, I could not initialize a couple of template class variables. I got an warning message from valgrind saying Conditional jump or move depends on uninitialized value(s). So is there a way to get around this and/or initialize template variables?? I couldn't think of a way to do it because even if I initailize them as NULL, when I use string data type a run time failure occurres. Thank You!

    Read the article

  • order of initialization in Java

    - by M.H
    Hi, I want to ask why java initializes the static objects before the non-static objects ? in this example b3 will be initialized after b4 and b5 : class Cupboard { Bowl b3 = new Bowl(3); static Bowl b4 = new Bowl(4); Cupboard() {} static Bowl b5 = new Bowl(5); }

    Read the article

  • 3D array initialization

    - by xdevel2000
    I need to represent some spatial points: x,y,z when I try to initialize the array like this: int[][][] points { { {100, 120, 10}, {100, 120, 18}, ... } } I got an error: Uncompilable source code - not a statement where is the error?

    Read the article

  • MVC3 View For Loop values initialization

    - by Ryan
    So I have a for loop in my View that is supposed to render out the input boxes. Now inside these input boxes I want to put lables that disappear when you click on them. This is all simple. Now it's probably because my brain was wired for php first, and it has been difficult to get it to think in lambdas and object orientation, but I can't figure out how to do this: @{ for (int i = 0; i < 3; i++) { <div class="editor-label grid_2">User</div> Model.Users[i].UserFirstName = "First Name"; Model.Users[i].UserLastName = "Last Name"; Model.Users[i].UserEmailAddress = "Email Address"; <div class="grid_10"> @Html.TextBoxFor(m => Model.Users[i].UserFirstName, new { @class = "user-input" }) @Html.TextBoxFor(m => Model.Users[i].UserLastName, new { @class = "user-input" }) @Html.TextBoxFor(m => Model.Users[i].UserEmailAddress, new { @class = "user-input-long" }) @Html.CheckBoxFor(m => Model.Users[i].IsUserAdmin) <span>&nbsp;admin?</span> </div> <div class="clear"> </div> } } And initialize the values for the users. And you're probably thinking "Of course that won't work. You're going to get a Null Reference Exception", and you would be correct. I might need to initialize them somewhere else and I don't realize it but I'm just not sure. I've tried the [DefaultValue("First Name")] route and that doesn't work. I'm probably thinking about this wrong, but my brain is already shot from trying to figure out how to wire up these events to the controller, so any help would be appreciated!

    Read the article

  • Is this 2D array initialization a bad idea?

    - by Brendan Long
    I have something I need a 2D array for, but for better cache performance, I'd rather have it actually be a normal array. Here's the idea I had but I don't know if it's a terrible idea: const int XWIDTH = 10, YWIDTH = 10; int main(){ int * tempInts = new int[XWIDTH * YWIDTH]; int ** ints = new int*[XWIDTH]; for(int i=0; i<XWIDTH; i++){ ints[i] = &tempInts[i*YWIDTH]; } // do things with ints delete[] ints[0]; delete[] ints; return 0; } So the idea is that instead of newing a bunch of arrays (and having them placed in different places in memory), I just point to an array I made all at once. The reason for the delete[] (int*) ints; is because I'm actually doing this in a class and it would save [trivial amounts of] memory to not save the original pointer. Just wondering if there's any reasons this is a horrible idea. Or if there's an easier/better way. The goal is to be able to access the array as ints[x][y] rather than ints[x*YWIDTH+y].

    Read the article

  • constructorless initialization and Dictionaries

    - by Stacey
    Using C# 3.0, we can initialize objects without their constructors for syntactical reasons. Such as .. ClassName c = new ClassName = { Property1 = "Value" } I was wondering how this works with Dictionaries and adding the items to them. Any ideas? class Foo { public Dictionary DictionaryObject { get; set; } } Foo f = new Foo = { // ??? } Thank you for your time!!

    Read the article

  • Trouble Copying custom class initialization

    - by Parad0x13
    I have a custom class of type NSObject that contains a single NSMutableArray. This class is called Mutable2DArray and is designed to emulate a 2 dimensional array of type NSMutableArray. There is a custom init method - (id)initWithX:(int)x Y:(int)y that asks for the dimensions for the array and allocates the required arrays within the only array the class owns. My issue is when I try to copy an instance of Mutable2DArray I get an error saying the copyWithZone is an unrecognized selector. I thought copy was a base method of NSObject so I'm confused why I cant create a copy of the instance like this: Mutable2DArray *Array1 = [[Mutable2DArray alloc] initWithX:10 Y:10]; Mutable2DArray *Array2 = [Array1 copy]; Am I missing something so obvious here?

    Read the article

  • memset for initialization in C++

    - by skydoor
    memset is sometimes used to initialize data in a constructor like the example below. Does it work in general ? Is it a good idea in general? class A { public: A(); private: int a; float f; char str[35]; long *lp; }; A::A() { memset(this, 0, sizeof(*this)); }

    Read the article

  • Grails design for domain class initialization from static data

    - by Allison Eer
    I have some data, stateNames, to instantiate an instance of the object Country. Right now, I will only have one Country but stateNames for each country should be different. What is the best way to instantiate the instance of Country with my data? I am new to grails and would appreciate any "best practices" or common designs. One solution I can think of is to use BootStrap to save the unitedStates instance of Country to the database. What are the cons of this approach? Another solution would be to save the data in a file (in xml?) under web-app folder. If I did this approach, should the unitedStates instance of Country be instantiated by a controller?

    Read the article

  • Ext.app.application object is erased after initialization

    - by Queequeg
    I am trying to organize an existing extjs code in a more standard order (extjs wise). extjs version: extjs-4.0.2a. I've worked through the Extjs tutorial example and every thing went well. When I started working on the company's code I've notice there is no use of the application object there for I've added the Ext.application({...}); call. Ext.application({ name: 'FOO', appFolder: 'appFolderName', launch: function() { console.log('application was created'); } }); Upon loading the page I see the console.log output that is included in the "launch" function property - meaning the application object is created but when I look for it ("FOO" object) under the "window" object it is not there. Compering to the tutorial code the application object exist as a property of window. I encounter a few loading problems but I'm guessing the source of it all is this issue. What am I doing wrong? thanks.

    Read the article

  • Inheritance - initialization problem

    - by dumbquestion
    I have a c++ class derived from a base class in a framework. The derived class doesn't have any data members because I need it to be freely convertible into a base class and back - the framework is responsible for loading and saving the objects and I can't change it. My derived class just has functions for accessing the data. But there are a couple of places where I need to store some temporary local variables to speed up access to data in the base class. mydata* MyClass::getData() { if ( !m_mydata ) { // set to NULL in the constructor m_mydata = some_long_and complex_operation_to_get_the_data_in_the_base() } return m_mydata; } The problem is if I just access the object by casting the base class pointer returned from the framework to MyClass* the ctor for MyClass is never called and m_mydata is junk. Is there a way of only initializing the m_mydata pointer once?

    Read the article

  • Singleton with eager initialization

    - by jesper
    I have class X that takes much time to initialize itself. I want to make that class singleton and force its creation when rails application starts. I've made the singleton: class X @@instance = nil def self.instance if @@instance.nil? @@instance = X.new puts 'CREATING' end return @@instance end private_class_method :new end The problem is that every time I use this class I see 'CREATING' in logs. I've tried to put creation of class in initializers directory but it doesn't work either.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >