Search Results

Search found 4206 results on 169 pages for 'equals operator'.

Page 91/169 | < Previous Page | 87 88 89 90 91 92 93 94 95 96 97 98  | Next Page >

  • Heap Behavior in C++

    - by wowus
    Is there anything wrong with the optimization of overloading the global operator new to round up all allocations to the next power of two? Theoretically, this would lower fragmentation at the cost of higher worst-case memory consumption, but does the OS already have redundant behavior with this technique, or does it do its best to conserve memory? Basically, given that memory usage isn't as much of an issue as performance, should I do this?

    Read the article

  • VB.NET SqlException Was Unhandled

    - by Daniel
    I am trying some SQL code but I get an error when I try this code. Main.database.ExecuteCommand("UPDATE Contacts SET first_name='" + c.first_name + _ "', middle='" + c.middle + _ "', last_name='" + c.last_name + _ "', age='" + c.age + _ "', mobile_phone='" + c.mobile_phone + _ "', home_phone='" + c.home_phone + _ "', work_phone='" + c.work_phone + _ "', home_street='" + c.home_street + _ "', home_city='" + c.home_city + _ "', home_state='" + c.home_state + _ "', home_zip='" + c.home_zip + _ "', work_street='" + c.work_street + _ "', work_city='" + c.work_city + _ "', work_state='" + c.work_state + _ "', work_zip='" + c.work_zip + _ "', home_www='" + c.home_www + _ "', work_www='" + c.work_www + _ "', home_email='" + c.home_email + _ "', work_email='" + c.work_email + _ "' WHERE first_name='" + c.first_name + _ "' AND last_name='" + c.last_name + "'") I get the following error Sql Exception was unhandled The data types text and varchar are incompatible in the equal to operator.

    Read the article

  • Javascript: find array by name

    - by Kin
    Hi, I have some js arrays and I want to find the arrays by name. for example: arr1 = [1,2,3]; arr2 = [3,4,5]; And access them like this: var intNum = 2; var arrName = 'arr' + intNum; arrName[0]; // equals 3 Is this possible? Thanks, Kevin

    Read the article

  • boost::function function pointer to parameters?

    - by high6
    How does boost::function take a function pointer and get parameters from it? I want wrap a function pointer so that it can be validated before being called. And it would be nice to be able to call it like boost::function is with the () operator and not having to access the function pointer member. Wrapper func; func(5); //Yes :D func.Ptr(5) //Easy to do, but not as nice looking

    Read the article

  • VBA: Validate List settings

    - by stanigator
    Sub Macro1() ' ' Macro1 Macro ' ' Worksheets("Drop-down").Select For i = 1 To 10 ActiveSheet.Cells(i, 2).Select With Selection.Validation .Delete ' Error in this line .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:=Range(Worksheets("Misc").Cells(2, i), Worksheets("Misc").Cells(2, i).End) .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Next i End Sub I'm getting an error in the line below the comment, yet I don't know how to fix it. It would be great to hear some suggestions. Thanks in advance!

    Read the article

  • what is size_t in C

    - by benjamin button
    Hi, i am getting confused with size_t in C. i know that it is returned by a sizeof operator. But what exactly it is?Is it a datatype? let's say i have a for loop int i; or size_t i;//which one should i use? for(i=0;i<some_size;i++)

    Read the article

  • How to use Groovy Set for unique elements?

    - by Guy
    As simple as this must be I still can't understand where am I wrong: class A { boolean equals(o) { true } } def s = [new A(), new A()] as Set assert s.size() == 1 // Assertion failed: actually gives 2 Which method should I override in order to get uniqueness?

    Read the article

  • Perl, foreach order

    - by Mike
    Does Perl's foreach loop operator require that the list items be presented in order? For example my @a=(1,2,3); foreach my $item (@a) { print $item; } will always print 1 2 3? I suspect so, but I can't find it documented.

    Read the article

  • LINQ TO SQL, Dynamic query with DATE type fields

    - by acanthus
    Hello, I'm building a query with the LINQ dynamic library so I don't know how many potential parameters will I have and I get an error when trying to query DATE type fields: Operator '=' incompatible with operand types 'DateTime' and 'String' When I step through the debugger in the Dynamic.cs it shows that the value is of type string and the field is of type date so the problem is obvious but I have no idea how to approach it. Any ideas? BR

    Read the article

  • Assign a list of integers to an @var

    - by justSteve
    I can: declare @idOrder int set @idOrder = 21319 I want: declare @idOrder int set @idOrder = (21319, 21320) for use in a series of statements where the 'WHERE' clause uses the IN operator delete Orders where idOrder in @idOrder instead of delete Orders where idOrder in (21319, 21320)

    Read the article

  • Counting comma seperated values in php,how to?

    - by Jay
    Hey folks, I have a variable holding values separated by a comma (Implode), I'm trying to get the total count of the values in that variable however, count() is just returning 1. I've tried converting the comma separated values to a properly formatted array which still spits out1. So heres the quick snippet where the sarray session equals to value1,value2,value3: $schools = $_SESSION['sarray']; $result = count($schools); Any help would be appreciated.

    Read the article

  • C++ std::vector capacity

    - by aaa
    hi. does vector::operator= change vector capacity? if so, how? does copy constructor copy capacity? I looked through documentation but could not find specific answer. is it implementation dependent? Thanks

    Read the article

  • [game] How is it possible to legally write ::: in C++ and ??? in C#?

    - by daveny
    These questions are a kind of game, and I did not find the solution for them. It is possible to write ::: in C++ without using quotes or anything like this and the compiler will accept it (macros are prohibited too). And the same is true for C# too, but in C#, you have to write ???. I think C++ will use the :: scope operator and C# will use ? : , but I do not know the answers to them. Any idea?

    Read the article

  • Parallel computation of the median of a large array

    - by recipriversexclusion
    I got asked this question once and still haven't been able to figure it out: You have an array of N integers, where N is large, say, a billion. You want to calculate the median value of this array. Assume you have m+1 machines (m workers, one master) to distribute the job to. How would you go about doing this? Since the median is a nonlinear operator, you can't just find the median in each machine and then take the median of those values.

    Read the article

  • error with linq join

    - by Luca Romagnoli
    I have this linq query: var segreterie = from s in db.USR_Utenti join h in db.USR_Accounts on new {s.ID, settings.GruppoSegreteria} equals new {h.USR_UtentiReference,h.ID_Gruppo} select s; that has this problem: The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'. how can i do to solve it?

    Read the article

  • [C++ / NCURSES] Can't convert from 'int' to 'int *'

    - by flarn2006
    So I have these lines of code: int maxY, maxX; getmaxyx(stdscr, &maxY, &maxX); It gives me the following error: error C2440: '=' : cannot convert from 'int' to 'int *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast twice for each time I use it. I'm not even using the = operator! The curses.h file is included. What am I doing wrong?

    Read the article

  • Object value not getting updated in the database using hibernate

    - by user1662917
    I am using Spring,hibernate,jsf with jquery in my application. I am inserting a Question object in the database through the hibernate save query . The question object contains id ,question,answertype and reference to a form object using form_id. Now I want to alter the values of Question object stored in the database by altering the value stored in the list of Question objects at the specified index position. If I alter the value in the list the value in the database is not getting altered by update query . Could you please advise. Question.java package com.otv.model; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.apache.commons.lang.builder.ToStringBuilder; @Entity @Table(name = "questions") public class Question implements Serializable { @Id @GeneratedValue @Column(name = "id", unique = true, nullable = false) private int id; @Column(name = "question", nullable = false) private String text; @Column(name = "answertype", nullable = false) private String answertype; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "form_id") private Form form; // @JoinColumn(name = "form_id") // private int formId; public Question() { } public Question(String text, String answertype) { this.text = text; this.answertype = answertype; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getQuestion() { return text; } public void setQuestion(String question) { this.text = question; } public String getAnswertype() { return answertype; } public void setAnswertype(String answertype) { this.answertype = answertype; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((answertype == null) ? 0 : answertype.hashCode()); result = prime * result + id; result = prime * result + ((text == null) ? 0 : text.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Question other = (Question) obj; if (answertype == null) { if (other.answertype != null) return false; } else if (!answertype.equals(other.answertype)) return false; if (id != other.id) return false; if (text == null) { if (other.text != null) return false; } else if (!text.equals(other.text)) return false; return true; } public void setForm(Form form) { this.form = form; } @Override public String toString() { return ToStringBuilder.reflectionToString(this); } } Form.java package com.otv.model; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import org.apache.commons.lang.builder.ToStringBuilder; @Entity @Table(name = "FORM") public class Form implements Serializable { @Id @GeneratedValue @Column(name = "id", unique = true, nullable = false) private int id; @Column(name = "name", nullable = false) private String name; @Column(name = "description", nullable = false) private String description; @OneToMany(mappedBy = "form", fetch = FetchType.EAGER, cascade = CascadeType.ALL) List<Question> questions = new ArrayList<Question>(); public Form(String name) { super(); this.name = name; } public Form() { super(); } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public List<Question> getQuestions() { return questions; } public void setQuestions(List<Question> formQuestions) { this.questions = formQuestions; } public void addQuestion(Question question) { questions.add(question); question.setForm(this); } public void removeQuestion(Question question) { questions.remove(question); question.setForm(this); } @Override public String toString() { return ToStringBuilder.reflectionToString(this); } public void replaceQuestion(int index, Question question) { Question prevQuestion = questions.get(index); // prevQuestion.setQuestion(question.getQuestion()); // prevQuestion.setAnswertype(question.getAnswertype()); question.setId(prevQuestion.getId()); question.setForm(this); questions.set(index, question); } } QuestionDAO.java package com.otv.user.dao; import java.util.List; import org.hibernate.SessionFactory; import com.otv.model.Question; public class QuestionDAO implements IQuestionDAO { private SessionFactory sessionFactory; public SessionFactory getSessionFactory() { return sessionFactory; } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } public void addQuestion(Question question) { getSessionFactory().getCurrentSession().save(question); } public void deleteQuestion(Question question) { getSessionFactory().getCurrentSession().delete(question); } public void updateQuestion(Question question) { getSessionFactory().getCurrentSession().update(question); } public Question getQuestionById(int id) { List list = getSessionFactory().getCurrentSession().createQuery("from Questions where id=?") .setParameter(0, id).list(); return (Question) list.get(0); } }

    Read the article

  • #define and how to use them - C++

    - by ML
    Hi All, in a pre-compiled header if I do: #define DS_BUILD #define PGE_BUILD #define DEMO then in source I do: #if (DS_BUILD && DEMO) ---- code--- #elif (PGE_BUILD && DEMO) --- code--- #else --- code --- #endif Do I get an error that states: error: operator '&&' has no right operand I have never seen this before. I am using XCode 3.2, GCC 4.2 on OS X 10.6.3

    Read the article

  • Features to remove from C++

    - by Justin Ethier
    This question was inspired by What features would you like to see added to C++? (also see What features do you miss in C++?). C++ is a great general-purpose language, but perhaps too general and feature-rich: multiple inheritance, operator overloading, manual memory management, templates, smart pointers, virtual destructors, legacy frameworks (think MFC), and I could go on. Is there any one feature or aspect of C++ that you would like removed to make our lives easier as C++ developers? One feature per answer, please.

    Read the article

  • why use the "!!!"?

    - by lazyanno
    as follow codes: var a = {}; if(!!!a[tabType]){ a[tabType] = []; a[tabType].push([self,boxObj]); }else{ a[tabType].push([self,boxObj]); } i think !!!a[tabType] equals !a[tabType] why use the "!!!" not "!" ? thank you!

    Read the article

  • Remove Item From Object SubList (LINQ)

    - by X3074861X
    I have an object that looks like this : public class Consortium { public string Id { get; set; } [JsonConverter(typeof(EnumDescriptionConverter))] public SourceType Type { get; set; } public List<UserLibrary> Branches { get; set; } } Each Consortium has a list of UserLibrary's associated with it, and that class looks like this : public class UserLibrary { public string LibraryId { get; set; } public string RetailerId {get; set;} public string UserId { get; set; } public string Name { get; set; } public DateTime CreatedAt { get; set; } } I have a method which will allow the user to remove a library from one of their consortium (note: There may be many branches associated to the consortium). However, I'm only being supplied a LibraryId, so I'm forced to traverse their list of Consortium, find which one contains the given id, then iterate over the branches and remove the one that matches the id. Here is how I'm currently accomplishing this : // Get the current list of consortiums var user = _mediator.Send(new GetUserProfileCommand { UserProfileId = _principle.UserProfileId }); var userConsortia = user.SavedConsortia; // the consortium to remove the library from var branchToRemove = _libraryService.GetLibrary(id); var consortRemove = new UserConsortium(); foreach (var userConsortium in userConsortia) { if (userConsortium.Branches.FirstOrDefault(c => string.Equals(c.LibraryId, id, StringComparison.OrdinalIgnoreCase)) != null) { consortRemove = userConsortium; } } // if the consortium id is null, something is f* if (consortRemove.Id == null) { return new JsonDotNetResult(HttpStatusCode.BadRequest); } // first remove the consortia userConsortia.Remove(consortRemove); // remove the branch from the consortium consortRemove.Branches.RemoveAll(ul => string.Equals(ul.LibraryId, id, StringComparison.OrdinalIgnoreCase)); // add it back in without the branch userConsortia.Add(consortRemove); Question : Is there a LINQ expression I'm missing here that can help me consolidate this logic, or is there a better way of doing this?

    Read the article

< Previous Page | 87 88 89 90 91 92 93 94 95 96 97 98  | Next Page >