Search Results

Search found 15081 results on 604 pages for 'passing by reference'.

Page 159/604 | < Previous Page | 155 156 157 158 159 160 161 162 163 164 165 166  | Next Page >

  • how to access a firefox extension variable from the current document/window

    - by bosky101
    my firefox extension has an object myExt . myExt = { request: function(){ //makes request to server}, callback: function(json) { //do something with this } }; From a dynamically added script element, I make a call to a server that returns json, i want the json to be sent to myExt.callback that exists within my extension's js code. //from my extension, i add a script element myExt.request(); //from server i get the following response myExt.callback ( {"some":"json"}) ; //but the window doesnt find a reference to myExt how do i make a reference to myExt variable from the webpage ?

    Read the article

  • How can I make a read-only ObservableCollection property?

    - by thrag
    I'd like to expose a property on a view model that contains a list of objects (from database). I need this collection to be read-only. That is, I want to prevent Add/Remove, etc. But allow the foreach and indexers to work. My intent is to declare a private field holding the editable collection and reference it with a read-only Public Property. As follows public ObservableCollection<foo> CollectionOfFoo { get { return _CollectionOfFoo; } } However, that syntax just prevents changing the reference to the collection. It doesn't prevent add/remove, etc. What is the right way to accomplish this?

    Read the article

  • Importing libraries in eclipse programmatically

    - by Krt_Malta
    Hi, Is there a way I could put a library (Jar file) into an Eclipse project programatically? Up to now I've managed to do an external reference to it programatically using IPath path = new Path("C:\\Hello\\jtwitter.jar"); libraries.add(JavaCore.newLibraryEntry(path, null, null)); //add libs to project class path try { javaProject.setRawClasspath(libraries.toArray(new IClasspathEntry[libraries.size()]), null); } catch (JavaModelException e1) { e1.printStackTrace(); } } however I'd like to copy the jtwitter file to the project folder programatically so I could reference it as jtwitter.jar only. Can this be done please? Thanks a lot and regards, Krt_Malta

    Read the article

  • Does NAT change the source MAC address?

    - by user44073
    I'm trying to secure my home network but don't really need the complexity of a VPN so I'm trying to figure out other options. I'd like to allow my iPhone remote access to my home servers but I can't depend on the IP address because it changes quite often (due to the 3G network, etc). Can I filter incoming connections on my router (pfsense) by MAC address or does NAT change the source as it's passing through the different routers on the internet?

    Read the article

  • How can unit testing make parameter validation redundant?

    - by Johann Gerell
    We have a convention to validate all parameters of constructors and public functions/methods. For mandatory parameters of reference type, we mainly check for non-null and that's the chief validation in constructors, where we set up mandatory dependencies of the type. The number one reason why we do this is to catch that error early and not get a null reference exception a few hours down the line without knowing where or when the faulty parameter was introduced. As we start transitioning to more and more TDD, some team members feel the validation is redundant. Uncle Bob, who is a vocal advocate of TDD, strongly advices against doing parameter validation. His main argument seems to be "I have a suite of unit tests that makes sure everything works". But I can for the life of it just not see in what way unit tests can prevent our developers from calling these methods with bad parameters in production code. Please, unit testers out there, if you could explain this to me in a rational way with concrete examples, I'd be more than happy to seize this parameter validation!

    Read the article

  • that, self or me — which one to prefer in JavaScript?

    - by Török Gábor
    While coding JavaScript sometimes you store the reference of object this in a local variable for different purposes (to set proper scope, to help code obfuscators, etc.). There are coders who prefer aliasing this to that to make it obvious its intention. Other guys use self since it's pointing to the object itself. I even saw source codes where me held the reference and it still makes sense. Certainly there are other ones. Which one should I prefer? Is there a convention on which to use or is it only the matter of taste.

    Read the article

  • Creating full, global clang+llvm environment

    - by Griwes
    What is the easiest way to setup full Clang, libc++ and LLVM as default global toolchain? All of my attempts to build it, in most of the configurations I could think of, resulted in working Clang, but it didn't use libc++ headers, but default GCC's libstd++'s ones, resulting in numerous faults in incompatible pieces of library code. I would like it working out of the box, without having to do magic in .bashrc or passing all those -stdlib=libc++ and -lc++ to compiler and linker.

    Read the article

  • C++11/14 and return( ... ) vs return

    - by user2485710
    In C++ you are allowed to write a return statement that looks like : return ( ... ); which is different from the more popular : return ... ; In particular the first version returns the address/reference of something that is local to the stack of the function which contains that return statement. Now why something would like to return a reference to something that, at that point, has no lifetime ? What are the use case for this idiom ? Considering the new buzzword and features from C++11 and C++14 there is a different usage for this ?

    Read the article

  • Med-PC Programing Language

    - by mknuii
    There's this programing language called Med-PC that works with animal behavior. I'm trying to learn a bit about it, but i can't seem to find any kind of books or material about it. I've "google it" but all i seem to find are some references about it and a PDF explaining the installing of the program itself and sensors(for the experiments), not actual programing instructions. I'm looking for some kind of guidance, documents or books, some kind of reference where i can improve and learn about this language, or if it is based on some other language. I just need some reference about it. So i've resorted to StackOverFlow to see if anybody has worked, knows about it or can point me some links/books about it.

    Read the article

  • Javascript : where are high level data structures?

    - by user355056
    Hi! I'm writing a client program for a game in Javascript but I'm new in Javascript world. Core Javascript lack of high level data structures. I've found code snippets on internet but I'm looking for a reference library (like commons-collection or google-collection in java world). I found this post: http://stackoverflow.com/questions/2523436/javascript-implementation-of-a-set-data-structure which refers to jshashtable and closure. Are they reference implementations? Do you know something else? Thanks

    Read the article

  • Javascript looping only through defined properties of array. How?

    - by Beck
    For example if i'm keeping array of references via id like that: if(typeof channel_boards[misc.channel_id] == 'undefined') { channel_boards[misc.channel_id] = $('<div class="channel" channel_id="'+misc.channel_id+'"></div>').appendTo('#board'); } And then i'm looping through array to find required reference. I'm looping through undefined properties as well. Is it possible to loop only through defined properties? for(i=0;i<channel_boards.length;i++) { if(channel_boards[i] != undefined) { if(channel_boards[i].attr('channel_id') != visible) {channel_boards[i].addClass('hidden_board');} else {channel_boards[i].removeClass('hidden_board');} } } Maybe i should change the way i'm storing references? Via object for example, but how i'll be able to find proper reference via id number.

    Read the article

  • how to debug a WCF service once it's out of dev env

    - by ffc
    hi, I have a WCF service that i've been able to communicate with fine while it's hosted locally. I have it deployed to a web server in IIS now, and I can get the wsdl file without error by navigating to http://site.com:8000/service/servicename.svc?wsdl in trying to test this, i've created a console app and was able to successfully add a service reference to this. But when I try to run a Get() method on the service reference, it just hangs with no response. How can I begin to debug this? Thanks!

    Read the article

  • java-maven2: How to include the a jar as depedency in pom so that I will be able to access test clas

    - by flavour-of-bru
    Hi, I have a set of functional jars(more than 3) that tests my source code. These jars just contains test classes and assisting asserter classes. I am creating a new performance jar that would import all the functional tests from these jars so that all can be run simultaneously. But when I include them as test dependencies in pom of current jar, what all I get to see is the classes in src/main/java. How can I include these functional jars as dependent jars so that I can also reference classes in src/test/java. In other words, how do I reference the test classes in other jars. In what way should I include the dependency as. Thanks for your support.

    Read the article

  • Check constraint on table lookup

    - by bzamfir
    Hi, I have a table, department , with several bit fields to indicate department types One is Warehouse (when true, indicate the department is warehouse) And I have another table, ManagersForWarehouses with following structure: ID autoinc WarehouseID int (foreign key reference DepartmentID from departments) ManagerID int (foreign key reference EmployeeID from employees) StartDate EndDate To set new manager for warehouse, I insert in this table with EndDate null, and I have a trigger that sets EndDate for previous record for that warehouse = StartDate for new manager, so a single manager appears for a warehouse at a certain time. I want to add two check constraints as follows, but not sure how to do this do not allow to insert into ManagersForWarehouses if WarehouseID is not marked as warehouse Do not allow to uncheck Warehouse if there are records in ManagersForWarehouses Thanks

    Read the article

  • "Dereference" var in C#

    - by chris12892
    I have some code in C# that uses a structure as such: ArrayList addrs = new ArrayList(); byte[] addr = new byte[8]; while (oneWire.Search_GetNextDevice(addr)) { addrs.Add(addr); } In this example, every element in the ArrayList is the same as the last device that was found because it would appear as though addr is passed out by reference and I am simply copying that reference into the ArrayList. Is there any way to "Dereference" addr to only extract it's value? It's also possible my assessment of the situation is incorrect, if that appears to be the case, please let me know Thanks!

    Read the article

  • Flex: Problem with CollectionEvent on ArrayCollection

    - by dasnervtdoch
    Hi there, got a reference to an arrayCollection and add event listener like this: collection.addEventListener(CollectionEvent.COLLECTION_CHANGE, onCollectionChange); that´s fine. Now some other component does have the same reference and is adding items to and removing items from that collection. Each time the handler is called: private function onProjectPersonsChange(event:Event):void { if (event.kind == CollectionEventKind.ADD) { //do something } else if (event.kind == CollectionEventKind.REMOVE) { //do something //here is the problem: event.items.length = 0 } else { trace('CollectionEvent: kind not handled!'); } } Does somebody know why the removed item is not in 'items'? Thanks in advance!

    Read the article

  • Creating objects and referencing before saving object to db

    - by Flexo
    Sorry about the vague title, but i didnt know how to ask the question in one line :) I have an order with nested itemgroups that again have nested items. the user specify the amount of item that he would like to have in each itemgroup. I would like to create these items in the create method of the orders controller when the order itself is being created. I kinda have 2 problems here. First, how do i set the reference of the items, or better yet, put the items into the @order object so they are saved when the @order is saved? the items are being stored in the db as the code is now, but the reference is not set because the order is not stored in the db yet so it doesnt have an id yet. Second, im not sure im using the correct way to get the id from my itemgroup. @order = Order.new(params[:order]) @order.itemgroups.each do |f| f.amount.times do @item = Item.new() @item.itemgroup_id = f.id @item.save end end

    Read the article

  • Iphone UI Size / Layout Resource?

    - by blindJesse
    Is anyone aware of a website or download to reference for the size of UI elements or standard iphone interface stuff? What I mean is something that gives the height of elements like the status bar, tab bar, navigation bar, default tableviewcell height (and such things as width of accessory view, indentation, etc), default icon sizes, default font sizes for UI elements (if they need to be mimicked, for instance), etc etc etc. It's amazing how many times I have to go back to find a reference or estimate the size and position of a standard element. It seems like it would be an invaluable resource that could fit on a printed page or two.

    Read the article

  • Singleton wrapper for Context

    - by kpdvx
    I'm considering creating a singleton wrapper for a Context so my model objects, if necessary, can open and read from a database connection. My model objects do not have access to a Context, and I'd like to avoid needing to pass a reference to a Context from object to object. I was planning to place into this singleton a reference to the Context returned by Application.getApplicationContext(). This singleton object would be initialized in my custom Application instance before anything else would need to or have a chance to use it. Can anyone think of a reason to not do this?

    Read the article

  • Initializing a value through a Session variable

    - by William Calleja
    I need to Initialize a value in a Javascript by using a c# literal that makes reference to a Session Variable. I am using the following code <script type="text/javascript" language="javascript" > var myIndex = <%= !((Session["myIndex"]).Equals(null)||(Session["myIndex"]).Equals("")) ? Session["backgroundIndex"] : "1" %>; However the code above is giving me a classic Object reference not set to an instance of an object. error. Why? Shouldn't (Session["myIndex"]).Equals(null) capture this particular error?

    Read the article

  • Iterating Through a jQuery Object Array

    - by DeltaFox
    I know this has been asked and answered a couple times already, but I'm still confused about how to reference the current object when iterating over a jQuery array. For example, the following code gives me the error "TypeError: genH3Array[i].next is not a function". What is the right way to reference the current array object? var genH3Array = $('#Generation_II').parent(); genH3Array.push($('#Generation_III').parent());; genH3Array.push($('#Generation_IV').parent()) $.each(genH3Array, function(i, value) { if(genH3Array[i].next().attr("align") == "center") { genH3Array[i].next().next().next().insertBefore(heading.next()) } genH3Array[i].next().next().insertBefore(heading.next()) genH3Array[i].next().insertBefore(heading.next()) })

    Read the article

< Previous Page | 155 156 157 158 159 160 161 162 163 164 165 166  | Next Page >