Search Results

Search found 4689 results on 188 pages for 'weak references'.

Page 15/188 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Work with function references

    - by Ockonal
    Hello, I have another one question about functions reference. For example, I have such definition: typedef boost::function<bool (Entity &handle)> behaviorRef; std::map< std::string, ptr_vector<behaviorRef> > eventAssociation; The first question is: how to insert values into such map object? I tried: eventAssociation.insert(std::pair< std::string, ptr_vector<behaviorRef> >(eventType, ptr_vector<behaviorRef>(callback))); But the error: no matching function for call to ‘boost::ptr_vector<boost::function<bool(Entity&)> >::push_back(Entity::behaviorRef&)’ And I undersatnd it, but can't make workable code. The second question is how to call such functions? For example, I have one object of behaviorRef, how to call it with boost::bind with passing my own values?

    Read the article

  • Two references to the same domain/entity model

    - by Sbossb
    Problem I want to save the attributes of a model that have changed when a user edits them. Here's what I want to do ... Retrieve edited view model Get domain model and map back updated value Call the update method on repository Get the "old" domain model and compare values of the fields Store the changed values (in JSON) into a table However I am having trouble with step number 4. It seems that the Entity Framework doesn't want to hit the database again to get the model with the old values. It just returns the same entity I have. Attempted Solutions I have tried using the Find() and the SingleOrDefault() methods, but they just return the model I currently have. Example Code private string ArchiveChanges(T updatedEntity) { //Here is the problem! //oldEntity is the same as updatedEntity T oldEntity = DbSet.SingleOrDefault(x => x.ID == updatedEntity.ID); Dictionary<string, object> changed = new Dictionary<string, object>(); foreach (var propertyInfo in typeof(T).GetProperties()) { var property = typeof(T).GetProperty(propertyInfo.Name); //Get the old value and the new value from the models var newValue = property.GetValue(updatedEntity, null); var oldValue = property.GetValue(oldEntity, null); //Check to see if the values are equal if (!object.Equals(newValue, oldValue)) { //Values have changed ... log it changed.Add(propertyInfo.Name, newValue); } } var ser = new System.Web.Script.Serialization.JavaScriptSerializer(); return ser.Serialize(changed); } public override void Update(T entityToUpdate) { //Do something with this string json = ArchiveChanges(entityToUpdate); entityToUpdate.AuditInfo.Updated = DateTime.Now; entityToUpdate.AuditInfo.UpdatedBy = Thread.CurrentPrincipal.Identity.Name; base.Update(entityToUpdate); }

    Read the article

  • Selecting rows with references across tables in SQLite 3

    - by ChristianK
    Hey there, I have a problem with a SQLite photo/album database. The database contains 3 tables: Albums id name hide -------------------------- 1 Holiday 2010 1 2 Day Trip 0 Photos id file ----------------- 1 photo1.jpg 2 photo2.jpg 3 photo3.jpg 4 photo4.jpg Relation (connects photos with albums) album photo ----------------- 1 1 1 2 2 3 2 1 A photo can be assigned to zero, one or several albums. Each album has a column 'hide' that indicates, whether the photos of this album should be ignored. I'm trying to find a SELECT query that returns all photos that are not assigned to an album + all the photos that are in albums which are not hidden (i.e. that have their 'hide' value set to 0). I came up with a query that selects photos in visible albums, but I don't know how to include the photos that are not assigned to an album. SELECT file FROM photos, albums, relation WHERE photos.id = relation.photo AND albums.id = relation.album AND albums.hide = 0 This query returns photo3.jpg and the required result would be photo3.jpg photo4.jpg because photo4.jpg is not assigned to album in the Relation table. Do you know how to solve this? Thank you very much for your help!

    Read the article

  • javascript, jQuery: how to save values instead of the references

    - by Patrick
    hi, I'm using the following lines to store the location of an object. var lightboxTop = $('#lightbox').css('top'); var lightboxLeft = $('#lightbox').css(' left'); I'm successively moving this object in my element, and I want to restore it previous position with the stored variables. But, I'm afraid javascript is saving the values by reference so I lose the initial positions. Am I correct ? How can I solve this ? thanks

    Read the article

  • @OrderBy: Sorting references

    - by Sven Moschel
    We have the following entity structure: @Entity public class SecurityRole { private List<Account> accounts; // ManyToMany } @Entity public class Account { private Employee owner; // OneToOne } @Entity public class Employee { private String lastName; } A security role can have many accounts. A account always has an employee. On the GUI we show the security roles in an mastertable. In the detail table we show the accounts of the role. To display the employee information we show "account.getOwner().getLastName()"; How can we use the @OrderBy annotation with this model? Is this possible? The problem is that the Account entity has no employee information that we can sort.

    Read the article

  • Javascript jQuery .click() callback references local variable from the calling method instead of cop

    - by Eric Freese
    The following jQuery Javascript code is included on an otherwise empty page. $(function() { for (var i = 0; i < 10; i++) { element = $('<div>' + i + '</div>'); element.click(function() { alert(i); }); $('body').append(element); } }); The desired behavior is that this code should generate 10 div elements numbered from 0 to 9. When you click on a div element, an alert popup will show the number of the div element you clicked on (i.e. if a user clicks on the div element labeled '4', the alert popup should show the number 4). The alert popup instead shows the number 10 regardless of which div element is clicked on. How can I modify this code to make it behave in the desired way?

    Read the article

  • Web Site in solution where "Rebuild Solution" compile succeeds cannot launch debugger

    - by fordareh
    I have a solution that includes a Web Site (created using the web site template not the web app project template - converting isn't an option, btw). When I rebuild all, the compile succeeds, but strangely displays 3 errors, all of which are "Could not get dependencies for project reference 'PROJNAME'". When I try to launch the debugger, I get the "There were build errors." dialogue. Two questions: If I choose the 'Yes' option in the debug error dialogue to run the last successful build, will it run on the code that my Rebuild All just compiled? How do I resolve this issue? I checked this post and am disheartened by my prospects. What is strange, though, is that I added these same projects to a separate web site solution that compiled/debugged fine, removed the test web site and re-added the target website I would like to debug, and it failed in the same manner. Is there a secret web site .proj file for .NET web sites? http://stackoverflow.com/questions/863379/could-not-get-dependencies-for-project-reference

    Read the article

  • Are there gotchas using varargs with reference parameters

    - by Roddy
    I have this piece of code (summarized)... AnsiString working(AnsiString format,...) { va_list argptr; AnsiString buff; va_start(argptr, format); buff.vprintf(format.c_str(), argptr); va_end(argptr); return buff; } And, on the basis that pass by reference is preferred where possible, I changed it thusly. AnsiString broken(const AnsiString &format,...) { ... the rest, totally identical ... } My calling code is like this:- AnsiString s1, s2; s1 = working("Hello %s", "World"); s2 = broken("Hello %s", "World"); But, s1 contains "Hello World", while s2 has "Hello (null)". I think this is due to the way va_start works, but I'm not exactly sure what's going on.

    Read the article

  • VS2010 converted project invalid reference

    - by Nathan
    Opening a .Net 2 project in VS2010 it converts the project without any issues BUT when I attempt to build it fails. The reason is that in VS2005 a reference was added to System.Web.Extensions which is a .Net 3.5 assembly. Now VS2005 never complained at this and quite happily worked but VS2010 is far more strict and won't allow it. I've tried changing the targeted framework to .Net 3.5 but I get another situation there where the web page is never displayed, it simply hangs not even getting to Applicatin_OnStart. Any help either on adding the reference with .Net 2 as target framework (prefered option for time) or getting the .Net 3.5 version to work would be greatly appreciated.

    Read the article

  • Convert "this" to a reference-to-pointer

    - by Austin Hyde
    Just stumbled onto this problem. (title says it all) Let's say I have a struct struct Foo { void bar () { do_baz(this); } void do_baz(Foo*& pFoo) { pFoo->p_sub_foo = new Foo; // for example } Foo* p_sub_foo; } GCC tells me that temp.cpp: In member function ‘void Foo::bar()’: temp.cpp:3: error: no matching function for call to ‘Foo::do_baz(Foo* const)’ temp.cpp:5: note: candidates are: void Foo::do_baz(Foo*&) So, how do I convert what is apparently a const Foo* to a Foo*&?

    Read the article

  • reference suggestion in latex windows (multi-file structure)

    - by voodoomsr
    There is some editor of latex that managed the labels for a multifile document?. I tried with TexMaker and LED, and they offers me suggestions about the labels present in the actual document and in the "Master" document but not the labels present in other files of the structure. I made a script to find those other labels but it will be real good that the suggestions covers all the file structure automatically. Finally i tried with Vim and Latex-Suite, this extension has that posibility but i have problem configuring the grep program despite having followed all the instructions found in their website and in the help files, :(. the structure is like this: document.tex mystyle.sty mybibliography.bib tex/file1.tex tex/file2.tex tex/... img/img1.png img/img2.png . . .

    Read the article

  • Reference-type conversion operators: asking for trouble?

    - by Ben
    When I compile the following code using g++ class A {}; void foo(A&) {} int main() { foo(A()); return 0; } I get the following error messages: > g++ test.cpp -o test test.cpp: In function ‘int main()’: test.cpp:10: error: invalid initialization of non-const reference of type ‘A&’ from a temporary of type ‘A’ test.cpp:6: error: in passing argument 1 of ‘void foo(A&)’ After some reflection, these errors make plenty of sense to me. A() is just a temporary value, not an assignable location on the stack, so it wouldn't seem to have an address. If it doesn't have an address, then I can't hold a reference to it. Okay, fine. But wait! If I add the following conversion operator to the class A class A { public: operator A&() { return *this; } }; then all is well! My question is whether this even remotely safe. What exactly does this point to when A() is constructed as a temporary value? I am given some confidence by the fact that void foo(const A&) {} can accept temporary values according to g++ and all other compilers I've used. The const keyword can always be cast away, so it would surprise me if there were any actual semantic differences between a const A& parameter and an A& parameter. So I guess that's another way of asking my question: why is a const reference to a temporary value considered safe by the compiler whereas a non-const reference is not?

    Read the article

  • Requiring library consumers reference additional assembly when using certain types

    - by Thomas G. Mayfield
    I have library code that uses ICSharpCode.SharpZipLib under the hood to make it easy to use ZIP files as data sources when running integration tests. As it stands, if I reference my library from another project, the other project will compile just fine, but when it accesses the code that uses SharpZipLib, I get an exception for it not finding the zip library: failed: System.IO.FileNotFoundException : Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified. If the types in my library derived from a class in SharpZipLib, it'd generate a compile error CS0012. What other ways are there for triggering a CS0012, so that using code that requires SharpZipLib (but doesn't clearly indicate it) would cause consumer code to fail compilation? I've had similar problems in the past when I've used libraries like DeftTech.DuckTyping under the hood. I'd add my library code to a new project, start working, compile, run, and then suddenly hit an edge case that I'd used duck typing to get around and get a runtime error. What I'd most like is to have the same behavior as if I'd derived from a type in the 3rd-party library, so that a reference to my derived type generates a CS0012: The type 'type' is defined in an assembly that is not referenced. You must add a reference to assembly 'assembly'.

    Read the article

  • C# Reset a property

    - by Jeff
    I'm writing a Clone function for a non serializeable object.For most objects I don't care if they are shallow copied as I won't be making any changes to them. I start with a MemberwiseClone and this copies all the values and few objects like configuration dictionary over just fine but they are pointers. EAVEntity newClone = (EAVEntity) this.MemberwiseClone(); newClone.EntityStorageID = Guid.NewGuid(); newClone.Controls.Clear(); So how do I reset a pointer so I can make them not point at the same location?

    Read the article

  • System.Design cannot be referenced in Class Library?

    - by Alex Yeung
    Hi all, I have a very strange problem that I cannot fix and don't know what's going on... I am using VS 2010 Premium and .NET 4.0. Here are my steps to simulate the problem. Step 1. Create a new VB class library project named "MyClassLib" Step 2. Create a new class named "MyTestingClass". Public Class MyTestingClass Inherits System.ComponentModel.Design.CollectionEditor Public Sub New() MyBase.New(GetType(List(Of String))) End Sub End Class Step 3. Add two .net reference. "System.Design" and "System.Drawing". Step 4. Create a new VB console application named "MyClassExe" Step 5. Add "MyClassLib" reference to "MyClassExe". Step 6. Open Module1.vb in "MyClassExe" project Step 7. In the Main method, type Dim a = New MyClassLib.MyTestingClass() Step 8. Try to compile "MyClassLib". It doesn't have problem. Step 9. Try to compile "MyClassExe". It cannot compile because the WHOLE MyClassLib cannot be found!!! I have no idea what's going on? Moreover, the same case happens in C#. Does anyone know what's the problem with "System.Design"? Thank!!!

    Read the article

  • Compiling .NET component that uses a non specific required version of a 3rd Party Vendor component

    - by Dan
    If someone were to develop a .NET component that relied on non specific versions of a vendor DLL - let's say it worked with My3rdPartyComponent.dll which is a .NET assembly, but it didn't matter which version. Some instances of classes found in this component would need to be passed into my component. Developers would reference my component dll but not have access to the source code. Basically, I want to be able to require the user to pass in an instance of 3rdPartyComponent.MyClass to my component functions but I do not care if it's version 1.1, 2.2, 2.23.980, etc of the 3rd party dll. Is there a way to do this while still typing the parameter I want to be passed in to my component? I don't want to use Object as the reference. In my component project I could specify SpecificVersion=True on the assembly reference. Will this solve my problem or will there be other 'dll hell' issues to deal with that I am not seeing?

    Read the article

  • Using different versions of the same assembly in the same folder

    - by Hemanshu Bhojak
    I have the following situation Project A - Uses Castle Windsor v2.2 - Uses Project B via WindsorContainer Project B - Uses NHibernate - Uses Castle Windsor v2.1 In the bin folder of Project A I have the dll Castle.DynamicProxy2.dll v2.2 and NHibernate dlls. Now the problem is that NHibernate is dependent on Castle.DynamicProxy2.dll v2.1 which is not there. How do I resolve this situation.

    Read the article

  • warning: returning reference to temporary

    - by Jack
    I have a function like this const string &SomeClass::Foo(int Value) { if (Value < 0 or Value > 10) return ""; else return SomeClass::StaticMember[i]; } I get warning: returning reference to temporary. Why is that? I thought the both values the function returns (reference to const char* "" and reference to a static member) cannot be temporary.

    Read the article

  • pointer and reference question (linked lists)

    - by sil3nt
    Hi there, I have the following code struct Node { int accnumber; float balance; Node *next; }; Node *A, *B; int main() { A = NULL; B = NULL; AddNode(A, 123, 99.87); AddNode(B, 789, 52.64); etc… } void AddNode(Node * & listpointer, int a, float b) { // add a new node to the FRONT of the list Node *temp; temp = new Node; temp->accnumber = a; temp->balance = b; temp->next = listpointer; listpointer = temp; } in this here void AddNode(Node * & listpointer, int a, float b) { what does *& listpointer mean exactly.

    Read the article

  • Tutorials/Books on using Mono to develop RESTful webservices?

    - by max
    Hi, anyone out there got any pointers to good links/tutorials/books on developing webservices with Mono? In more detail, I am interested in using Mono from project start on a Linux host developing in C# using Visual Studio for development, ideally with remote debugging if that is realistic developing web-services in MONO accessible in a RESTful manner, returning JSON hiding the services processes behind an Apache access the services either via javascript/AJAX or from a thin script layer written in PHP scalability is important for me unit-testing of webservices Any recommendations for material I could sift through to get a good head-start? I might add that I'm C#/.NET savvy, but not in the context of web development. I've been using it since it came out, but mainly for internal server-client applications where the clients were Windows desktop apps and the communication layer was remoting or, sometimes, more low-level socket-based. Thanks, max

    Read the article

  • Why does it work

    - by A-ha
    Guys I've asked few days ago a question and didn't have really time to check it and think about it, but now I've tried one of the solutions and I can't understand why does it work? I mean why destructor is called at the end of line like this: #include "stdafx.h" #include "coutn.h" #define coutn coutn() int _tmain(int argc, _TCHAR* argv[]) { coutn << "Line one " << 1;//WHY DTOR IS CALLED HERE coutn << "Line two " << " and some text."; return 0; } I assume that it has something to do with lifetime of an object but I'm not sure what and how. As I think of it there are two unnamed objects created but they do not go out of scope so I can't understand for what reason is dtor called. Thank you.

    Read the article

  • Only variables can be passed by reference

    - by zaf
    I had the bright idea of using a custom error handler which led me down a rabbit hole. Following code gives (with and without custom error handler): Fatal error: Only variables can be passed by reference function foo(){ $b=array_pop(array("a","b","c")); return $b; } print_r(foo()); Following code gives (only with a custom error handler): (2048) Only variables should be passed by reference function foo(){ $a=explode( '/' , 'a/b/c'); $c=array_pop(array_slice($a,-2,1)); return $c; } print_r(foo()); The second one worries me since I have a lot of 'compact' code. So, I either ditch the bright idea of using a custom error handler (to improve my logging module) or expand all my code. Anyone with better ideas? Also, WTF?

    Read the article

  • GetRef to capture methods?

    - by Thom Smith
    I've just discovered VBScript's GetRef function, which gets a reference to the function named by its argument. Is there any way to get a reference to a method in this way? I have a hunch that VBScript doesn't offer the sophistication of binding needed to do so, but it would sure be nice.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >