Search Results

Search found 5463 results on 219 pages for 'runtime'.

Page 22/219 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • High Runtime for Dictionary.Add for a large amount of items

    - by aaginor
    Hi folks, I have a C#-Application that stores data from a TextFile in a Dictionary-Object. The amount of data to be stored can be rather large, so it takes a lot of time inserting the entries. With many items in the Dictionary it gets even worse, because of the resizing of internal array, that stores the data for the Dictionary. So I initialized the Dictionary with the amount of items that will be added, but this has no impact on speed. Here is my function: private Dictionary<IdPair, Edge> AddEdgesToExistingNodes(HashSet<NodeConnection> connections) { Dictionary<IdPair, Edge> resultSet = new Dictionary<IdPair, Edge>(connections.Count); foreach (NodeConnection con in connections) { ... resultSet.Add(nodeIdPair, newEdge); } return resultSet; } In my tests, I insert ~300k items. I checked the running time with ANTS Performance Profiler and found, that the Average time for resultSet.Add(...) doesn't change when I initialize the Dictionary with the needed size. It is the same as when I initialize the Dictionary with new Dictionary(); (about 0.256 ms on average for each Add). This is definitely caused by the amount of data in the Dictionary (ALTHOUGH I initialized it with the desired size). For the first 20k items, the average time for Add is 0.03 ms for each item. Any idea, how to make the add-operation faster? Thanks in advance, Frank

    Read the article

  • Determing Python version at runtime

    - by Gekitsuu
    The problem I'm having is that I've written code that depends on features in python2.6 so I'm trying to build a check that will produce a useful error if someone tries to run it on a machine with python lower than 2.6. The code I put in to check for the specific version and match it should work fine but the problem I have is the interpreter on a 2.4 machine reads the file and sees a "finally" at the end of my try loop and errors out before it gets far enough into execution for my if statement to handle the version mismatch. Other than changing the magic line to specifically look for /usr/bin/python2.6 is there a way python can handle this sort of thing?

    Read the article

  • Silverlight control locked in runtime

    - by user194979
    I have a online survey running in Silverlight. Out of more than 1000 onetime users, there are three users than cannot open a combobox on the first page. The control seems disabled and don't react on mouseclick. Since it is one-time user, they don't wan't to help me with debugging and I cannot reproduce the problem myself. Any ideas why 1000 users have no problem, and 3 are experiencing all controls like they were disabled?

    Read the article

  • Python vs. Java performance (runtime speed)

    - by Bijan
    Ignoring all the characteristics of each languages and focusing SOLELY on speed, which language is better performance-wise? You'd think this would be a rather simple question to answer, but I haven't found a decent one. I'm aware that some types of operations may be faster with python, and vice-versa, but I cannot find any detailed information on this. Can anyone shed some light on the performance differences?

    Read the article

  • PHP, create_function or evalute it at runtime?

    - by blow
    Hi all, i have a class with some method that depend by one parameter. What is the best way to write this method? Example: First way class Test{ var $code; function Test($type){ if($type=="A"){ $this->code=create_function(/*some args and some code*/); } else if($type=="B"){ $this->code=create_function(/*some args and some code*/); } } function use(/*some args*/){ return call_user_func($this->code,/*some args*/); } } Second way class Test{ var $type; function Test($type){ $this->type=$type; } function use(/*some args*/){ if($this->type=="A"){ //some code } else if($this->type=="B"){ //some code } } } $test=new Test("A"); $test->use(); Which way you would choose? Thanks.

    Read the article

  • Dynamic classloading fails on runtime

    - by Henrik Paul
    I have the following snippet of java code: final Class<?> junitCoreClass = AccessController.doPrivileged( new PrivilegedAction<URLClassLoader>() { @Override public URLClassLoader run() { return new URLClassLoader(new URL[] { junitJarUrl }); } }).loadClass("org.junit.runner.JUnitCore"); System.out.println(junitCoreClass.getName()); final JUnitCore junitCore = (JUnitCore) junitCoreClass.newInstance(); This compiles fine. But when I try to run it, something weird happens; a java.lang.NoClassDefFoundError is thrown on that last line, referring to the class just loaded. The weird part is, the println prints the exact class name. I checked that if I keep the reference as an Object and manipulate it only through reflection, everything's fine, so the offending piece of code must be the explicit cast. Can someone explain to me why this happens, and also tell me how I can achieve what I'm trying to do?

    Read the article

  • Programmatically change .net configuration at runtime?

    - by fretje
    Is there a way to programmatically enable diagnostic tracing for a WSE web service client? This is how it should be configured using an app.config file: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </configSections> <microsoft.web.services3> <diagnostics> <trace enabled="true" input="InputTrace.webinfo" output="OutputTrace.webinfo" /> </diagnostics> </microsoft.web.services3> </configuration> I would like to do this from code. Is this possible?

    Read the article

  • Populate DataGridViewComboBoxColumn runtime

    - by ghiboz
    Hi all! I have this problem: I have a datagridview that reads the data from a db and I wish, for an integer column use a combobox to choose some values... I modified the column using DataGridViewComboBoxColumn type and after, on the init of the form this: DataTable dt = new DataTable("dtControlType"); dt.Columns.Add("f_Id"); dt.Columns.Add("f_Desc"); dt.Rows.Add(0, "none"); dt.Rows.Add(1, "value 1"); dt.Rows.Add(2, "value 2"); dt.Rows.Add(3, "value 3"); pControlType.DataSource = dt; pControlType.DataPropertyName = "pControlType"; pControlType.DisplayMember = "f_Desc"; pControlType.ValueMember = "f_Id"; but when the program starts (after this code) this message appears:

    Read the article

  • Need to change ip address in app.config in runtime without runnning as admin

    - by djerry
    Hey guys, There's a lot of post saying how to change info in the app.config and there are posts that say you shouldn't edit info in the app.config but store info in user folders. I understand these topics. But what i want is a combination of both. I have a wcf setup for my client in an app.config, which contains the endpoint address to which it should connect. When The server changes ip, or when a client is installed on a computer in another company, the user should be able to insert another ip-address which should be stored in the app.config. This cannot be stored in a file in appdata or something like that, as the client reads the info in the app.config on startup. How can i write (so remember the new ip-address) in the app.config when the client is installed in program files, the UAC is enabled and the program isn't run as an admin? Thanks in advance.

    Read the article

  • C# how to create functions that are interpreted at runtime

    - by Lirik
    I'm making a Genetic Program, but I'm hitting a limitation with C# where I want to present new functions to the algorithm but I can't do it without recompiling the program. In essence I want the user of the program to provide the allowed functions and the GP will automatically use them. It would be great if the user is required to know as little about programming as possible. I want to plug in the new functions without compiling them into the program. In Python this is easy, since it's all interpreted, but I have no clue how to do it with C#. Does anybody know how to achieve this in C#? Are there any libraries, techniques, etc?

    Read the article

  • Generic property- specify the type at runtime

    - by Lirik
    I was reading a question on making a generic property, but I'm a little confused at by the last example from the first answer (I've included the relevant code below): You have to know the type at compile time. If you don't know the type at compile time then you must be storing it in an object, in which case you can add the following property to the Foo class: public object ConvertedValue { get { return Convert.ChangeType(Value, Type); } } That's seems strange: it's converting the value to the specified type, but it's returning it as an object when the value was stored as an object. Doesn't the returned object still require un-boxing? If it does, then why bother with the conversion of the type? I'm also trying to make a generic property whose type will be determined at run time: public class Foo { object Value {get;set;} Type ValType{get;set;} Foo(object value, Type type) { Value = value; ValType = type; } // I need a property that is actually // returned as the specified value type... public object ConvertedValue { get { return Convert.ChangeType(Value, ValType); } } } Is it possible to make a generic property? Does the return property still require unboxing after it's accessed?

    Read the article

  • Incongruity between Eclipse Outline/Package perspective and source code being displayed - Java error generated at runtime

    - by David Daedalus
    I've been debugging a Java application and have encountered something odd. When a particular method is called, Java throws a ClassNotFoundException. Unfortunately, the methods in question (the invoking and the 'missing' one) are inside a JAR file for which I have no documentation or source. To get at the source, I used JD-GUI (a Java JAR reverse engineer-er) and the JD plugin for Eclipse. As far as I can tell, the class in question exists inside the JAR file. This because JD-GUI displays it inside the JAR, and from within Eclipse I can see it listed along with the constructors and methods. My question is why the source being displayed in Eclipse is for a different class (that also exists)? This program was built with Ant - is it possible the problem lies there? Screenshot below for your viewing pleasure - and thanks in advance for your help!

    Read the article

  • unable to load library at runtime in android application

    - by Addy
    Hi. I m working on android application in which I used JNI for native c code. I build this application on android 2.0 version and ndkr3. and its work fine. Now when I changed the android sdk version 1.5 and api version 3 I faced problem of unable to open library libtest_demo.so. 05-13 16:54:23.603: INFO/dalvikvm(1211): Unable to dlopen(/data/data/org.abc.test_demo/lib/libtest_demo.so): Cannot find library I put the libtest_demo.so file at the same place /data/data/org.abc.test_demo/lib/libtest_demo.so but still problem arise. please help me..

    Read the article

  • Managing important runtime business logic with regard to a codebase

    - by Daniel Beardsley
    I'm working on a project which will end up have a lot of application information stored in the form of records in a database. In this case, it's the configuration of data views: which grid columns to show/hide default filters to apply to each grid view column titles sorting subtotaling ... This information is a big part of the value of the application and is essential to it's function. The data will be altered by admins a fair amount, so it's not static and it wouldn't be appropriate to have to deploy a new version of the app every time the data changes. The question is, Where should this data be stored? It will definitely live in the database because that's how it's accessed, but I feel like it needs to also be kept with the version controlled codebase because it's an integral part of functioning of the application. Has anyone dealt with an issue like this before? What did you end up doing?

    Read the article

  • C# Pass Generics At Runtime

    - by TheCloudlessSky
    I have a method like the following: public IEnumerable<T> GetControls<T>() : where T : ControlBase { // removed. } I then created a class: public class HandleBase<TOwner> : ControlBase : TOwner { // Removed } I'd like to be able to call GetControls<HandleBase<this.GetType()>>; where it would use the type of THIS class to pass to the HandleBase. This would in essentially get all HandleBase that have an owner of THIS type. How can I achieve this?

    Read the article

  • How can I catch runtime error in C++

    - by Yan Cheng CHEOK
    By referring to http://stackoverflow.com/questions/315948/c-catching-all-exceptions try { int i = 0; int j = 0/i; /* Division by 0 */ int *k = 0; std::cout << *k << std::endl; /* De-reference invalid memory location. */ } catch (...) { std::cout << "Opps!" << std::endl; } The above run-time error are unable to be detected. Or, am I having wrong expectation on C++ exception handling feature?

    Read the article

  • Add folder, which contains java sources, to classpath at runtime

    - by markovuksanovic
    Is it possible to add a folder which contains java source code as a classpath element. I have tried a few things and it seems that the classloadr is not picking up java soruce files? One of my attempts is shown below.... File uncompressedSrc = new File("uncompressed" + File.separator + "src" + File.separator); URL uncompressedSrcURL = null; try { uncompressedSrcURL = new URL("file://" + uncompressedSrc.getAbsolutePath()); } catch (MalformedURLException e) { e.printStackTrace(); } URL elements[] = { uncompressedSrcURL }; new URLClassLoader(elements, ClassLoader.getSystemClassLoader());

    Read the article

  • Change DateTimePicker Calendar Runtime

    - by Smart pro
    I want to view the calendar in another culture, for example let it show in Arabic. I use this code in the Main, but the calendar is still in the same culture: CultureInfo sa = new CultureInfo("ar-SA", false); sa.DateTimeFormat.Calendar = new System.Globalization.HijriCalendar(); // Sets the culture to Arabic (Saudi Arabia) Thread.CurrentThread.CurrentCulture = sa; // Sets the UI culture to Arabic (Saudi Arabia) Thread.CurrentThread.CurrentUICulture = sa; I add the DateTimePicker on a form and expect that it shows the date in Arabic after running, but the DateTimePicker or Calendar is not changed to that culture.

    Read the article

  • Specifying a callback in Matlab after any runtime error

    - by JmG
    Is there a way to specify code to be run whenever an error occurs in Matlab? Googling I came across RunTimeErrorFcn and daqcallback, but I believe these are specific to the Data Acquisition Toolbox. I want something for when I just trip over a bug, like an access to an unassigned variable. (I use a library called PsychToolbox that takes over the GPU, so I want to be able to clear its screen before returning to the command prompt.)

    Read the article

  • Are .NET 4.0 Runtime slower than .NET 2.0 Runtime?

    - by DxCK
    After I upgraded my projects to .NET 4.0 (With VS2010) I realized than they run slower than they were in .NET 2.0 (VS2008). So i decided to benchmark a simple console application in both VS2008 & VS2010 with various Target Frameworks: using System; using System.Diagnostics; using System.Reflection; namespace RuntimePerfTest { class Program { static void Main(string[] args) { Console.WriteLine(Assembly.GetCallingAssembly().ImageRuntimeVersion); Stopwatch sw = new Stopwatch(); while (true) { sw.Reset(); sw.Start(); for (int i = 0; i < 1000000000; i++) { } TimeSpan elapsed = sw.Elapsed; Console.WriteLine(elapsed); } } } } Here is the results: VS2008 Target Framework 2.0: ~0.25 seconds Target Framework 3.0: ~0.25 seconds Target Framework 3.5: ~0.25 seconds VS2010 Target Framework 2.0: ~3.8 seconds Target Framework 3.0: ~3.8 seconds Target Framework 3.5: ~1.51 seconds Target Framework 3.5 Client Profile: ~3.8 seconds Target Framework 4.0: ~1.01 seconds Target Framework 4.0 Client Profile: ~1.01 seconds My initial conclusion is obviously that programs compiled with VS2008 working faster than programs compiled with VS2010. Can anyone explain those performance changes between VS2008 and VS2010? and between different Target Frameworks inside VS2010 itself?

    Read the article

  • Java Best Practice for type resolution at runtime.

    - by Brian
    I'm trying to define a class (or set of classes which implement the same interface) that will behave as a loosely typed object (like JavaScript). They can hold any sort of data and operations on them depend on the underlying type. I have it working in three different ways but none seem ideal. These test versions only allow strings and integers and the only operation is add. Adding integers results in the sum of the integer values, adding strings concatenates the strings and adding an integer to a string converts the integer to a string and concatenates it with the string. The final version will have more types (Doubles, Arrays, JavaScript-like objects where new properties can be added dynamically) and more operations. Way 1: public interface DynObject1 { @Override public String toString(); public DynObject1 add(DynObject1 d); public DynObject1 addTo(DynInteger1 d); public DynObject1 addTo(DynString1 d); } public class DynInteger1 implements DynObject1 { private int value; public DynInteger1(int v) { value = v; } @Override public String toString() { return Integer.toString(value); } public DynObject1 add(DynObject1 d) { return d.addTo(this); } public DynObject1 addTo(DynInteger1 d) { return new DynInteger1(d.value + value); } public DynObject1 addTo(DynString1 d) { return new DynString1(d.toString()+Integer.toString(value)); } } ...and similar for DynString1 Way 2: public interface DynObject2 { @Override public String toString(); public DynObject2 add(DynObject2 d); } public class DynInteger2 implements DynObject2 { private int value; public DynInteger2(int v) { value = v; } @Override public String toString() { return Integer.toString(value); } public DynObject2 add(DynObject2 d) { Class c = d.getClass(); if(c==DynInteger2.class) { return new DynInteger2(value + ((DynInteger2)d).value); } else { return new DynString2(toString() + d.toString()); } } } ...and similar for DynString2 Way 3: public class DynObject3 { private enum ObjectType { Integer, String }; Object value; ObjectType type; public DynObject3(Integer v) { value = v; type = ObjectType.Integer; } public DynObject3(String v) { value = v; type = ObjectType.String; } @Override public String toString() { return value.toString(); } public DynObject3 add(DynObject3 d) { if(type==ObjectType.Integer && d.type==ObjectType.Integer) { return new DynObject3(Integer.valueOf(((Integer)value).intValue()+((Integer)value).intValue())); } else { return new DynObject3(value.toString()+d.value.toString()); } } } With the if-else logic I could use value.getClass()==Integer.class instead of storing the type but with more types I'd change this to use a switch statement and Java doesn't allow switch to use Classes. Anyway... My question is what is the best way to go about something thike this?

    Read the article

  • Changing where a resource is pulled during runtime?

    - by Brandon
    I have a website that goes out to multiple clients. Sometimes a client will insist on minor changes. For reasons beyond my control, I have to comply no matter how minor the request. Usually this isn't a problem, I would just create a client specific version of the user control or page and overwrite the default one during build time or make a configuration setting to handle it. Now that I am localizing the site, I'm curious about the best way to go about making minor wording changes. Lets say I have a resource file called Resources.resx that has 300 resources in it. It has a resource called Continue. English value is "Continue", the French value is "Continuez". Now one client, for whatever reason, wants it to say "Next" and "Après" and the others want to keep it the same. What is the best way to accomodate a request like this? (This is just a simple example). The only two ways I can think of is to Create another Resources.resx specific to the client, and replace the .dll during build time. Since I'd be completely replacing the dll, the new resource file would have to contain all 300 strings. The obvious problem being that I now have 2 resource files, each with 300 strings to maintain. Create a custom user control/page and change it to use a custom resource file. e.g. SignIn.ascx would be replaced during the build and it would pull its resources from ClientName.resx instead of Resources.resx. Are there any other things I could try? Is there any way to change it so that the application will always look in a ClientResources.resx file for the overridden values before actually look at the specified resource file?

    Read the article

  • Managing Data Dependecies of Java Classes that Load Data from the Classpath at Runtime

    - by Martin Potthast
    What is the simplest way to manage dependencies of Java classes to data files present in the classpath? More specifically: How should data dependencies be annotated? Perhaps using Java annotations (e.g., @Data)? Or rather some build entries in a build script or a properties file? Is there build tool that integrates and evaluates such information (Ant, Scons, ...)? Do you have examples? Consider the following scenario: A few lines of Ant create a Jar from my sources that includes everything found on the classpath. Then jarjar is used to remove all .class files that are not necessary to execute, say, class Foo. The problem is that all the data files that class Bar depends upon are still there in the Jar. The ideal deployment script, however, would recognize that the data files on which only class Bar depends can be removed while data files on which class Foo depends must be retained. Any hints?

    Read the article

  • Mysql and PHP - Reading multiple insert queries from a file and executing at runtime

    - by SpikETidE
    Hi everyone... I am trying out a back-up and restore system. Basically, what i try to do is, when creating the back up i make a file which looks like DELETE FROM bank_account; INSERT INTO bank_account VALUES('1', 'IB6872', 'Indian Bank', 'Indian Bank', '2', '1', '0', '0000-00-00 00:00:00', '1', '2010-04-13 17:09:05');INSERT INTO bank_account VALUES('2', 'IB7391', 'Indian Bank', 'Indian Bank', '3', '1', '0', '0000-00-00 00:00:00', '1', '2010-04-13 17:09:32'); and so on and so forth. When i restore the db i just read the query from the file, save it to a string and then execute it over the DB using mysql_query(); The problem is, when i run the query through mysql_query(), the execution stops after the delete query with the error 'Error in syntax near '; INSERT INTO bank_account VALUES('1', 'IB6872', 'Indian Bank', 'Indian Bank', '2',' at line 1. But when i run the queries directly over the Db, using phpmyadmin it executes without any errors. As far as i can see, i can't notice any syntax error in the query. Can anyone point out where there might be a glitch...? Thanks and regards....

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >