Search Results

Search found 2536 results on 102 pages for 'initialize'.

Page 2/102 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Google Chrome: "The application failed to initialize properly"

    - by Zack Peterson
    Google Chrome stopped working for me today. When I launch Chrome, I see the following error: Windows - Application Error The application failed to initialize properly (0xc0000135). Click OK to terminate the application. It fails to load the New Tab Page. After a moment, I see the following error: Google Chrome The following page(s) have become unresponsive. You can wait for them to become responsive or kill them. My operating system is Microsoft Windows Vista. I've tried: uninstalled Chrome rebooted reinstalled Chrome rebooted That didn't fix it. What now? Any ideas?

    Read the article

  • Re-Initialize RAID-0 in software after card failure

    - by Ben
    I'm working on a Friend's WD MyBook "1TB" HDD that is not mounting. When I got in to it, I discovered that it is really 2 500GB HDD's set up as RAID-0. It appears that the drives themselves are fine, but that the logic board has failed. My questions is this: can I re-initialize the RAID-0 using software RAID so that I can recover the data to another drive? If so, how and which software RAID would be best (Preferably open source. any platform OK).

    Read the article

  • main vs initialize in Ruby

    - by Dave
    Okay, so I've looked through a couple of my ruby books and done some googling to no avail. What is the difference between main and initialize in Ruby? I've seen code that uses class Blahblah def main some logic here end #more methods... end and then calls it using Blahblah.new. Isn't new reserved only for initialize? if not, then what's the difference between the two?

    Read the article

  • Ruby proc vs lambda in initialize()

    - by Jimmy Chu
    I found out this morning that proc.new works in a class initialize method, but not lambda. Concretely, I mean: class TestClass attr_reader :proc, :lambda def initialize @proc = Proc.new {puts "Hello from Proc"} @lambda = lambda {puts "Hello from lambda"} end end c = TestClass.new c.proc.call c.lambda.call In the above case, the result will be: Hello from Proc test.rb:14:in `<main>': undefined method `call' for nil:NilClass (NoMethodError) Why is that? Thanks!

    Read the article

  • how to initialize two logical drives on a HP P400i controller without reboot

    - by John
    What I am trying to do is initialize two logical drives on a HP P400i embedded controller without a reboot of the system here my current Array config: array A (SAS, Unused Space: 0 MB) logicaldrive 1 (17.9 GB, RAID 5, OK) logicaldrive 2 (17.9 GB, RAID 5, OK) logicaldrive 3 (75.9 GB, RAID 5, OK) logicaldrive 4 (25.0 GB, RAID 5, OK) physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 72 GB, OK) physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 72 GB, OK) physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 72 GB, OK) array B (SAS, Unused Space: 0 MB) logicaldrive 5 (99 MB, RAID 0, OK) logicaldrive 6 (68.2 GB, RAID 0, OK) physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 72 GB, OK) windows 2003 machine running the HpCISs2.sys driver version 6.20.0.32 . I have the ACU and ACU CLI tools installed version 8.28.13.0, P400i firmware version 2.74 . Now what I'd like to do is removes the physical drive 1I:1:4 and delete the two logical drives in array B. then insert a new drive in to bay 4 that contains two new logical drives and have them show up in array B again. So far after I remove the drive and delete the failed logical drives, I insert the new drive and run HPacucli rescan. I get the new drive to show up as unassinged physical drive but I cant figure out now to "for lack of a better word" mount the 2 logical drives on the new unassinged disk. If I reboot the system the array controller picks up the new fourth drive and creates Array B with the drives without problem but I'd really like to not have to reboot the server. Any ideas?

    Read the article

  • Prevent Ninject from calling Initialize multiple times when binding to several interfaces

    - by Ahe
    Hi We have a concrete singleton service which implements Ninject.IInitializable and 2 interfaces. Problem is that services Initialize-methdod is called 2 times, when only one is desired. We are using .NET 3.5 and Ninject 2.0.0.0. Is there a pattern in Ninject prevent this from happening. Neither of the interfaces implement Ninject.IInitializable. the service class is: public class ConcreteService : IService1, IService2, Ninject.IInitializable { public void Initialize() { // This is called twice! } } And module looks like this: public class ServiceModule : NinjectModule { public override void Load() { this.Singleton<Iservice1, Iservice2, ConcreteService>(); } } where Singleton is an extension method defined like this: public static void Singleton<K, T>(this NinjectModule module) where T : K { module.Bind<K>().To<T>().InSingletonScope(); } public static void Singleton<K, L, T>(this NinjectModule module) where T : K, L { Singleton<K, T>(module); module.Bind<L>().ToMethod(n => n.Kernel.Get<T>()); } Of course we could add bool initialized-member to ConcreteService and initialize only when it is false, but it seems quite a bit of a hack. And it would require repeating the same logic in every service that implements two or more interfaces. Thanks for all the answers! I learned something from all of them! (I am having a hard time to decide which one mark correct). We ended up creating IActivable interface and extending ninject kernel (it also removed nicely code level dependencies to ninject, allthough attributes still remain).

    Read the article

  • How can you get NVelocity to initialize correctly?

    - by Deane
    I can't get NVelocity to initialize. I'm not trying to do anything complicated, so it's just fine if it initializes at the defaults, but it won't even do that. This: VelocityEngine velocity = new VelocityEngine(); ExtendedProperties props = new ExtendedProperties(); velocity.Init(props); Results in: "It appears that no class was specified as the ResourceManager..." So does this: VelocityEngine velocity = new VelocityEngine(); velocity.Init(); I can find precious little documentation on what the properties should be, nor how to get it to initialize with the simple defaults. Can anyone point to a resource? A lot of pages point back to this page: http://www.castleproject.org/others/nvelocity/usingit.html But this page skips over the (seemingly) most important point -- how to set the properties and what to set them to. I just want to load a simple template from a file.

    Read the article

  • wxWidgets: How to initialize wxApp without using macros and without entering the main application l

    - by m_pGladiator
    We need to write unit tests for a wxWidgets application using Google Test Framework. The problem is that wxWidgets uses the macro IMPLEMENT_APP(MyApp) to initialize and enter the application main loop. This macro creates several functions including int main(). The google test framework also uses macro definitions for each test. One of the problems is that it is not possible to call the wxWidgets macro from within the test macro, because the first one creates functions.. So, we found that we could replace the macro with the following code: wxApp* pApp = new MyApp(); wxApp::SetInstance(pApp); wxEntry(argc, argv); That's a good replacement, but wxEntry() call enters the original application loop. If we don't call wxEntry() there are still some parts of the application not initialized. The question is how to initialize everything required for a wxApp to run, without actually running it, so we are able to unit test portions of it?

    Read the article

  • Initialize content of a jQuery remote tab on initial page load

    - by Carl
    I'm using the jQuery tabs library to create a set of remote (i.e., ajax loaded) tabs. However, to avoid the initial page load being empty until the ajax request finishes, I'd like to include the content for the initial tab with the initial page download. I've got this generally working by providing a div in the initial page load that matches the title of the tab, but even though this content appears immediately, as soon as I initialize the tabs it does the ajax request IN ADDITION which is both wasteful and causes a flicker. My basic question is how can I get jQuery tabs to NOT do an ajax request for the initially selected tab, and get this content as part of the initial page load, while still loading the other tabs dynamically. The complication is that I can't hard code the ids/hrefs for which tab is the "initial" one since the initial tab will change based on available content. I'm sure there is some kind of hacky way to do this with javascript rewriting the URLs of tabs dynamically before I initialize the tabs but I'm looking for a cleaner solution. Any ideas?

    Read the article

  • how to initialize a 2d array in perl

    - by Mark
    How do I initialize a 2d array in perl? I am trying the following code: 0 use strict; 10 my @frame_events = (((1) x 10), ((1) x 10)); 20 print "$frame_events[1][1]\n"; but it gives the following error: Can't use string ("1") as an ARRAY ref while "strict refs" in use at ./dyn_pf.pl line 20. This syntax only seems to initialize a 1d array as print "$frame_events[1]\n" works. Though perl doesn't give any error during the assignment.

    Read the article

  • Backbone collection's URL depends on initialize function

    - by egidra
    I have a Backbone collection whose URL depends on the initialize function. When I create an instance of this Backbone collection, I pass in an ID to filter which instances of the model appear. Here is what the collection's code looks like: var GoalUpdateList = Backbone.Collection.extend({ // Reference the Goal Update model model: GoalUpdate, // Do HTTP requests on this endpoint url: "http://localhost:8000/api/v1/goal_update/?goal__id=" + this.goal_id + "&format=json", // Set the goal ID that the goal update list corresponds to initialize: function(goal_id) { this.goal_id = goal_id; console.log(this.goal_id); console.log(this.url); }, }); Of course, this doesn't work. this.goal_id is seen as being undefined. I guess because the URL is set before the initialization function is run.

    Read the article

  • My Delphi 7 application halts on Application.Initialize and does not return to next line

    - by m-abdi
    I have created an application on Delphi 7. my app had running fine since yesterday. I don't know what's happened yesterday which cause my application halts on Application.Initialize line in source code and does not return to next line when i trace the program. I can't run the created executable file from widows niether while the generated file does run on another machine correctly. here is the code where the compiler stops on it: program Info_Kiosk; uses SysUtils, Forms, ... (some other units) ; {$R *.res} begin Application.Initialize; Application.CreateForm(Tfrm_Main, frm_Main); any help would be appreciated

    Read the article

  • C++11 initialize array with uniform value in constexpr function

    - by marack
    I have a class template which builds a simple array based on the template parameters as one of its members. I need to be able to initialize every element in the array to a single value in one of the constructors. Unfortunately this constructor must be constexpr. The relevant part boils down to: template <typename T, size_t N> class foo { T data[N]; constexpr foo(T val) { // initialize data with N copies of val } }; Using std::fill or a loop is incompatible with the constexpr requirement. Initializing with : data{val} only sets the first element of the array and zero-initializes the remainder. How can this be achieved? I feel like there should be a solution with variadic templates and tuples etc...

    Read the article

  • Hibernate/Spring: failed to lazily initialize - no session or session was closed

    - by Niko
    I know something similar has been asked already, but unfortunately I wasn't able to find a reliable answer - even with searching for over 2 days. The basic problem is the same as asked multiple time. I have a simple program with two POJOs Event and User - where a user can have multiple events. @Entity @Table public class Event { private Long id; private String name; private User user; @Column @Id @GeneratedValue public Long getId() {return id;} public void setId(Long id) { this.id = id; } @Column public String getName() {return name;} public void setName(String name) {this.name = name;} @ManyToOne @JoinColumn(name="user_id") public User getUser() {return user;} public void setUser(User user) {this.user = user;} } @Entity @Table public class User { private Long id; private String name; private List events; @Column @Id @GeneratedValue public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Column public String getName() { return name; } public void setName(String name) { this.name = name; } @OneToMany(mappedBy="user", fetch=FetchType.LAZY) public List getEvents() { return events; } public void setEvents(List events) { this.events = events; } } Note: This is a sample project. I really want to use Lazy fetching here. I use spring and hibernate and have a simple basic-db.xml for loading: <?xml version="1.0" encoding="UTF-8"? <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd" <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" scope="thread" <property name="driverClassName" value="com.mysql.jdbc.Driver" / <property name="url" value="jdbc:mysql://192.168.1.34:3306/hibernateTest" / <property name="username" value="root" / <property name="password" value="" / <aop:scoped-proxy/ </bean <bean class="org.springframework.beans.factory.config.CustomScopeConfigurer" <property name="scopes" <map <entry key="thread" <bean class="org.springframework.context.support.SimpleThreadScope" / </entry </map </property </bean <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" scope="thread" <property name="dataSource" ref="myDataSource" / <property name="annotatedClasses" <list <valuedata.model.User</value <valuedata.model.Event</value </list </property <property name="hibernateProperties" <props <prop key="hibernate.dialect"org.hibernate.dialect.MySQLDialect</prop <prop key="hibernate.show_sql"true</prop <prop key="hibernate.hbm2ddl.auto"create</prop </props </property <aop:scoped-proxy/ </bean <bean id="myUserDAO" class="data.dao.impl.UserDaoImpl" <property name="sessionFactory" ref="mySessionFactory" / </bean <bean id="myEventDAO" class="data.dao.impl.EventDaoImpl" <property name="sessionFactory" ref="mySessionFactory" / </bean </beans Note: I played around with the CustomScopeConfigurer and SimpleThreadScope, but that didnt change anything. I have a simple dao-impl (only pasting the userDao - the EventDao is pretty much the same - except with out the "listWith" function: public class UserDaoImpl implements UserDao{ private HibernateTemplate hibernateTemplate; public void setSessionFactory(SessionFactory sessionFactory) { this.hibernateTemplate = new HibernateTemplate(sessionFactory); } @SuppressWarnings("unchecked") @Override public List listUser() { return hibernateTemplate.find("from User"); } @Override public void saveUser(User user) { hibernateTemplate.saveOrUpdate(user); } @Override public List listUserWithEvent() { List users = hibernateTemplate.find("from User"); for (User user : users) { System.out.println("LIST : " + user.getName() + ":"); user.getEvents().size(); } return users; } } I am getting the org.hibernate.LazyInitializationException - failed to lazily initialize a collection of role: data.model.User.events, no session or session was closed at the line with user.getEvents().size(); And last but not least here is the Test class I use: public class HibernateTest { public static void main(String[] args) { ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("basic-db.xml"); UserDao udao = (UserDao) ac.getBean("myUserDAO"); EventDao edao = (EventDao) ac.getBean("myEventDAO"); System.out.println("New user..."); User user = new User(); user.setName("test"); Event event1 = new Event(); event1.setName("Birthday1"); event1.setUser(user); Event event2 = new Event(); event2.setName("Birthday2"); event2.setUser(user); udao.saveUser(user); edao.saveEvent(event1); edao.saveEvent(event2); List users = udao.listUserWithEvent(); System.out.println("Events for users"); for (User u : users) { System.out.println(u.getId() + ":" + u.getName() + " --"); for (Event e : u.getEvents()) { System.out.println("\t" + e.getId() + ":" + e.getName()); } } ((ConfigurableApplicationContext)ac).close(); } } and here is the Exception I get: 1621 [main] ERROR org.hibernate.LazyInitializationException - failed to lazily initialize a collection of role: data.model.User.events, no session or session was closed org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: data.model.User.events, no session or session was closed at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380) at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372) at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:119) at org.hibernate.collection.PersistentBag.size(PersistentBag.java:248) at data.dao.impl.UserDaoImpl.listUserWithEvent(UserDaoImpl.java:38) at HibernateTest.main(HibernateTest.java:44) Exception in thread "main" org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: data.model.User.events, no session or session was closed at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380) at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372) at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:119) at org.hibernate.collection.PersistentBag.size(PersistentBag.java:248) at data.dao.impl.UserDaoImpl.listUserWithEvent(UserDaoImpl.java:38) at HibernateTest.main(HibernateTest.java:44) Things I tried but did not work: assign a threadScope and using beanfactory (I used "request" or "thread" - no difference noticed): // scope stuff Scope threadScope = new SimpleThreadScope(); ConfigurableListableBeanFactory beanFactory = ac.getBeanFactory(); beanFactory.registerScope("request", threadScope); ac.refresh(); ... Setting up a transaction by getting the session object from the deo: ... Transaction tx = ((UserDaoImpl)udao).getSession().beginTransaction(); tx.begin(); users = udao.listUserWithEvent(); ... getting a transaction within the listUserWithEvent() public List listUserWithEvent() { SessionFactory sf = hibernateTemplate.getSessionFactory(); Session s = sf.openSession(); Transaction tx = s.beginTransaction(); tx.begin(); List users = hibernateTemplate.find("from User"); for (User user : users) { System.out.println("LIST : " + user.getName() + ":"); user.getEvents().size(); } tx.commit(); return users; } I am really out of ideas by now. Also, using the listUser or listEvent just work fine.

    Read the article

  • Unable to initialize gitosis-init

    - by aunghn
    I was tried to setup git and gitosis for our projects. For the gitosis setup, I'm following this article http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way as this is first time using git. I got an issue when I run the gitosis-init. I don't know what happen or how to check. Please help me on what I need to check or do. In fact, I don't even know whether this is a problem as I just started using Linux, git and etc. Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/ Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/ Traceback (most recent call last): File "/usr/bin/gitosis-init", line 8, in <module> load_entry_point('gitosis==0.2', 'console_scripts', 'gitosis-init')() File "/usr/lib/python2.5/site-packages/gitosis-0.2-py2.5.egg/gitosis/app.py", line 24, in run return app.main() File "/usr/lib/python2.5/site-packages/gitosis-0.2-py2.5.egg/gitosis/app.py", line 38, in main self.handle_args(parser, cfg, options, args) File "/usr/lib/python2.5/site-packages/gitosis-0.2-py2.5.egg/gitosis/init.py", line 140, in handle_args run_hook.post_update(cfg=cfg, git_dir=admin_repository) File "/usr/lib/python2.5/site-packages/gitosis-0.2-py2.5.egg/gitosis/run_hook.py", line 40, in post_update path=os.path.join(generated, 'projects.list'), File "/usr/lib/python2.5/site-packages/gitosis-0.2-py2.5.egg/gitosis/gitweb.py", line 109, in generate_project_list f = file(tmp, 'w') IOError: [Errno 13] Permission denied: '/home/git/gitosis/projects.list.30470.tmp' Thanks in advance.

    Read the article

  • 2008 SR2 Server Starts Then Fails to Initialize DNS

    - by ThaKidd
    Got a weird situation going on. Background: Just transferred Active Directory from a 2003 Server to 2008 SR2. Removed the 2003 server from AD but I have not upgraded Active Directory to 08 only yet. After the transition a problem started. Whenever I reboot the server and I log in, the DNS server is "stopping". After a few minutes it finishes and I can restart start it at that point. Once it is restarted, all services come up. Now I did try to install HyperV (this is a dev server btw). Once the reboot for HyperV, everything was screwed as in I could not ping anything. Uninstalled and had the DNS server issue. Screwed with IPv6 settings (which I am not using) and problem was resolved for a bit. Also installed an Intel Pro1000 card and had a bit of success with DNS; then it failed. Weird thing is, outside of an error in syslog stating that the DNS server failed to start, there is no specific error that is generated in either System or DNS Server logs. Ideas are much appreciated! Thanks in advance.

    Read the article

  • Initialize webservice WSDL at runtime using Flex and Mate framework

    - by GroovyB
    I am developing a Flex application on top of Mate framework. In this application, I am using a webservice to retrieve data. As this webservice as not a fix location URL (depending on where customers installed it), I define this URL in a config file. When the Flex application starts, it first reads this config file, then I would like to use the value I found to initialize the webservice. But currently, I have no idea how to this. Here is my EventMap.mxml <EventMap> <services:Services id="services" /> <EventHandlers type="{FlexEvent.PREINITIALIZE}"> <HTTPServiceInvoker instance="{services.configService}"> <resultHandlers> <MethodInvoker generator="{ConfigManager}" method="loadFromXml" arguments="{resultObject}" /> </resultHandlers> <faultHandlers> <InlineInvoker method="Alert.show" arguments="ERROR: Unable to load config.xml !" /> </faultHandlers> </HTTPServiceInvoker> In this part, the ConfigManager parse the config file and intitialize a bindable property called webServiceWsdl Here is my Services.mxml <mx:Object> <mx:Script> <![CDATA[ [Bindable] public var webservice:String; ]]> </mx:Script> <mx:HTTPService id="configService" url="config.xml" useProxy="false" /> <mx:WebService id="dataService" wsdl="{webservice}" useProxy="false"/> </mx:Object> How can I initialize this webservice property ?

    Read the article

  • BPEL, initialize variable and repeating onAlarm eventHandler

    - by Michael
    I have a little problem I can't solve so far. In BPEL I want to create an onAlarm eventHandler which fires immediatly (i.e. the "for" element is set to 'PT0S') and repeats every 2 seconds. This eventHandler shall contain a counter which increments every time the alarm fires. The question is: How to initialize the counter? If the variable will be initialized within the onAlarm scope the value would not increment anymore. In the "normal" control flow the value also cannot be initialized, because it is not defined if the process or the onAlarm scope runs first. So I would get every now and then an uninitializedVariable exception. My solution would be to not initialize the variable neither in the process scope nor in the onAlarm scope, but create a faultHandler wherein the variable will be initialized and afterwards the onAlarm flow will be executed. Problem is every uninitializedVariable execution will be caught now by this faultHandler and there may be another too. So is there another possibility to deal with this problem or can I somehow find out which variable wasn't initialized properly so the faultHandler can get two control flows? The solution should work on every BPEL engine. Thanks, Michael

    Read the article

  • Initialize listitem with blanks?

    - by VBartilucci
    Say I have a list made up of a listitem which contains three strings. I add a new listitem, and try to assign the values of said strings from an outside source. If one of those items is unassigned, the value in the listitem remains as null (unassigned). As a result I get an error if I try to assign that value to a field on my page. I can do a check on isNullOrEmpty for each field on the page, but that seems inefficient. I'd rather initialize the values to "" (Empty string) in the codebehind and send valid data. I can do it manually: ClaimPwk emptyNode = new ClaimPwk(); emptyNode.cdeAttachmentControl = ""; emptyNode.cdeRptTransmission = ""; emptyNode.cdeRptType = ""; headerKeys.Add(emptyNode); But I have some BIG list items, and writing that for those will get tedious. So is there a command, or just plain an easier way to initialize a listitem to empty string as opposed to null? Or has anyone got a better idea?

    Read the article

  • Rails: RESTful Find, Initialize, or Create

    - by Andrew
    I have an app that has Cities in it. I'm looking for some suggestions on how to RESTfully structure a controller so that I can lookup, initialize, and create city records via AJAX requests. For instance: Given a text field city_name A user enters the name of a City, like "Paris, France" The app checks this location to see if there is such a city in the database already If there is, it returns the city object If there is not, it returns a new record initialized with the name "Paris" and the country "France", and prompts the user to confirm they want to add this city to the database If the user says "Yes" the record is saved. If not the record is discarded and the form is cleared. Now, my first approach was to change the Create action to use find_or_create, so that an AJAX post to cities_path would result in either returning the existing city or creating it and returning it. That works ok... However, it would be better to setup controller actions that would take a string input, find , or else initialize and return, then only create if the user confirms the generated record is correct. The ideal scenario would put this all in one action so AJAX request can go to that url, the server responds with JSON objects, and javascript can handle things from there. I'd like to keep all the user-interaction logic client side, and also minimize the number of requests it takes to achieve this. Any suggestions on the cleanest, most RESTful way to accomplish this?

    Read the article

  • Error "initializer element is not constant" when trying to initialize variable with const

    - by tomlogic
    I get an error on line 6 (initialize my_foo to foo_init) of the following program and I'm not sure I understand why. typedef struct foo_t { int a, b, c; } foo_t; const foo_t foo_init = { 1, 2, 3 }; foo_t my_foo = foo_init; int main() { return 0; } Keep in mind this is a simplified version of a larger, multi-file project I'm working on. The goal was to have a single constant in the object file, that multiple files could use to initialize a state structure. Since it's an embedded target with limited resources and the struct isn't that small, I don't want multiple copies of the source. I'd prefer not to use: #define foo_init { 1, 2, 3 } I'm also trying to write portable code, so I need a solution that's valid C89 or C99. Does this have to do with the ORGs in an object file? That initialized variables go into one ORG and are initialized by copying the contents of a second ORG? Maybe I'll just need to change my tactic, and have an initializing function do all of the copies at startup. Unless there are other ideas out there?

    Read the article

  • Initialize void pointer to point to an array

    - by idealistikz
    Suppose I have the following: typedef struct { int itemSize; int count; void *list; } Mystruct; Mystruct *InitStruct(int itemSize, int count) { Mystruct *my = malloc(sizeof(Mystruct)); my->itemSize = itemSize; my->count = count; //What is the best way to initialize list? For example: //my->list = malloc(count * sizeof(void *)); OR //my->list = malloc(count * sizeof(itemSize)); } //The following should return a pointer to the element stored at a given index void *Retrieve(const MyStruct *my, int index) { void *item; //What is the best way to return a pointer to the item at the given index from //my->list? } Mystruct is similar to an array and void *list is supposed to store the elements or pointers to the elements. Mystruct *InitStruct is a function that initializes a Mystruct pointer and void *Retrieve is a function that returns a pointer to the element stored at a given index. First, how should I initialize void* list? Should it hold the actual elements or be an array of pointers pointing to the elements? Second, using the void *Retrieve function, how do I return a pointer to the element stored at a given index in my-list?

    Read the article

  • Inheritance - Could not initialize proxy - no Session.

    - by Ninu
    hello....i'm newbie developer.... i really need help at now... i just get started with Nhibernate thing at .Net... when i learn Inheritance and try it...it makes me confusing...why i get error like this : Initializing[AP.Core.Domain.AccountPayable.APInvoice#API03/04/2010/001]-Could not initialize proxy - no Session. this is my xml : <class xmlns="urn:nhibernate-mapping-2.2" mutable="true" name="AP.Core.Domain.AccountPayable.APAdjustment, AP.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" table="APAdjustment"> <id name="AdjustmentNumber" type="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <column name="AdjustmentNumber" length="17" /> <generator class="assigned" /> </id> <property name="Amount" type="System.Decimal, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <column name="Amount" /> </property> <property name="TransactionDate" type="System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <column name="TransactionDate" /> </property> <many-to-one class="AP.Core.Domain.AccountPayable.APInvoice, AP.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" lazy="proxy" name="PurchaseInvoice"> <column name="PurchaseInvoice_id" not-null="true" /> </many-to-one> <joined-subclass name="AP.Core.Domain.AccountPayable.APCreditAdjustment, AP.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" lazy="true" table="APCreditAdjustment"> <key> <column name="APAdjustment_id" /> </key> </joined-subclass> </class> </hibernate-mapping> and this is inheritance Class : Parent Class -- public class APAdjustment { #region :FIELD private string adjustmentNumber; private decimal amount; private DateTime transactionDate; private APInvoice purchaseInvoice; Child Class -- public class APCreditAdjustment : APAdjustment { public APCreditAdjustment(){ and this my Data access : public IList<APAdjustment> GetByNameAll() { ICriteria criteria = Nhibernatesession.CreateCriteria(typeof(APAdjustment)); return criteria.List<APAdjustment>() ; } My Problem is : when i load data with gridview ...it works...but i change the property to autogenerate="true" ...i missing "PurchaseInvoice" field...and i change to bind manually,and it works..when i edit that gridview ...i get this error... Initializing[AP.Core.Domain.AccountPayable.APInvoice#API03/04/2010/001]-Could not initialize proxy - no Session so then i change my xml ...lazy="no-proxy" ...it still work...but when edit again ...i get error again ..and i do "Comment out the selected lines" to my association "Many-to-one"...i really works it..but that's not i want... CAN ANYBODY HELP ME...??Plizz...:( Note : I almost forget it ,i use fluent hibernate to generate to database.From fluent Hibernate ..i put *.xml file ...so i'm work to xml NHibernate...not fluent hibernate thing...:)

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >