Search Results

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

Page 35/102 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • 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

  • intiating lists in the constructor's initialization list

    - by bks
    i just moved from C to C++, and now work with lists. i have a class called "message", and i need to have a class called "line", which should have a list of messages in its properties. as i learned, the object's properties should be initialized in the constructor's initialization list, and i had the "urge" to initialize the messages list in addition to the rest of the properties (some strings and doubles). is that "urge" justified? does the list need to be initialized? thank you in advance

    Read the article

  • Need Google Map InfoWindow Hyperlink to Open Content in Overlay (Fusion Table Usage)

    - by McKev
    I have the following code established to render the map in my site. When the map is clicked, the info window pops up with a bunch of content including a hyperlink to open up a website with a form in it. I would like to utilize a function like fancybox to open up this link "form" in an overlay. I have read that fancybox doesn't support calling the function from within an iframe, and was wondering if there was a way to pass the link data to the DOM and trigger the fancybox (or another overlay option) in another way? Maybe a callback trick - any tips would be much appreciated! <style> #map-canvas { width:850px; height:600px; } </style> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script src="http://gmaps-utility-gis.googlecode.com/svn/trunk/fusiontips/src/fusiontips.js" type="text/javascript"></script> <script type="text/javascript"> var map; var tableid = "1nDFsxuYxr54viD_fuH7fGm1QRZRdcxFKbSwwRjk"; var layer; var initialLocation; var browserSupportFlag = new Boolean(); var uscenter = new google.maps.LatLng(37.6970, -91.8096); function initialize() { map = new google.maps.Map(document.getElementById('map-canvas'), { zoom: 4, mapTypeId: google.maps.MapTypeId.ROADMAP }); layer = new google.maps.FusionTablesLayer({ query: { select: "'Geometry'", from: tableid }, map: map }); //http://gmaps-utility-gis.googlecode.com/svn/trunk/fusiontips/docs/reference.html layer.enableMapTips({ select: "'Contact Name','Contact Title','Contact Location','Contact Phone'", from: tableid, geometryColumn: 'Geometry', suppressMapTips: false, delay: 500, tolerance: 8 }); ; // Try W3C Geolocation (Preferred) if(navigator.geolocation) { browserSupportFlag = true; navigator.geolocation.getCurrentPosition(function(position) { initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); map.setCenter(initialLocation); //Custom Marker var pinColor = "A83C0A"; var pinImage = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + pinColor, new google.maps.Size(21, 34), new google.maps.Point(0,0), new google.maps.Point(10, 34)); var pinShadow = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_shadow", new google.maps.Size(40, 37), new google.maps.Point(0, 0), new google.maps.Point(12, 35)); new google.maps.Marker({ position: initialLocation, map: map, icon: pinImage, shadow: pinShadow }); }, function() { handleNoGeolocation(browserSupportFlag); }); } // Browser doesn't support Geolocation else { browserSupportFlag = false; handleNoGeolocation(browserSupportFlag); } function handleNoGeolocation(errorFlag) { if (errorFlag == true) { //Geolocation service failed initialLocation = uscenter; } else { //Browser doesn't support geolocation initialLocation = uscenter; } map.setCenter(initialLocation); } } google.maps.event.addDomListener(window, 'load', initialize); </script>

    Read the article

  • Why does the Java compiler complain about a local variable not having been initialized here?

    - by pele
    int a = 1, b; if(a > 0) b = 1; if(a <= 0) b = 2; System.out.println(b); If I run this, I receive: Exception in thread "main" java.lang.Error: Unresolved compilation problem: The local variable b may not have been initialized at Broom.main(Broom.java:9) I know that the local variables are not initialized and is your duty to do this, but in this case, the first if doesn't initialize the variable?

    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

  • Rails: url_for to be available in a isolated class that must be instanced

    - by Totty
    Rails: url_for to be available in a isolated class that must be instanced: class ProfilePresenter < ActionController::Base attr_reader :profile def initialize(profile) super @a = url_for(:controller => 'profiles', :action => 'view', :profile_url => 'dd') @a @profile = profile end end How to make the url_for work? i tried to extend the ActionController::Base and the ActionView::Base and i cant :s

    Read the article

  • Ckeditor sends default content

    - by user1294101
    I use ckeditor with a default content. Then I initialize (replace textarea) CKEditor with jquery and I edit the text. The problem is that var data = $( 'textarea.editor' ).val(); returns default content and also getData(). What I have to do to grab the actual content? Thank you very much var ed = $( '#ed' ).ckeditor( {toolbar :[ { name: 'basicstyles', items : [ 'Bold','Italic' ] }, {name: 'link', items:['Link']}, { name: 'colors', items : [ 'TextColor' ] } ] } );

    Read the article

  • Initializing a C++ vector to random values... fast

    - by Flamewires
    Hey, id like to make this as fast as possible because it gets called A LOT in a program i'm writing, so is there any faster way to initialize a C++ vector to random values than: double range;//set to the range of a particular function i want to evaluate. std::vector<double> x(30, 0.0); for (int i=0;i<x.size();i++) { x.at(i) = (rand()/(double)RAND_MAX)*range; } EDIT:Fixed x's initializer.

    Read the article

  • disable log4j if log4j.properties file is not found.

    - by zeroin23
    log4j:WARN No appenders could be found for logger ().<br/> log4j:WARN Please initialize the log4j system properly. The above message is shown and i would like to disable the logger if the log4j.properties cannot be found. How do i go about it? BasicConfigurator.configure(); will output to console which is not what i want.

    Read the article

  • backbone.js - Having multiple instances of the same view

    - by TrueWheel
    I am having problems having multiple instances in of the same view in different div elements. When I try to initialize them only the second of the two elements appear no matter what order I put them in. Here is the code for my view. var BodyShapeView = Backbone.View.extend({ thingiview: null, scene: null, renderer: null, model: null, mouseX: 0, mouseY: 0, events:{ 'click button#front' : 'front', 'click button#diag' : 'diag', 'click button#in' : 'zoomIn', 'click button#out' : 'zoomOut', 'click button#on' : 'rotateOn', 'click button#off' : 'rotateOff', 'click button#wireframeOn' : 'wireOn', 'click button#wireframeOff' : 'wireOff', 'click button#distance' : 'dijkstra' }, initialize: function(name){ _.bindAll(this, 'render', 'animate'); scene = new THREE.Scene(); camera = new THREE.PerspectiveCamera( 15, 400 / 700, 1, 4000 ); camera.position.z = 3; scene.add( camera ); camera.position.y = -5; var ambient = new THREE.AmbientLight( 0x202020 ); scene.add( ambient ); var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.75 ); directionalLight.position.set( 0, 0, 1 ); scene.add( directionalLight ); var pointLight = new THREE.PointLight( 0xffffff, 5, 29 ); pointLight.position.set( 0, -25, 10 ); scene.add( pointLight ); var loader = new THREE.OBJLoader(); loader.load( "img/originalMeanModel.obj", function ( object ) { object.children[0].geometry.computeFaceNormals(); var geometry = object.children[0].geometry; console.log(geometry); THREE.GeometryUtils.center(geometry); geometry.dynamic = true; var material = new THREE.MeshLambertMaterial({color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors }); mesh = new THREE.Mesh(geometry, material); model = mesh; // model = object; scene.add( model ); } ); // RENDERER renderer = new THREE.WebGLRenderer(); renderer.setSize( 400, 700 ); $(this.el).find('.obj').append( renderer.domElement ); this.animate(); }, Here is how I create the instances var morphableBody = new BodyShapeView({ el: $("#morphable-body") }); var bodyShapeView = new BodyShapeView({ el: $("#mean-body") }); Any help would be really appreciated. Thanks in advance.

    Read the article

  • Problem initialing a unicode string

    - by Simon
    Hey All. Atm im working with native API calls and i have to get RtlInitUnicodeString to work. The way i use: const WCHAR wcMutex[] = L"String1"; UNICODE_STRING unicodeMutexBuffer; RtlInitUnicodeString(&unicodeMutexBuffer,wcMutex); now my problem the project doesnt compile , i get this error: Error argument of type "UNICODE_STRING*" is incompatible with type of "PUNICODE_STRING" but in my old Driver kit , i used same way to initialize the unicode string struct

    Read the article

  • How to measure Silverlight control load time with Google Analytics

    - by ddehghan
    Hi everyone I have a simple silverlight page for for finding available domain names. I use Google Analytics for monitoring the traffic. I would really like to find out how long it take for users to download and render the Silverlight control. Once the java script on a page is loaded there should be a way to start a timer and then stop the timer once the Silverlight control is loaded. Key points I would like to measure are: Time it takes to download the silverlight control Time it takes to initialize the control Thanks

    Read the article

  • link dll to executable

    - by user353707
    How can I link the .dll file to an executable? I do not have the source for the dll nor executable. The two files operate on a 64-bit system. When the executable is ported from another system, I get "The application failed to initialize properly (0xc0150002). Click OK to Terminate the program.

    Read the article

  • Help to comment a simple statement

    - by Woppie the Russian
    How does you call this statement?: $arr = array(); initialize an array or declare an array? In brief, how would you comment such a statement? (P.S. That array would then hold a bunch of values.) EDIT: I doubt because what I basically do is declare a variable of a particular type, don't I?

    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

  • JQuery Tablesorter clear table information

    - by conversoid
    I've created a jquery table that from time to time needs to be cleared and the re-populated, my clear method is this: //Clear table content before repopulating values $('#tabela_dash2_maquinas .real-content table tr:gt(0)').remove(); Now i'm trying to use tablesorter to sort a specific column, but my problem is that when I enable the tablesorter: //Initialize tablesorter $("table").tablesorter(); The table clearing method is not working anymore, it just keeps adding the new data with the old data, creating a lot of repeated information. Please help

    Read the article

  • C# ApplicationContext usage

    - by rd42
    Apologies if my terminology is off, I'm new to C#. I'm trying to use an ApplicationContext file to store mysql conn values, like dbname, username, password. The class with mysql conn string is "using" the namespace for the ApplicationContext, but when I print out the connection string, the values are making it. A friend said, "I'm not initializing it" but couldn't stay to expand on what "it" was. and the "Console.WriteLine("1");" in ApplicationContext.cs never shows up. Do I need to create an ApplicationContext object and the call Initialize() on that object? Thanks for any help. ApplicationContext.cs: namespace NewApplication.Context { class ApplicationContext { public static string serverName; public static string username; public static string password; public static void Initialize() { //need to read through config here try { Console.WriteLine("1"); XmlDocument xDoc = new XmlDocument(); xDoc.Load(".\\Settings.xml"); XmlNodeList serverNodeList = xDoc.GetElementsByTagName("DatabaseServer"); XmlNodeList usernameNodeList = xDoc.GetElementsByTagName("UserName"); XmlNodeList passwordNodeList = xDoc.GetElementsByTagName("Password"); } catch (Exception ex) { // MessageBox.Show(ex.ToString()); //TODO: Future write to log file username = "user"; password = "password"; serverName = "localhost"; } } } } MySQLManager.cs: note: dbname is the same as the username as you'll see in the code, I copied this from a friend who does that. using System; using System.Collections.Generic; using System.Linq; using System.Text; using MySql.Data; using MySql.Data.MySqlClient; using NewApplication.Context; namespace NewApplication.DAO { class MySQLManager { private static MySqlConnection conn; public static MySqlConnection getConnection() { if (conn == null || conn.State == System.Data.ConnectionState.Closed) { string connStr = "server=" + ApplicationContext.serverName + ";user=" + ApplicationContext.username + ";database=" + ApplicationContext.username + ";port=3306;password=" + ApplicationContext.password + ";"; conn = new MySqlConnection(connStr); try { Console.WriteLine("Connecting to MySQL... "); Console.WriteLine("Connection string: " + connStr + "\n"); conn.Open(); // Perform databse operations // conn.Close(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } return conn; } } } and, thanks for still reading, this is the code that uses the two previous files: class LogDAO { MySqlConnection conn; public LogDAO() { conn = MySQLManager.getConnection(); } Thank you, rd42

    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

  • How can I disable a model field in a django form

    - by jammon
    I have a model like this: class MyModel(models.Model): REGULAR = 1 PREMIUM = 2 STATUS_CHOICES = ((REGULAR, "regular"), (PREMIUM, "premium")) name = models.CharField(max_length=30) status = models.IntegerField(choices = STATUS_CHOICES, default = REGULAR) class MyForm(forms.ModelForm): class Meta: model = models.MyModel In a view I initialize one field and try to make it non-editable: myform = MyForm(initial = {'status': requested_status}) myform.fields['status'].editable = False But the user can still change that field. What's the real way to accomplish what I'm after?

    Read the article

  • How to manually add Core Data to project?

    - by marko
    E.g. what "Use Core Data for storage" checkbox option means when creating new Window or Navigation based project? How to add Core Data for Tab Bar Application? How to initialize managedObjectModel, managedObjectContext, persistentStoreCoordinator?

    Read the article

  • How to fill a two Dimensional ArrayList in java with Integers?

    - by eNetik
    I have to create a 2d array with unknown size. So I have decided to go with a 2d ArrayList the problem is I'm not sure how to initialize such an array or store information. Say I have the following data 0 connects 1 2 connects 3 4 connects 5 ....etc up to a vast amount of random connections and I want to insert true(1) into [0][1], true(1) into [2][3], true(1) into [4][5]. Can the array automatically update the column/rows for me Any help is appreciated thanks

    Read the article

  • C++ boost thread reusing threads

    - by aaa
    hi. I am trying to accomplish something like this: thread t; // create/initialize thread t.launch(); // launch thread. t.wait(); // wait t.launch(); // relaunch the same thread How to go about implementing something like this using boost threads? in essence, I need persistent relaunch-able thread. Thanks

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >