Search Results

Search found 34638 results on 1386 pages for 'linear linked list'.

Page 3/1386 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • System of linear equations in C++?

    - by Archagon
    I need to solve a system of linear equations in my program. Is there a simple linear algebra library for C++, preferably comprised of no more than a few headers? I've been looking for nearly an hour, and all the ones I found require messing around with Linux, compiling DLLs in MinGW, etc. etc. etc. (I'm using Visual Studio 2008.)

    Read the article

  • Java - How to find count of items in a list in another list

    - by David Buckley
    Say I have two lists: List<String>products = new ArrayList<String>(); products.add("computer"); products.add("phone"); products.add("mouse"); products.add("keyboard"); List<String>cart = new ArrayList<String>(); cart.add("phone"); cart.add("monitor"); I need to find how many items in the cart list exist in the products list. For the lists above, the answer would be 1 (as phone is in products and cart). If the cart list was: List<String>cart = new ArrayList<String>(); cart.add("desk"); cart.add("chair"); The result would be 0. If cart contained computer, mouse, desk, chair, the result would be 2 (for computer and mouse). Is there something in the Apache Commons Collections or the Google Collections API? I've looked through them and see ways to get a bag count, but not from another list, although it's possible I'm missing something. Right now, the only way I can think of is to iterate over the cart items and see if products contains the individual item and keep a count. I can't use containsAll as I need the count (not a boolean), and that would fail if all items in cart didn't exist in the product list (which can happen). I'm using Java 1.6 if that matters.

    Read the article

  • .net byte[] to List<List<Point>>

    - by user1112111
    Is is possible to convert a byte array back to a List<List<Point>> ? LE: I am saving the List<List<Point>> in a database BLOB field. When I retrieve it, I want to convert it back to a List<List<Point>>. So I have the byte[], but I cannot figure out how to convert it. How should the de/serialization look like ?

    Read the article

  • Python - List of Lists Slicing Behavior

    - by Dan Dobint
    When I define a list and try to change a single item like this: list_of_lists = [['a', 'a', 'a'], ['a', 'a', 'a'], ['a', 'a', 'a']] list_of_lists[1][1] = 'b' for row in list_of_lists: print row It works as intended. But when I try to use list comprehension to create the list: row = ['a' for range in xrange(3)] list_of_lists = [row for range in xrange(3)] list_of_lists[1][1] = 'b' for row in list_of_lists: print row It results in an entire column of items in the list being changed. Why is this? How can I achieve the desired effect with list comprehension?

    Read the article

  • Which linear programming package should I use for high numbers of constraints and "warm starts"

    - by davidsd
    I have a "continuous" linear programming problem that involves maximizing a linear function over a curved convex space. In typical LP problems, the convex space is a polytope, but in this case the convex space is piecewise curved -- that is, it has faces, edges, and vertices, but the edges aren't straight and the faces aren't flat. Instead of being specified by a finite number of linear inequalities, I have a continuously infinite number. I'm currently dealing with this by approximating the surface by a polytope, which means discretizing the continuously infinite constraints into a very large finite number of constraints. I'm also in the situation where I'd like to know how the answer changes under small perturbations to the underlying problem. Thus, I'd like to be able to supply an initial condition to the solver based on a nearby solution. I believe this capability is called a "warm start." Can someone help me distinguish between the various LP packages out there? I'm not so concerned with user-friendliness as speed (for large numbers of constraints), high-precision arithmetic, and warm starts. Thanks!

    Read the article

  • How do I create a Linked Server in SQL Server 2005 to a password protected Access 95 database?

    - by Brad Knowles
    I need to create a linked server with SQL Server Management Studio 2005 to an Access 95 database, which happens to be password protected at the database level. User level security has not been implemented. I cannot convert the Access database to a newer version. It is being used by a 3rd party application; so modifying it, in any way, is not allowed. I've tried using the Jet 4.0 OLE DB Provider and the ODBC OLE DB Provider. The 3rd party application creates a System DSN (with the proper database password), but I've not had any luck in using either method. If I were using a standard connection string, I think it would look something like this: Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\Test.mdb';Jet OLEDB:Database Password=####; I'm fairly certain I need to somehow incorporate Jet OLEDB:Database Password into the linked server setup, but haven't figured out how. I've posted the scripts I'm using along with the associated error messages below. Any help is greatly appreciated. I'll provide more details if needed, just ask. Thanks! Method #1 - Using the Jet 4.0 Provider When I try to run these statements to create the linked server: sp_dropserver 'Test', 'droplogins'; EXEC sp_addlinkedserver @server = N'Test', @provider = N'Microsoft.Jet.OLEDB.4.0', @srvproduct = N'Access DB', @datasrc = N'C:\Test.mdb' GO EXEC sp_addlinkedsrvlogin @rmtsrvname=N'Test', @useself=N'False',@locallogin=NULL, @rmtuser=N'Admin', @rmtpassword='####' GO I get this error when testing the connection: TITLE: Microsoft SQL Server Management Studio ------------------------------ "The test connection to the linked server failed." ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "Test" reported an error. Authentication failed. Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "Test". OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "Test" returned message "Cannot start your application. The workgroup information file is missing or opened exclusively by another user.". (Microsoft SQL Server, Error: 7399) ------------------------------ Method #2 - Using the ODBC Provider... sp_dropserver 'Test', 'droplogins'; EXEC sp_addlinkedserver @server = N'Test', @provider = N'MSDASQL', @srvproduct = N'ODBC', @datasrc = N'Test:DSN' GO EXEC sp_addlinkedsrvlogin @rmtsrvname=N'Test', @useself=N'False',@locallogin=NULL, @rmtuser=N'Admin', @rmtpassword='####' GO I get this error: TITLE: Microsoft SQL Server Management Studio ------------------------------ "The test connection to the linked server failed." ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "Test". OLE DB provider "MSDASQL" for linked server "Test" returned message "[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed". OLE DB provider "MSDASQL" for linked server "Test" returned message "[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed". OLE DB provider "MSDASQL" for linked server "Test" returned message "[Microsoft][ODBC Microsoft Access Driver] Cannot open database '(unknown)'. It may not be a database that your application recognizes, or the file may be corrupt.". (Microsoft SQL Server, Error: 7303)

    Read the article

  • Using linked servers, OPENROWSET and OPENQUERY

    - by BuckWoody
    SQL Server has a few mechanisms to reach out to another server (even another server type) and query data from within a Transact-SQL statement. Among them are a set of stored credentials and information (called a Linked Server), a statement that uses a linked server called called OPENQUERY, another called OPENROWSET, and one called OPENDATASOURCE. This post isn’t about those particular functions or statements – hit the links for more if you’re new to those topics. I’m actually more concerned about where I see these used than the particular method. In many cases, a Linked server isn’t another Relational Database Management System (RDMBS) like Oracle or DB2 (which is possible with a linked server), but another SQL Server. My concern is that linked servers are the new Data Transformation Services (DTS) from SQL Server 2000 – something that was designed for one purpose but which is being morphed into something much more. In the case of DTS, most of us turned that feature into a full-fledged job system. What was designed as a simple data import and export system has been pressed into service doing logic, routing and timing. And of course we all know how painful it was to move off of a complex DTS system onto SQL Server Integration Services. In the case of linked servers, what should be used as a method of running a simple query or two on another server where you have occasional connection or need a quick import of a small data set is morphing into a full federation strategy. In some cases I’ve seen a complex web of linked servers, and when credentials, names or anything else changes there are huge problems. Now don’t get me wrong – linked servers and other forms of distributing queries is a fantastic set of tools that we have to move data around. I’m just saying that when you start having lots of workarounds and when things get really complicated, you might want to step back a little and ask if there’s a better way. Are you able to tolerate some latency? Perhaps you’re able to use Service Broker. Would you like to be platform-independent on the data source? Perhaps a middle-tier might make more sense, abstracting the queries there and sending them to the proper server. Designed properly, I’ve seen these systems scale further and be more resilient than loading up on linked servers. Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

    Read the article

  • linked list problem (with insert)

    - by JohnWong
    The problem appears with the insert function that I wrote. 3 conditions must work, I tested b/w 1 and 2, b/w 2 and 3 and as last element, they worked. But b/w 3 and 4, it did not work. It only display up to the new added record, and did not show the fourth element. Efficiency is not my concern here (not yet). Please guide me through this debug process. Thank you very much. #include<iostream> #include<string> using namespace std; struct List // we create a structure called List { string name; string tele; List *nextAddr; }; void populate(List *); void display(List *); void insert(List *); int main() { const int MAXINPUT = 3; char ans; List * data, * current, * point; // create two pointers data = new List; current = data; for (int i = 0; i < (MAXINPUT - 1); i++) { populate(current); current->nextAddr = new List; current = current->nextAddr; } // last record we want to do it sepeartely populate(current); current->nextAddr = NULL; cout << "The current list consists of the following data records: " << endl; display(data); // now ask whether user wants to insert new record or not cout << "Do you want to add a new record (Y/N)?"; cin >> ans; if (ans == 'Y' || ans == 'y') { /* To insert b/w first and second, use point as parameter between second and third uses point->nextAddr between third and fourth uses point->nextAddr->nextAddr and insert as last element, uses current instead */ point = data; insert(()); display(data); } return 0; } void populate(List *data) { cout << "Enter a name: "; cin >> data->name; cout << "Enter a phone number: "; cin >> data->tele; return; } void display(List *content) { while (content != NULL) { cout << content->name << " " << content->tele; content = content->nextAddr; cout << endl; // we skip to next line } return; } void insert(List *last) { List * temp = last->nextAddr; //save the next address to temp last->nextAddr = new List; // now modify the address pointed to new allocation last = last->nextAddr; populate(last); last->nextAddr = temp; // now link all three together, eg 1-NEW-2 return; }

    Read the article

  • TRY CATCH with Linked Server in SQL Server 2005 Not Working

    - by Robert Stanley
    Hello, I am trying to catch sql error raised when I execute a stored procedure on a linked server. Both Servers are running SQL Server 2005. To prove the issue I have created a stored procedure on the linked server called Raise error that executes the following code: RAISERROR('An error', 16, 1); If I execute the stored procedure directly on the linked server using the following code I get a result set with 'An error', '16' as expected (ie the code enters the catch block): BEGIN TRY EXEC [dbo].[RaiseError]; END TRY BEGIN CATCH DECLARE @ErrMsg nvarchar(4000), @ErrSeverity int; SELECT @ErrMsg = ERROR_MESSAGE(), @ErrSeverity = ERROR_SEVERITY(); SELECT @ErrMsg, @ErrSeverity; END CATCH If I run the following code on my local server to execute the stored procedure on the linked server then SSMS gives me the message 'Query completed with errors', .Msg 50000, Level 16, State 1, Procedure RaiseError, Line 13 An error' BEGIN TRY EXEC [Server].[Catalog].[dbo].RaiseError END TRY BEGIN CATCH DECLARE @SPErrMsg nvarchar(4000), @SPErrSeverity int; SELECT @SPErrMsg = ERROR_MESSAGE(), @SPErrSeverity = ERROR_SEVERITY(); SELECT @SPErrMsg, @SPErrSeverity; END CATCH My Question is can I catch the error generated when the Linked server stored procedure executes? Thanks in advance!

    Read the article

  • linked server issue in SQL Server

    - by George2
    Hello everyone, I am using SQL Server 2008 with linked server feature. I noticed there are a lot of providers for linked server which could be found from SSMS, like SQLNCLI10, OLE DB, etc. How to know which provider a specific linked server instance is using? thanks in advance, George

    Read the article

  • Create a mirrored linked list in Java

    - by glacier89
    Linked-List: Mirror Consider the following private class for a node of a singly-linked list of integers: private class Node{ public int value; public Node next; } A wrapper-class, called, ListImpl, contains a pointer, called start to the first node of a linked list of Node. Write an instance-method for ListImpl with the signature: public void mirror(); That makes a reversed copy of the linked-list pointed to by start and appends that copy to the end of the list. So, for example the list: start 1 2 3 after a call to mirror, becomes: start 1 2 3 3 2 1 Note: in your answer you do not need to dene the rest of the class for ListImpl just the mirror method.

    Read the article

  • Create unordered list tree menu from data stored in an table with the adjacency list model...php

    - by Ronedog
    I need to create a tree menu of "nth" subcategories. I settled on using the adjacency list model for my table structure, because I won't be updating this table very much and this seemed the easiest to implement for my use. I want to style the output using "ul" and "li" tags...I already have a css and jquery solution to do the styling. My problem comes from pulling the data out of the database and using a recursive function via PHP to build the list ... the list is a concatenated string that gets parsed to build the tree. I'm really having a hard time getting the closing "ul" and "li" tags to line up just where they need to be. Is this the best way to do this? Are there other better ways using arrays or something like that to do this? Any examples you can point me to of "best practices" for building a list like this will be appreciated. Thanks.

    Read the article

  • Different Types of Linked Lists!

    - by Jay
    What are the different types of Linked Lists which are commonly used? I know and have used the following: Singly Linked List Doubly Linked List Circular List What are the other kinds of lists that have been used by you or known to you?

    Read the article

  • Reverse a singly linked list

    - by Madhan
    I would be wondered if there exists some logic to reverse the linked list using only two pointers. The following is used to reverse the single linked list using three pointers namely p, q, r: struct node { int data; struct node *link; }; void reverse() { struct node *p = first, *q = NULL, *r; while (p != NULL) { r = q; q = p; p = p->link; q->link = r; } q = first; } Is there any other alternate to reverse the linked list? what would be the best logic to reverse a singly linked list, in terms of time complexity?

    Read the article

  • Creating a circually linked list in C#?

    - by Dexter
    What would be the best way to create a circually linked list in C#. Should I derive it from the LinkedList< T collection? I'm planning on creating a simple address book using this Linked List to store my contacts (it's gonna be a suck-y address book, but I don't care cause I'll be the only one to use it). I mainly just want to create the crucially linked list so that I can use it again in other projects. If you don't think the Linked List is the right way to go let me know which way would be better.

    Read the article

  • Can't remove first node in linked list

    - by carlmonday
    I'm trying to make a linked list class in python (pointless I know, but it's a learning exercise), and the method I have written to remove a node doesn't work if I try to remove the first element of the linked list. If the node to be removed is anywhere else in the linked list the method works fine. Can someone give me some insight as to where I've gone wrong? Here's my code thus far: class Node: def __init__(self, data=None, next=None): self.data = data self.next = next def __repr__(self): return repr(self.data) def printNodes(self): while self: print self.data self = self.next def removeNode(self, datum): """removes node from linked list""" if self.data == datum: return self.next while self.next: if self.next.data == datum: self.next = self.next.next return self self = self.next

    Read the article

  • Multiple Linked List in C

    - by LuckySlevin
    I have a problem about Linked Lists. I already know how to create structures and linked list. But now I have to create arbitrary number of linked list which are also be kept in another structure. Which means : struct list{int x, struct list *next; }; struct parent{int x, struct list *head, struct parent *next;} And after lists are created when i enter this input for example "123134 linked list should look like : 1 - 2 - 3 - 4 And for example 1 will contain 2-3 list inside of it, 3 will contain 1-4 list inside of it. I need a starting point and a spark from you. So how can i do this?

    Read the article

  • Update a list from another list

    - by Langali
    I have a list of users in local store that I need to update from a remote list of users every once in a while. Basically: If a remote user already exists locally, update its fields. If a remote user doesn't already exist locally, add the user. If a local user doesn't appear in the remote list, deactivate or delete. If a local user also appears in the remote list, update its fields. Just a simple case of syncing the local list. Is there a better way to do this in pure Java than the following? I feel gross looking at my own code. public class User { Integer id; String email; boolean active; //Getters and Setters....... public User(Integer id, String email, boolean active) { this.id = id; this.email = email; this.active = active; } @Override public boolean equals(Object other) { boolean result = false; if (other instanceof User) { User that = (User) other; result = (this.getId() == that.getId()); } return result; } } public static void main(String[] args) { //From 3rd party List<User> remoteUsers = getRemoteUsers(); //From Local store List<User> localUsers =getLocalUsers(); for (User remoteUser : remoteUsers) { boolean found = false; for (User localUser : localUsers) { if (remoteUser.equals(localUser)) { found = true; localUser.setActive(remoteUser.isActive()); localUser.setEmail(remoteUser.getEmail()); //update } break; } if (!found) { User user = new User(remoteUser.getId(), remoteUser.getEmail(), remoteUser.isActive()); //Save } } for(User localUser : localUsers ) { boolean found = false; for(User remoteUser : remoteUsers) { if(localUser.equals(remoteUser)) { found = true; localUser.setActive(remoteUser.isActive()); localUser.setEmail(remoteUser.getEmail()); //Update } break; } if(!found) { localUser.setActive(false); // Deactivate } } }

    Read the article

  • Parallel.For maintain input list order on output list

    - by romeozor
    I'd like some input on keeping the order of a list during heavy-duty operations that I decided to try to do in a parallel manner to see if it boosts performance. (It did!) I came up with a solution, but since this was my first attempt at anything parallel, I'd need someone to slap my hands if I did something very stupid. There's a query that returns a list of card owners, sorted by name, then by date of birth. This needs to be rendered in a table on a web page (ASP.Net WebForms). The original coder decided he would construct the table cell-by-cell (TableCell), add them to rows (TableRow), then each row to the table. So no GridView, allegedly its performance is bad, but the performance was very poor regardless :). The database query returns in no time, the most time is spent on looping through the results and adding table cells etc. I made the following method to maintain the original order of the list: private TableRow[] ComposeRows(List<CardHolder> queryResult) { int queryElementsCount = queryResult.Count(); // array with the query's size var rowArray = new TableRow[queryElementsCount]; Parallel.For(0, queryElementsCount, i => { var row = new TableRow(); var cell = new TableCell(); // various operations, including simple ones such as: cell.Text = queryResult[i].Name; row.Cells.Add(cell); // here I'm adding the current item to it's original index // to maintain order in the output list rowArray[i] = row; }); return rowArray; } So as you can see, because I'm returning a very different type of data (List<CardHolder> -> TableRow[]), I can't just simply omit the ordering from the original query to do it after the operations. Also, I also thought it would be a good idea to Dispose() the objects at the end of each loop, because the query can return a huge list and letting cell and row objects pile up in the heap could impact performance.(?) How badly did I do? Does anyone have a better solution in case mine is flawed?

    Read the article

  • linked-server sql - access

    - by user22121
    Hi, I have a SQL server 2000 and an Access database mdb connected by Linked server on the other hand I have a program in c # that updates data in a SQL table (Users) based data base access. When running my program returns the following error message: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. Authentication failed. [OLE / DB provider returned message: Can not start the application. Missing information file of the working group or is opened exclusively by another user.] OLE DB error trace [OLE / DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize:: Initialize returned 0x80040E4D: Authentication failed.] . Both the program, the sql server and database access are on a remote server. On the local server the problem was solved by running the following: "sp_addlinkedsrvlogin 'ActSC', 'false', NULL, 'admin', NULL". Try on the remote server the next, without result: "sp_addlinkedsrvlogin 'ActSC', true, null, 'user', 'pass'". On the remote server and from the "Query Analyzer" sql update statements are working correctly. Can you think of what may be the problem? Thanks!

    Read the article

  • Authenticating Linked Servers - SQL Server 8 to SQL Server 10

    - by jp2code
    We have an old SQL Server 2000 database that has to be kept because it is needed on our manufacturing machines. It also maintains our employee records, since they are needed on these machines for employee logins. We also have a newer SQL Server 10 database (I think this is 2008, but I'm not sure) that we are using for newer development. I have recently learned (i.e. today) that I can link the two servers. This would allow me to access the employee tables in the newer server. Following the SF post SQL Server to SQL Server Linked Server Setup, I tried adding the link. In our SQL Server 2000 machine, I got this error: Similarly, on our SQL Server 10 machine, I got this error: The messages, though worded different, probably say the same thing: I need to authenticate, somehow. We have an Active Directory, but it is on yet another server. What, exactly, should be done here? A guy HERE<< said to check the Security settings, but did not say what else to do. Both servers are set to SQL Server and Windows Authentication mode. Now what?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >