Search Results

Search found 130 results on 6 pages for 'initialisation'.

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

  • Ninject/DI: How to correctly pass initialisation data to injected type at runtime

    - by MrLane
    I have the following two classes: public class StoreService : IStoreService { private IEmailService _emailService; public StoreService(IEmailService emailService) { _emailService = emailService; } } public class EmailService : IEmailService { } Using Ninject I can set up bindings no problem to get it to inject a concrete implementation of IEmailService into the StoreService constructor. StoreService is actually injected into the code behind of an ASP.NET WebForm as so: [Ninject.Inject] public IStoreService StoreService { get; set; } But now I need to change EmailService to accept an object that contains SMTP related settings (that are pulled from the ApplicationSettings of the Web.config). So I changed EmailService to now look like this: public class EmailService : IEmailService { private SMTPSettings _smtpSettings; public void SetSMTPSettings(SMTPSettings smtpSettings) { _smtpSettings = smtpSettings; } } Setting SMTPSettings in this way also requires it to be passed into StoreService (via another public method). This has to be done in the Page_Load method in the WebForms code behind (I only have access to the Settings class in the UI layer). With manual/poor mans DI I could pass SMTPSettings directly into the constructor of EmailService and then inject EmailService into the StoreService constructor. With Ninject I don't have access to the instances of injected types outside of the objects they are injected to, so I have to set their data AFTER Ninject has already injected them via a separate public setter method. This to me seems wrong. How should I really be solving this scenario?

    Read the article

  • Graphics card initialisation problems when booting - requires a "double" boot

    - by DMA57361
    Problem Outline When booting from cold (and my machine is disconnected from main power when off, but leaving it connected doesn't help) the graphics card (single PCI-e card GeForce 460) will not initialise on the first boot, leaving me with the motherboards on-board graphics (which kick in automatically if no PCI-e card is found). However, if I restart the computer - normally I do this by powering it off just after the numlock lights up on the keyboard (ie, just after POST/BIOS and before Windows takes over), wait for the system to whirr down, and power up again - the graphics card will work correctly. Once double-booted in this matter the system seems to work correctly - with no noticeable problems. This is reproducible every time I try to boot - it has been working like this for about a month now. Background Information Sept 2010 - I suffered a hardware malfunction (crashes in Windows and graphics corruption on BIOS screens). By way of spare hardware I determined that replacing the PSU removed the issue, so I replaced the PSU with a brand new one of slightly higher power (460W replaced with 500W). Oct 2010 - The problem resurfaced. I purchased a new graphics card (GeForce 460), which removed the problem. The new graphics card immediately started having the boot initialisation problems mentioned. I presumed there was a motherboard fault all along, but because the system worked once booted, and I was temporarily out of spare money, I left the system alone and continued to use it. Early/Mid Dec 2010 - In the space of 5 days I recieved 3 instances of hard drive corruption (seemlingly fixed by chkdsk and sfc in each case...). Since I was already under the impression the motherboard was faulty, I purchased a new one ASAP, this also required new RAM (as I dropped from 4 slots to 2 and didn't want to drop mem quantity). Past 3-4 weeks - With a brand new PSU, Graphics Card, Motherboard and RAM I'm suffering the problem outlined above. So, what could be causing this and how do I can resolve it? Additional Notes Once double-booted the system seems to work entirely correctly. The graphics card problem has occured on two entirely different motherboards. I do not have the opportunity to test the graphics card in a different computer (I've only the old motherboard, which is dubious, or a really old desktop that still has an AGP port). Under load (ie, modern games for long enough for temperatures to plateau) the system remains stable and performs as expected. The software that came with the new motherboard and SpeenFan both report all voltages and temperatures are within nominal bounds, when idle and when under load. I've looking over the BIOS settings for my motherboard multiple times and can find nothing that helps. This system is configured to run with everything at standard levels - no overclocking. I've tried booting the system with only the mobo and graphics card connected (thinking maybe my new PSU was too weak for the new gfx card, even though it meets the quoted PSU requirements for the card) but the same problem persists (and really if the PSU was weak I'd have problems with the system under load). When the gfx card does not initialise the fan on its cooling unit is running, possibly slower than otherwise - but this measurement is by eye and so unreliable.

    Read the article

  • Delay NTP Initialisation, Cisco 877W, IOS 12.4(24)T1

    - by Mike Insch
    I have a Cisco 877W which I'm using for my home ADSL connection (and as a refresher in Cisco IOS). I've got a working config in-place with my PPPoA connection coming online correctly, and VLANs and other settings configured as I want them, but I can't crack the NTP configuration. For NTP, I have the following defined ntp server 0.uk.pool.ntp.org source Dialer0 ntp server 1.uk.pool.ntp.org source Dialer0 ntp server 2.uk.pool.ntp.org source Dialer0 ntp server 3.uk.pool.ntp.org source Dialer0 This setup works fine when issued in Global Configuration Mode when the Dialer0 interface (ATM0.1) is up. The configuration fails at startup though: Translating "1.uk.pool.ntp.org"...domain server (208.67.222.222) (208.67.220.220) ntp server 1.uk.pool.ntp.org source Dialer0 ^ % Invalid input detected at "^" marker. This is repeated for the other servers defined. Obviously the DNS lookup for the server(s) fails because the DNS servers cannot be accessed because the external interface is not yet online. Is there a way to delay the NTP configuration until afte the Dialer0 interface is fully initialised? Can the NTP commands be triggered by the Line Protocol on the Dialer0 interface transitioning to the up state? Alternatively, can the NTP commands be delayed for 5 minutes after the router has finished initialising? Any advice, or pointers to useful documentation or examples gratefully received ...

    Read the article

  • log4net initialisation

    - by Ruben Bartelink
    I've looked hard for duplicates but have to ask the following, no matter how basic it may seem, to get it clear once and for all! In a fresh Console app using log4net version 1.2.10.0 on VS28KSP1 on 64 bit W7, I have the following code:- using log4net; using log4net.Config; namespace ConsoleApplication1 { class Program { static readonly ILog _log = LogManager.GetLogger(typeof(Program)); static void Main(string[] args) { _log.Info("Ran"); } } } In my app.config, I have: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> </configSections> <log4net> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="Program.log" /> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> <appendToFile value="true" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="10" /> <maximumFileSize value="1MB" /> <staticLogFileName value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="[%username] %date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /> </layout> </appender> <root> <level value="DEBUG" /> <appender-ref ref="RollingFileAppender" /> </root> </log4net> </configuration> This doesnt write anything, unless I either add an attribute: [ assembly:XmlConfigurator ] Or explicitly initialise it in Main(): _log.Info("This will not go to the log"); XmlConfigurator.Configure(); _log.Info("Ran"); This raises the following questions: I'm almost certain I've seen it working somewhere on some version of log4net without the addition of the assembly attribute or call in Main. Can someone assure me I'm not imagining that? Can someone please point me to where in the doc it explicitly states that both the config section and the initialisation hook are required - hopefully with an explanation of when this changed, if it did? I can easily imagine why this might be the policy -- having the initialisation step explicit to avoid surprises etc., it's just that I seem to recall this not always being the case... (And normally I have the config in a separate file, which generally takes configsections out of the picture)

    Read the article

  • C# To VB.Net Conversion - array of class objects with initialisation

    - by mattryan
    can someone help me pls, im new to vb.net and im trying to work through the nhibernate firstsolkution sample (written in c#) and im struggling to convert this one bit. ive tried numerous convertors; telerik, developerfusion and a several others but none of the code produced will compile and i cant see the why... private readonly Product[] _products = new[] { new Product {Name = "Melon", Category = "Fruits"}, new Product {Name = "Pear", Category = "Fruits"}, new Product {Name = "Milk", Category = "Beverages"}, new Product {Name = "Coca Cola", Category = "Beverages"}, new Product {Name = "Pepsi Cola", Category = "Beverages"}, }; developer fusion gives Private ReadOnly _products As Product() = New () {New Product(), New Product(), New Product(), New Product(), New Product()} telerik gives Private ReadOnly _products As Product() = New () {New Product() With { _ .Name = "Melon", _ .Category = "Fruits" _ }, New Product() With { _ .Name = "Pear", _ .Category = "Fruits" _ }, New Product() With { _ .Name = "Milk", _ .Category = "Beverages" _ }, Nw Product() With { _ .Name = "Coca Cola", _ .Category = "Beverages" _ }, New Product() With { _ .Name = "Pepsi Cola", _ .Category = "Beverages" _ }} which seems the most useful except it complains about a type expected here "New () {..." ive tried various things just cant figure it out... what am i missing? am i just being dumb? or isnt there and equivilent? Cheers all

    Read the article

  • No value given for one or more required parameters in connection initialisation

    - by DarkJaff
    Hi everyone, I have an C# form application that use an access database. This application works perfectly in debug and release. It works on all version of Windows. But it crash on one computer with Windows 7. The message I got is: System.Data.OleDb.OleDbException: No value given for one or more required parameters. The function that is supposely not working is this: public void InitConnection(string strFile) { string strConnection = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};User Id=admin;Password=;", strFile); m_conn = new OleDbConnection(strConnection); try { //On vérifie si la connexion n'est pas ouverte if (m_conn.State != ConnectionState.Open) { m_conn.Open(); m_VCoeffModele = GetModeleCoeff(); } } catch (Exception err) { throw err; } } I think it's something related to the connection string but why only on that computer. Thanks for your help! DarkJaff EDIT Here is the complete error message: See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ***** Exception Text ******* System.Data.OleDb.OleDbException: No value given for one or more required parameters. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at DatabaseLayer.DatabaseFacade.GetModeleCoeff() at DatabaseLayer.DatabaseFacade.InitConnection(String strFile) at CalculatriceCHW.ListeMesure.OuvrirFichier(String strFichier) at CalculatriceCHW.ListeMesure.nouveauFichierMenu_Click(Object sender, EventArgs e) at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ToolStrip.WndProc(Message& m) at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Read the article

  • javascript literal initialisation loop

    - by graham.reeds
    I have an object which has several properties that are set when the object is created. This object recently changed to object literal notation, but I've hit a bit of a problem that searching on the net doesn't reveal. Simply stated I need to do this: Star = function(_id, _x, _y, _n, _o, _im, _c, _b, _links) { var self = { id: _id, // other properties links: [], for (var i=0,j=0;i<8;i++) { //<- doesn't like this line var k = parseInt(_links[i]); if (k > 0) { this.links[j++] = k; } }, // other methods }; return self; }; How do I initialise a property in the constructor in object literal notation?

    Read the article

  • Java and gstreamer-java initialisation error

    - by Mark
    I am building a small app which will play streaming audio from the internet in java (mainly internet radio stations). I have decided to use the gstreamer-java library for the sound, which uses JNA. I would like to include a check in the code, to see whether the gstreamer library has been initialised. When I have left the "Gst.init()" code out (to mimic when the library has not been initialised correctly), the application throws out the following messages: (process:21888): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.22.3/gobject/gtype.c:2458: initialization assertion failed, use IA__g_type_init() prior to this function (process:21888): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed The app calls the gstreamer-java library. The error messages appear but the thread continues to run, hogging the CPU. Is there any way to catch the error or to add a check to prevent it from happening? An alternative would be to put the "Gst.init()" in the main class, but I am not sure if this would always guarantee the gstreamer library is initialised.

    Read the article

  • No value given for one or more required parameters in connection initialisation

    - by Jean-François Côté
    I have an C# form application that use an access database. This application works perfectly in debug and release. It works on all version of Windows. But it crash on one computer with Windows 7. The message I got is: System.Data.OleDb.OleDbException: No value given for one or more required parameters. EDIT, after some debugging with messagebox on the computer that have the problem, here is the code that bug.The error is catched on the cmd.ExecuteReader(). The messagebox juste before is shown and the next one is the one in the catch with the exception below. Any ideas? public List<CoeffItem> GetModeleCoeff() { List<CoeffItem> list = new List<CoeffItem>(); try { OleDbDataReader dr; OleDbCommand cmd = new OleDbCommand("SELECT nIDModelAquacad, nIDModeleBorne, fCoefficient FROM tbl_ModelBorne ORDER BY nIDModelAquacad", m_conn); MessageBox.Show("Commande SQL créée avec succès"); dr = cmd.ExecuteReader(); MessageBox.Show("Exécution du reader sans problème!"); while (dr.Read()) { list.Add(new CoeffItem(Convert.ToInt32(dr["nIDModelAquacad"].ToString()), Convert.ToInt32(dr["nIDModeleBorne"].ToString()), Convert.ToDouble(dr["fCoefficient"].ToString()))); } MessageBox.Show("Lecture du reader"); dr.Close(); MessageBox.Show("Fermeture du reader"); } catch (OleDbException err) { MessageBox.Show("Erreur dans la lecture des modèles/coefficient: " + err.ToString()); } return list; } I think it's something related to the connection string but why only on that computer. Thanks for your help! EDIT Here is the complete error message: See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ***** Exception Text ******* System.Data.OleDb.OleDbException: No value given for one or more required parameters. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at DatabaseLayer.DatabaseFacade.GetModeleCoeff() at DatabaseLayer.DatabaseFacade.InitConnection(String strFile) at CalculatriceCHW.ListeMesure.OuvrirFichier(String strFichier) at CalculatriceCHW.ListeMesure.nouveauFichierMenu_Click(Object sender, EventArgs e) at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ToolStrip.WndProc(Message& m) at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Read the article

  • Initialisation of Objects Syntax question

    - by Brock Woolf
    When I initialise a struct in C (Node is the struct): struct Node { /* Non-Relevant code */ }; This works: Node *rootNode = new Node(); but so does this: Node *rootNode = new Node; Is there a difference, and what is the difference between using () or not using the brackets? Just off memory, I think the same applies above for C++ object initialisations. What is happening here?

    Read the article

  • How to pass initialisation parameters to a web service in Netbeans

    - by Bob Roberts
    I have built a web web service with Netbeans 6.8 using the "Web Service from WSDL" wizard. It has generated the binding classes and a skeleton for the class implementing the web service. I've set some initialization parameters in web.xml, under the servlet corresponding to the web service. Now I'd like to pass those parameters to the class implementing the web service. How can this be achieved (preferably without editing any of the code auto-generated by Netbeans)?

    Read the article

  • WCF Web/ServiceHost - Singletons and initialisation

    - by Kyle
    I have some Service class which is defined as InstanceContextMode.Single, and is well known in the hosting application. (The host creates an instance, and passes that to the WebServiceHost) Hosting app:WebServiceHost host = null; SomeService serviceInstance = new SomeService("text", "more text"); host = new WebServiceHost(serviceInstance, baseUri); Problem: When I go to use the variables initialised when the service is created (ie, when a call is made to the service), they are either null or empty... Am I wrong in assuming that as the instance being initialised in the hosting application is used for each request to the WebServiceHost? Any pointers here would be great.

    Read the article

  • C++ class initialisation containing class variable initialization

    - by Phil Hannent
    I noticed some code of a colleague today that initialized class variables in the initialization. However it was causing a warning, he says because of the order they are in. My question is why is it better to do variable initialization where it currently is and not within the curly brackets? DiagramScene::DiagramScene( int slideNo, QRectF screenRect, MainWindow* parent ) : QGraphicsScene( screenRect, parent ), myParent( parent ), slideUndoImageCurrentIndex(-1), nextGroupID(0), m_undoInProgress(false), m_deleteItemOnNextUndo(0) line(0), path(0) { /* Setup default brush for background */ scDetail->bgBrush.setStyle(Qt::SolidPattern); scDetail->bgBrush.setColor(Qt::white); setBackgroundBrush(scDetail->bgBrush); }

    Read the article

  • hadoop mapper static initialisation

    - by rakeshr
    Hi, I have a code fragment in which I am using a static code block to initialize a variable. public static class JoinMap extends Mapper<IntWritable, MbrWritable, LongWritable, IntWritable> { ....... public static RTree rt = null; static { String rtreeFileName = "R.rtree"; rt = new RTree(rtreeFileName); } public void map(IntWritable key, MbrWritable mbr,Context context) throws IOException, InterruptedException { ......... List elements = rt.overlaps(mbr.getRect()); ....... } } My problem is that the variable rt in the above code fragment is not getting initialised. Can anybody suggest a fix or an alternate way to initialise the variable. I don't want to initialise it inside my map function since that slows down the entire process.

    Read the article

  • c# 3.5 class List<int> class initialisation

    - by josephj1989
    I can initialize a List like new List{1,2,3,4,5}; However List does not have a constructor which accepts a single parameter. So I tried to run this through the debugger and it seems to be calling the Add method. So how does the compiler know which method to invoke to add each individual element. This may be a silly question but I am a bit confused. Thanks

    Read the article

  • Is it bad practise to initialise fields outside of an explicit constructor

    - by MrTortoise
    So its monday and we are arguing about coding practises. The examples here are a litttle too simple, but the real deal has several constructors. In order to initialise the simple values (eg dates to their min value) I have moved the code out of the constructors and into the field definitions. public class ConstructorExample { string _string = "John"; } public class ConstructorExample2 { string _string; public ConstructorExample2() { _string = "John"; } } How should it be done by the book. I tend to be very case by case and so am maybe a little lax abotu this kind of thing. However i feel that accams razor tells me to move the initialisation out of multiple constructors. Of course I could always move this shared initialisation into a private method. The question is essentially ... is initialising fields where they are defined as opposed to the constructor bad in any way? The argument I am facing is one of error handling, but i do not feel it is relevant as there are no possible exceptions that won't be picked up at compile time.

    Read the article

  • Is it possible to dynamically set a static string during *class* Initialisation?

    - by LonnieBest
    I'm trying to dynamically create a connection string during compile time: public static string ConnectionString { get { string connectionString = @"Data Source=" + myLibrary.common.GetExeDir() + @"\Database\db.sdf;"; return connectionString; } } I keep running into type initialisation errors. I was trying to avoid having to set the connection string for all applications that user my code library. The location of the database is different for each project that uses the library. I have code that can determine the correction string, but was wanting run it during compile time. Is this even possible?

    Read the article

  • Python list should be empty on class instance initialisation, but it's not. Why?

    - by canavanin
    Hi everyone! I would like to create instances of a class containing a list that's empty by default; instead of later setting this list to the final full list I would like to successively add items to it. Here's a piece of sample code illustrating this: #!/usr/bin/python class test: def __init__(self, lst=[], intg=0): self.lista = lst self.integer = intg name_dict = {} counter = 0 for name in ('Anne', 'Leo', 'Suzy'): counter += 1 name_dict[name] = test() name_dict[name].integer += 1 name_dict[name].lista.append(counter) print name, name_dict[name].integer, name_dict[name].lista When I ran the above program I expected to get Anne 1 [1] Leo 1 [2] Suzy 1 [3] as I assumed lista to always be initialised to an empty list. What I got instead was this: Anne 1 [1] Leo 1 [1, 2] Suzy 1 [1, 2, 3] If I replace self.lista = lst by self.lista = [] it works fine, just like when I add the line name_dict[name].lista = [] to the for loop. Why is it that the contents of the previous objects' lists are retained, yet their values of integer aren't? I am rather new to Python, so it would be great if someone could point out to me where my thoughts/assumptions have gone astray. Thanks a lot in advance for your replies.

    Read the article

  • How to install system_timer gem on Windows 7

    - by user280405
    I got problem "Processing environment.rb: Pre Initialisation Phase (using rails 2.3.5)" "Processing environment.rb: Main Initialisation Phase" C:/Ruby/bin/rake: No such file or directory - svnversion [memcache-client] Could not load SystemTimer gem, falling back to Ruby's slower/unsafe timeout library: no such file to load -- system_timer rake aborted! unable to find server during initialization. C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile' I dunno how to install this gem, because when i exec gem install system_timer i receiving: "Processing environment.rb: Pre Initialisation Phase (using rails 2.3.5)" "Processing environment.rb: Main Initialisation Phase" C:/Ruby/bin/rake: No such file or directory - svnversion [memcache-client] Could not load SystemTimer gem, falling back to Ruby's slower/unsafe timeout library: no such file to load -- system_timer rake aborted! unable to find server during initialization. C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile' Anybody, help please!

    Read the article

  • Controlling race condition at startup.

    - by Will Hartung
    I have some code that I want to have some one time initialisation performed. But this code doesn't have a definite lifecycle, so my logic can be potentially invoked by multiple threads before my initialisation is done. So, I want to basically ensure that my logic code "waits" until initialisation is done. This is my first cut. public class MyClass { private static final AtomicBoolean initialised = new AtomicBoolean(false); public void initialise() { synchronized(initialised) { initStuff(); initialised.getAndSet(true); initialised.notifyAll(); } } public void doStuff() { synchronized(initialised) { if (!initialised.get()) { try { initialised.wait(); } catch (InterruptedException ex) { throw new RuntimeException("Uh oh!", ex); } } } doOtherStuff(); } } I basically want to make sure this is going to do what I think it's going to do -- block doStuff until the initialised is true, and that I'm not missing a race condition where doStuff might get stuck on a Object.wait() that will never arrive. Edit: I have no control over the threads. And I want to be able to control when all of the initialisation is done, which is why doStuff() can't call initialise(). I used an AtomicBoolean as it was a combination of a value holder, and an object I could synchronize. I could have also simply had a "public static final Object lock = new Object();" and a simple boolean flag. AtomicBoolean conveniently gave me both. A Boolean can not be modified. The CountDownLatch is exactly what I was looking for. I also considered using a Sempahore with 0 permits. But the CountDownLatch is perfect for just this task.

    Read the article

  • Doxygen - <X>:1: warning: return type of member X is not documented

    - by Matt Clarkson
    /*! \var GLOBAL_VAR * \brief This is my global initialisation array for MY_STRUCT */ MY_STRUCT GLOBAL_VAR = { 1, 3, 2, 1, }; I get the following error: <GLOBAL_VAR>:1: warning: return type of member GLOBAL_VAR is not documented But this shouldn't have any return type?! If I do either of the following the warning goes away: /*! \var GLOBAL_VAR * \brief This is my global initialisation array for MY_STRUCT * \returns */ MY_STRUCT GLOBAL_VAR = { 1, 3, 2, 1, }; Or: /*! \var GLOBAL_VAR * \brief This is my global initialisation array for MY_STRUCT */ MY_STRUCT GLOBAL_VAR = 3; The isn't very useful as it puts a "Returns" into my HTML documentation and the second one breaks my code! How do I remove this warning? Thanks Matt

    Read the article

  • Please help me to improve Re-Sharper

    - by TATWORTH
    Re-Sharper is an excellent aid to producing good code in either C# or VB.NET. Recently through using Resharper and StyleCop, I have found three area where ReSharper needs to be improved. Please log into the YouTrack at http://youtrack.jetbrains.net and vote for the following: RSRP-268868 Improvement to removal of redundant else and invert if optimisations for enhanced stylecop compliance. When Resharper removes a redundant else, there needs to be a blank line added. Currently there is no provision to specify this. Please vote for this! RSRP-272286 Resharper Feature Request to move initialisation to static constructor Currently ReSharper offers moving initialisation of of non-static variable to a constructor. Why not offer the same for a static constructor?  Please vote for this! RSRP-272285 Expansion of Switch Statement by Resharper Currently ReSharper will fill an empty switch statement based upon an enumeration but will not add missing enumeration values to such a switch statement.   Can't code withoutCoding assistance, smart code editing and code completion for C# and VB.NET

    Read the article

1 2 3 4 5 6  | Next Page >