Search Results

Search found 2942 results on 118 pages for 'linked'.

Page 12/118 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • jQuery: tabs where the tab/content can be linked to

    - by Ricardo Zea
    My issue is simple. I have already implemented a tab system, and I'd probably spend more time implementing another one with the solution I need, than giving a shot at adapting the code I have, and learn something while asking :) My problem is that the tabs can't be linked to, I need to be able to link to a tab from another website or page, and have that tab get selected upon page load. ie: I have three tabs showing different products, by default tab 1 is active/selected when the page loads. From the home page I want to link to tab 2 but I can't link to tab 2 because it doesn't get selected. Not sure if that makes sense. Tabs: <ul> <li><a href="products.php">Product 1</a></li> <li><a href="products.php">Product 2</a></li> <li><a href="products.php">Product 3</a></li> </ul> <div class="tab_container"> <div id="tab1" class="tab_content">Product 1 info...</div> <div id="tab2" class="tab_content">Product 2 info...</div> <div id="tab3" class="tab_content">Product 3 info...</div> </div> my jQuery: $(document).ready(function() { //Default Action $(".tab_content").hide(); $("ul.tabs li:first").addClass("active").show(); $(".tab_content:first").show(); //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); $(this).addClass("active"); $(".tab_content").hide(); var activeTab = $(this).find("a").attr("href"); $(activeTab).fadeIn(); return false; }); }); Is there a way this code can be adapted to be able to link to any tab from anywhere and have that tab get selected when the page loads? Thanks in advance.

    Read the article

  • Linked lists in Java - help with assignment

    - by user368241
    Representation of a string in linked lists In every intersection in the list there will be 3 fields : The letter itself. The number of times it appears consecutively. A pointer to the next intersection in the list. The following class CharNode represents a intersection in the list : public class CharNode { private char _data; private int _value; private charNode _next; public CharNode (char c, int val, charNode n) { _data = c; _value = val; _next = n; } public charNode getNext() { return _next; } public void setNext (charNode node) { _next = node; } public int getValue() { return _value; } public void setValue (int v) { value = v; } public char getData() { return _data; } public void setData (char c) { _data = c; } } The class StringList represents the whole list : public class StringList { private charNode _head; public StringList() { _head = null; } public StringList (CharNode node) { _head = node; } } Add methods to the class StringList according to the details : (I will add methods gradually according to my specific questions) (Pay attention, these are methods from the class String and we want to fulfill them by the representation of a string by a list as explained above) public int indexOf (int ch) - returns the index in the string it is operated on of the first appeareance of the char "ch". If the char "ch" doesn't appear in the string, returns -1. If the value of fromIndex isn't in the range, returns -1. Pay attention to all the possible error cases. Write what is the time complexity and space complexity of every method that you wrote. Make sure the methods you wrote are effective. It is NOT allowed to use ready classes of Java. It is NOT allowed to move to string and use string operations. Here is my try to write the method indexOf (int ch). Kindly assist me with fixing the bugs so I can move on. public int indexOf (int ch) { int count = 0; charNode pose = _head; if (pose == null ) { return -1; } for (pose = _head; pose!=null && pose.getNext()!='ch'; pose = pose.getNext()) { count++; } if (pose!=null) return count; else return -1; }

    Read the article

  • C++: incorrect swapping of nodes in linked list

    - by Dragon
    I have 2 simple structures: struct Address { char city[255]; }; typedef Address* AddressPtr; struct Person { char fullName[255]; Address* address; Person* next; }; typedef Person* PersonPtr; The Person structure forms the Linked list where new elements are added to the beginning of the list. What I want to do is to sort them by fullName. At first I tried to swap links, but I lost the beginning of the list and as a result my list was sorted partially. Then I decided to sort list by swapping the values of nodes. But I get strange results. For a list with names: Test3, Test2, Test1, I get Test3, Test3, Test3. Here is my sorting code: void sortByName(PersonPtr& head) { TaskPtr currentNode, nextNode; for(currentNode = head; currentNode->next != NULL; currentNode = currentNode->next) { for(nextNode = currentNode->next; nextNode != NULL; nextNode = nextNode->next) { if(strcmp(currentNode->fullName, nextNode->fullName) > 0) { swapNodes(currentNode, nextNode); } } } } void swapNodes(PersonPtr& node1, PersonPtr& node2) { PersonPtr temp_node = node2; strcpy(node2->fullName, node1->fullName); strcpy(node1->fullName, temp_node->fullName); strcpy(node2->address->city, node1->address->city); strcpy(node1->address->city, temp_node->address->city); } After the sorting completion, nodes values are a little bit strange. UPDATED This is how I swapped links void swapNodes(PersonPtr& node1, PersonPtr& node2) { PersonPtr temp_person; AddressPtr temp_address; temp_person = node2; node2 = node1; node1 = temp_person; temp_address = node2->address; node2->address = node1->address; node1->address = temp_address; }

    Read the article

  • Linked Lists in Java - Help with assignment

    - by doron2010
    I have been trying to solve this assignment all day, please help me. I'm completely lost. Representation of a string in linked lists In every intersection in the list there will be 3 fields : The letter itself. The number of times it appears consecutively. A pointer to the next intersection in the list. The following class CharNode represents a intersection in the list : public class CharNode { private char _data; private int _value; private charNode _next; public CharNode (char c, int val, charNode n) { _data = c; _value = val; _next = n; } public charNode getNext() { return _next; } public void setNext (charNode node) { _next = node; } public int getValue() { return _value; } public void setValue (int v) { value = v; } public char getData() { return _data; } public void setData (char c) { _data = c; } } The class StringList represents the whole list : public class StringList { private charNode _head; public StringList() { _head = null; } public StringList (CharNode node) { _head = node; } } Add methods to the class StringList according to the details : (Pay attention, these are methods from the class String and we want to fulfill them by the representation of a string by a list as explained above) public char charAt (int i) - returns the char in the place i in the string. Assume that the value of i is in the right range. public StringList concat (String str) - returns a string that consists of the string that it is operated on and in its end the string "str" is concatenated. public int indexOf (int ch) - returns the index in the string it is operated on of the first appeareance of the char "ch". If the char "ch" doesn't appear in the string, returns -1. If the value of fromIndex isn't in the range, returns -1. public int indexOf (int ch, int fromIndex) - returns the index in the string it is operated on of the first appeareance of the char "ch", as the search begins in the index "fromIndex". If the char "ch" doesn't appear in the string, returns -1. public boolean equals (String str) - returns true if the string that it is operated on is equal to the string str. Otherwise returns false. This method must be written in recursion, without using loops at all. public int compareTo (String str) - compares between the string that the method is operated on to the string "str" that is in the parameter. The method returns 0 if the strings are equal. If the string in the object is smaller lexicographic from the string "str" in the paramater, a negative number will be returned. And if the string in the object is bigger lexicographic from the string "str", a positive number will be returned. public StringList substring (int i) - returns the list of the substring that starts in the place i in the string on which it operates. Meaning, the sub-string from the place i until the end of the string. Assume the value of i is in the right range. public StringList substring (int i, int j) - returns the list of the substring that begins in the place i and ends in the place j (not included) in the string it operates on. Assume the values of i, j are in the right range. public int length() - will return the length of the string on which it operates. Pay attention to all the possible error cases. Write what is the time complexity and space complexity of every method that you wrote. Make sure the methods you wrote are effective. It is NOT allowed to use ready classes of Java. It is NOT allowed to move to string and use string operations.

    Read the article

  • Double Linked List header node keeps returning first value as 0

    - by Craig
    I will preface to say that this is my first question. I am currently getting my Masters degree in Information Security and I had to take C++ programming this semester. So this is homework related. I am not looking for you to answer my homework but I am running into a peculiar situation. I have created the program to work with a doubly linked list and everything works fine. However when I have the user create a list of values the first node keeps returning 0. I have tried finding some reading on this and I cannot locate any reference to it. My question is then is the header node(first node) always going to be zero? Or am I doing something wrong. case: 'C': cout<<"Please enter a list:"<<endl; while(n!=-999){ myList.insert(n); cin>> n;} break; I now enter: 12321, 1234,64564,346346. The results in 0, 12321, 1234, 64564,346346. Is this what should happen or am I doing something wrong? Also as this is my first post please feel free to criticize or teach me how to color code the keywords. Anyway this is a homework assignment so I am only looking for guidance and constructive criticism. Thank you all in advance So I cannot figure out the comment sections on this forum so I will edit the original post The first section is the constructor code: template <class Type> doublyLinkedList<Type>::doublyLinkedList() { first= NULL; last = NULL; count = 0; } Then there is my insert function : template <class Type> void doublyLinkedList<Type>::insert(const Type& insertItem) { nodeType<Type> *current; //pointer to traverse the list nodeType<Type> *trailCurrent; //pointer just before current nodeType<Type> *newNode; //pointer to create a node bool found; newNode = new nodeType<Type>; //create the node newNode->info = insertItem; //store the new item in the node newNode->next = NULL; newNode->back = NULL; if(first == NULL) //if the list is empty, newNode is //the only node { first = newNode; last = newNode; count++; } else { found = false; current = first; while (current != NULL && !found) //search the list if (current->info >= insertItem) found = true; else { trailCurrent = current; current = current->next; } if (current == first) //insert newNode before first { first->back = newNode; newNode->next = first; first = newNode; count++; } else { //insert newNode between trailCurrent and current if (current != NULL) { trailCurrent->next = newNode; newNode->back = trailCurrent; newNode->next = current; current->back = newNode; } else { trailCurrent->next = newNode; newNode->back = trailCurrent; last = newNode; } count++; }//end else }//end else }//end Then I have an initialization function too: template <class Type> void doublyLinkedList<Type>::initializeList() { destroy(); } Did I miss anything?

    Read the article

  • Object reference not set to an instance of an object- Linked List Example

    - by Zoro Roronoa
    I am seeing following errors : Object reference not set to an instance of an object! Check to determinate if the object is null before calling the method! I'am new with C#,and I made a program for Sorted Linked Lists. Here is the code where the error comes! public void Insert(double data) { Link newLink = new Link(data); Link current = first; Link previous = null; if (first == null) { first = newLink; } else { while (data > current.DData && current != null) { previous = current; current = current.Next; } previous.Next = newLink; newLink.Next = current; } } It says that the current referenc is null while (data current.DData && current != null), but I assigned it current = first; Please Help ! The rest is the complete code of the Program! class Link { double dData; Link next=null; public Link Next { get { return next; } set { next = value; } } public double DData { get { return dData; } set { dData = value; } } public Link(double dData) { this.dData = dData; } public void DisplayLink() { Console.WriteLine("Link : "+ dData); } } class SortedList { Link first; public SortedList() { first = null; } public bool IsEmpty() { return (this.first == null); } public void Insert(double data) { Link newLink = new Link(data); Link current = first; Link previous = null; if (first == null) { first = newLink; } else { while (data > current.DData && current != null) { previous = current; current = current.Next; } previous.Next = newLink; newLink.Next = current; } } public Link Remove() { Link temp = first; first = first.Next; return temp; } public void DisplayList() { Link current; current = first; Console.WriteLine("Display the List!"); while (current != null) { current.DisplayLink(); current = current.Next; } } } class SortedListApp { public void TestSortedList() { SortedList newList = new SortedList(); newList.Insert(20); newList.Insert(22); newList.Insert(100); newList.Insert(1000); newList.Insert(15); newList.Insert(11); newList.DisplayList(); newList.Remove(); newList.DisplayList(); } }

    Read the article

  • Fail to analyze core dump with GDB when main.elf is dynamically linked (uses shared libs)

    - by dscTobi
    Hi all. I'm trying to analyze core dump, but i get following result: GNU gdb 6.6.0.20070423-cvs Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=mipsel-linux --target=mipsel-linux-uclibc". (gdb) file main.elf Reading symbols from /home/tobi/main.elf...Reading symbols from /home/tobi/main.dbg...done. done. (gdb) core-file /srv/tobi/core warning: .dynamic section for "/lib/libpthread.so.0" is not at the expected address (wrong library or version mismatch?) Error while mapping shared library sections: /lib/libdl.so.0: No such file or directory. Error while mapping shared library sections: /lib/librt.so.0: No such file or directory. Error while mapping shared library sections: /lib/libm.so.0: No such file or directory. Error while mapping shared library sections: /lib/libstdc++.so.6: No such file or directory. Error while mapping shared library sections: /lib/libc.so.0: No such file or directory. warning: .dynamic section for "/lib/libgcc_s.so.1" is not at the expected address (wrong library or version mismatch?) Error while mapping shared library sections: /lib/ld-uClibc.so.0: No such file or directory. Reading symbols from /lib/libpthread.so.0...done. Loaded symbols for /lib/libpthread.so.0 Symbol file not found for /lib/libdl.so.0 Symbol file not found for /lib/librt.so.0 Symbol file not found for /lib/libm.so.0 Symbol file not found for /lib/libstdc++.so.6 Symbol file not found for /lib/libc.so.0 Reading symbols from /lib/libgcc_s.so.1...done. Loaded symbols for /lib/libgcc_s.so.1 Symbol file not found for /lib/ld-uClibc.so.0 warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. Core was generated by 'root/main.elf'. Program terminated with signal 11, Segmentation fault. #0 0x0046006c in NullPtr (parse_p=0x2ac9dc80, result_sym_p=0x13e3d6c "") at folder/my1.c:1624 1624 *ptr += 13; (gdb) bt #0 0x0046006c in NullPtr (parse_p=0x2ac9dc80, result_sym_p=0x13e3d6c "") at folder/my1.c:1624 #1 0x0047a31c in fn1 (line_ptr=0x2ac9dd18 "ccore_null_pointer", target_ptr=0x13e3d6c "", result_ptr=0x2ac9dd14) at folder/my2.c:980 #2 0x0047b9d0 in fn2 (macro_ptr=0x0, rtn_exp_ptr=0x0) at folder/my3.c:1483 /... some functions .../ #8 0x2aab7f9c in __nptl_setxid () from /lib/libpthread.so.0 Backtrace stopped: frame did not save the PC (gdb) thread apply all bt Thread 159 (process 1093): #0 0x2aac15dc in _Unwind_GetCFA () from /lib/libpthread.so.0 #1 0x2afdfde8 in ?? () warning: GDB cant find the start of the function at 0x2afdfde8. GDB is unable to find the start of the function at 0x2afdfde8 and thus cant determine the size of that functions stack frame. This means that GDB may be unable to access that stack frame, or the frames below it. This problem is most likely caused by an invalid program counter or stack pointer. However, if you think GDB should simply search farther back from 0x2afdfde8 for code which looks like the beginning of a function, you can increase the range of the search using the set heuristic-fence-post command. Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 158 (process 1051): #0 0x2aac17bc in pthread_mutexattr_getprioceiling () from /lib/libpthread.so.0 #1 0x2aac17a0 in pthread_mutexattr_getprioceiling () from /lib/libpthread.so.0 Backtrace stopped: previous frame identical to this frame (corrupt stack?) Thread 157 (process 1057): #0 0x2aabf908 in ?? () from /lib/libpthread.so.0 #1 0x00000000 in ?? () Thread 156 (process 1090): #0 0x2aac17bc in pthread_mutexattr_getprioceiling () from /lib/libpthread.so.0 #1 0x2aac17a0 in pthread_mutexattr_getprioceiling () from /lib/libpthread.so.0 Backtrace stopped: previous frame identical to this frame (corrupt stack?) Thread 155 (process 1219): #0 0x2aabf908 in ?? () from /lib/libpthread.so.0 #1 0x00000000 in ?? () Thread 154 (process 1218): #0 0x2aabfb44 in connect () from /lib/libpthread.so.0 #1 0x00000000 in ?? () Thread 153 (process 1096): #0 0x2abc92b4 in ?? () warning: GDB cant find the start of the function at 0x2abc92b4. #1 0x2abc92b4 in ?? () warning: GDB cant find the start of the function at 0x2abc92b4. Backtrace stopped: previous frame identical to this frame (corrupt stack?) Thread 152 (process 1170): #0 0x2aabfb44 in connect () from /lib/libpthread.so.0 #1 0x00000000 in ?? () If i make main.elf statically linked everything is OK and i can see bt of all threads. Any ideas?

    Read the article

  • Linked lists in Java - Help with writing methods

    - by user368241
    Representation of a string in linked lists In every intersection in the list there will be 3 fields : The letter itself. The number of times it appears consecutively. A pointer to the next intersection in the list. The following class CharNode represents a intersection in the list : public class CharNode { private char _data; private int _value; private charNode _next; public CharNode (char c, int val, charNode n) { _data = c; _value = val; _next = n; } public charNode getNext() { return _next; } public void setNext (charNode node) { _next = node; } public int getValue() { return _value; } public void setValue (int v) { value = v; } public char getData() { return _data; } public void setData (char c) { _data = c; } } The class StringList represents the whole list : public class StringList { private charNode _head; public StringList() { _head = null; } public StringList (CharNode node) { _head = node; } } Add methods to the class StringList according to the details : (I will add methods gradually according to my specific questions) (Pay attention, these are methods from the class String and we want to fulfill them by the representation of a string by a list as explained above) Pay attention to all the possible error cases. Write what is the time complexity and space complexity of every method that you wrote. Make sure the methods you wrote are effective. It is NOT allowed to use ready classes of Java. It is NOT allowed to move to string and use string operations. 1) public int indexOf (int ch) - returns the index in the string it is operated on of the first appeareance of the char "ch". If the char "ch" doesn't appear in the string, returns -1. If the value of fromIndex isn't in the range, returns -1. Here is my try : public int indexOf (int ch) { int count = 0; charNode pos = _head; if (pos == null ) { return -1; } for (pos = _head; pos!=null && pos.getData()!=ch; pos = pos.getNext()) { count = count + pos.getValue(); } if (pos==null) return -1; return count; } Time complexity = O(N) Space complexity = O(1) EDIT : I have a problem. I tested it in BlueJ and if the char ch doesn't appear it returns -1 but if it does, it always returns 0 and I don't understand why... I am confused. How can the compiler know that the value is the number of times the letter appears consecutively? Can I assume this because its given on the question or what? If it's true and I can assume this, then my code should be correct right? Ok I just spoke with my instructor and she said it isn't required to write it in the exercise but in order for me to test that it indeed works, I need to open a new class and write a code for making a list so that the the value of every node is the number of times the letter appears consecutively. Can someone please assist me? So I will copy+paste to BlueJ and this way I will be able to test all the methods. Meanwhile I am moving on to the next methods. 2) public int indexOf (int ch, int fromIndex) - returns the index in the string it is operated on of the first appeareance of the char "ch", as the search begins in the index "fromIndex". If the char "ch" doesn't appear in the string, returns -1. If the value of fromIndex doesn't appear in the range, returns -1. Here is my try: public int indexOf (int ch, int fromIndex) { int count = 0, len=0, i; charNode pos = _head; CharNode cur = _head; for (pos = _head; pos!=null; pos = pos.getNext()) { len = len+1; } if (fromIndex<0 || fromIndex>=len) return -1; for (i=0; i<fromIndex; i++) { cur = cur.getNext(); } if (cur == null ) { return -1; } for (cur = _head; cur!=null && cur.getData()!=ch; cur = cur.getNext()) { count = count + cur.getValue(); } if (cur==null) return -1; return count; } Time complexity = O(N) ? Space complexity = O(1) 3) public StringList concat (String str) - returns a string that consists of the string that it is operated on and in its end the string "str" is concatenated. Here is my try : public StringList concat (String str) { String str = ""; charNode pos = _head; if (str == null) return -1; for (pos = _head; pos!=null; pos = pos.getNext()) { str = str + pos.getData(); } str = str + "str"; return str; } Time complexity = O(N) Space complexity = O(1)

    Read the article

  • Need help with copy constructor for very basic implementation of singly linked lists

    - by Jesus
    Last week, we created a program that manages sets of strings, using classes and vectors. I was able to complete this 100%. This week, we have to replace the vector we used to store strings in our class with simple singly linked lists. The function basically allows users to declare sets of strings that are empty, and sets with only one element. In the main file, there is a vector whose elements are a struct that contain setName and strSet (class). HERE IS MY PROBLEM: It deals with the copy constructor of the class. When I remove/comment out the copy constructor, I can declare as many empty or single sets as I want, and output their values without a problem. But I know I will obviously need the copy constructor for when I implement the rest of the program. When I leave the copy constructor in, I can declare one set, either single or empty, and output its value. But if I declare a 2nd set, and i try to output either of the first two sets, i get a Segmentation Fault. Moreover, if i try to declare more then 2 sets, I get a Segmentation Fault. Any help would be appreciated!! Here is my code for a very basic implementation of everything: Here is the setcalc.cpp: (main file) #include <iostream> #include <cctype> #include <cstring> #include <string> #include "help.h" #include "strset2.h" using namespace std; // Declares of structure to hold all the sets defined struct setsOfStr { string nameOfSet; strSet stringSet; }; // Checks if the set name inputted is unique bool isSetNameUnique( vector<setsOfStr> strSetArr, string setName) { for(unsigned int i = 0; i < strSetArr.size(); i++) { if( strSetArr[i].nameOfSet == setName ) { return false; } } return true; } int main(int argc, char *argv[]) { char commandChoice; // Declares a vector with our declared structure as the type vector<setsOfStr> strSetVec; string setName; string singleEle; // Sets a loop that will constantly ask for a command until 'q' is typed while (1) { // declaring a set to be empty if(commandChoice == 'd') { cin >> setName; // Check that the set name inputted is unique if (isSetNameUnique(strSetVec, setName) == true) { strSet emptyStrSet; setsOfStr set1; set1.nameOfSet = setName; set1.stringSet = emptyStrSet; strSetVec.push_back(set1); } else { cerr << "ERROR: Re-declaration of set '" << setName << "'\n"; } } // declaring a set to be a singleton else if(commandChoice == 's') { cin >> setName; cin >> singleEle; // Check that the set name inputted is unique if (isSetNameUnique(strSetVec, setName) == true) { strSet singleStrSet(singleEle); setsOfStr set2; set2.nameOfSet = setName; set2.stringSet = singleStrSet; strSetVec.push_back(set2); } else { cerr << "ERROR: Re-declaration of set '" << setName << "'\n"; } } // using the output function else if(commandChoice == 'o') { cin >> setName; if(isSetNameUnique(strSetVec, setName) == false) { // loop through until the set name is matched and call output on its strSet for(unsigned int k = 0; k < strSetVec.size(); k++) { if( strSetVec[k].nameOfSet == setName ) { (strSetVec[k].stringSet).output(); } } } else { cerr << "ERROR: No such set '" << setName << "'\n"; } } // quitting else if(commandChoice == 'q') { break; } else { cerr << "ERROR: Ignoring bad command: '" << commandChoice << "'\n"; } } return 0; } Here is the strSet2.h: #ifndef _STRSET_ #define _STRSET_ #include <iostream> #include <vector> #include <string> struct node { std::string s1; node * next; }; class strSet { private: node * first; public: strSet (); // Create empty set strSet (std::string s); // Create singleton set strSet (const strSet &copy); // Copy constructor // will implement destructor later void output() const; strSet& operator = (const strSet& rtSide); // Assignment }; // End of strSet class #endif // _STRSET_ And here is the strSet2.cpp (implementation of class) #include <iostream> #include <vector> #include <string> #include "strset2.h" using namespace std; strSet::strSet() { first = NULL; } strSet::strSet(string s) { node *temp; temp = new node; temp->s1 = s; temp->next = NULL; first = temp; } strSet::strSet(const strSet& copy) { cout << "copy-cst\n"; node *n = copy.first; node *prev = NULL; while (n) { node *newNode = new node; newNode->s1 = n->s1; newNode->next = NULL; if (prev) { prev->next = newNode; } else { first = newNode; } prev = newNode; n = n->next; } } void strSet::output() const { if(first == NULL) { cout << "Empty set\n"; } else { node *temp; temp = first; while(1) { cout << temp->s1 << endl; if(temp->next == NULL) break; temp = temp->next; } } } strSet& strSet::operator = (const strSet& rtSide) { first = rtSide.first; return *this; }

    Read the article

  • How to create a shared lock blocking an intent exclusive lock

    - by FremenFreedom
    As I understand it, a SELECT statement will place a shared lock on the rows that it will return. While that SELECT is running, if an UPDATE statement comes along and needs to grab an intent exclusive lock then that UPDATE statement will need to wait until the SELECT statement releases its shared locks. I am trying to test this SELECT shared lock thing by doing a BEGIN TRAN and then running a SELECT, not COMMITing, and then running an UPDATE in another session on the exact same row. The UPDATE worked fine -- no lock, no wait. So this must not be a valid way to simulate a shared lock blocking an intent exclusive lock? Can you give me a scenario where I can create a lock with a SELECT that would force an UPDATE to wait? I'm working with SQL Server 2000 and 2005 across a linked server: the table is on the 2005 instance, the select is happening on 2000, and the update is executed from 2005. All in SSMS 2005.

    Read the article

  • Select the latest record for each category linked available on an object

    - by Simpleton
    I have a tblMachineReports with the columns: Status(varchar),LogDate(datetime),Category(varchar), and MachineID(int). I want to retrieve the latest status update from each category for every machine, so in effect getting a snapshot of the latest statuses of all the machines unique to their MachineID. The table data would look like Category - Status - MachineID - LogDate cata - status1 - 001 - date1 cata - status2 - 002 - date2 catb - status3 - 001 - date2 catc - status2 - 002 - date4 cata - status3 - 001 - date5 catc - status1 - 001 - date6 catb - status2 - 001 - date7 cata - status2 - 002 - date8 catb - status2 - 002 - date9 catc - status2 - 001 - date10 Restated, I have multiple machines reporting on multiple statuses in this tblMachineReports. All the rows are created through inserts, so their will obviously be duplicate entries for machines as new statuses come in. None of the columns can be predicted, so I can't do any ='some hard coded string' comparisons in any part of the select statement. For the sample table I provided, the desired results would look like: Category - Status - MachineID - LogDate catc - status2 - 002 - date4 cata - status3 - 001 - date5 catb - status2 - 001 - date7 cata - status2 - 002 - date8 catb - status2 - 002 - date9 catc - status2 - 001 - date10 What would the select statement look like to achieve this, getting the latest status for each category on each machine, using MS SQL Server 2008? I have tried different combinations of subqueries combined with aggregate MAX(LogDates)'s, along with joins, group bys, distincts, and what-not, but have yet to find a working solution.

    Read the article

  • Two Linked CSS Files Not working

    - by Oscar Godson
    <head> <title>Water Bureau</title> <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" href="/css/main.css" type="text/css" media="screen" title="Main CSS"> <link rel="stylesheet" href="custom.css" type="text/css" media="screen" title="Custom Styles"> <script language="JavaScript" src="/shared/js/createWin.js" type="text/javascript"></script> </head> Thats the code, but the "custom.css" isn't working. It doesn't work at all. If we add a @import into main.css OR into the header instead of a it works fine though. Any ideas? We also got rid of the media="screens" on both as well. The CSS inside of it is working fine, it's just when we stack those two, the first one parsed is the only one read by the browser. So if we swap main below custom, custom than works but NONE of main works. and custom just has snippet of CSS, and doesn't override all the CSS in main, just 1 element. I can't figure it out! We have other ed stylesheets in the head (which we took out for trying to fix this) and they worked fine...

    Read the article

  • Adding Polynomials (Linked Lists)......Bug Help

    - by Brian
    I have written a program that creates nodes that in this class are parts of polynomials and then the two polynomials get added together to become one polynomial (list of nodes). All my code compiles so the only problem I am having is that the nodes are not inserting into the polynomial via the insert method I have in polynomial.java and when running the program it does create nodes and displays them in the 2x^2 format but when it comes to add the polynomials together it displays o as the polynomials, so if anyone can figure out whats wrong and what I can do to fix it it would be much appreciated. Here is the code: import java.util.Scanner; class Polynomial{ public termNode head; public Polynomial() { head = null; } public boolean isEmpty() { return (head == null); } public void display() { if (head == null) System.out.print("0"); else for(termNode cur = head; cur != null; cur = cur.getNext()) { System.out.println(cur); } } public void insert(termNode newNode) { termNode prev = null; termNode cur = head; while (cur!=null && (newNode.compareTo(cur)<0)) { prev = null; cur = cur.getNext(); } if (prev == null) { newNode.setNext(head); head = newNode; } else { newNode.setNext(cur); prev.setNext(newNode); } } public void readPolynomial(Scanner kb) { boolean done = false; double coefficient; int exponent; termNode term; head = null; //UNLINK ANY PREVIOUS POLYNOMIAL System.out.println("Enter 0 and 0 to end."); System.out.print("coefficient: "); coefficient = kb.nextDouble(); System.out.println(coefficient); System.out.print("exponent: "); exponent = kb.nextInt(); System.out.println(exponent); done = (coefficient == 0 && exponent == 0); while(!done) { Polynomial poly = new Polynomial(); term = new termNode(coefficient,exponent); System.out.println(term); poly.insert(term); System.out.println("Enter 0 and 0 to end."); System.out.print("coefficient: "); coefficient = kb.nextDouble(); System.out.println(coefficient); System.out.print("exponent: "); exponent = kb.nextInt(); System.out.println(exponent); done = (coefficient==0 && exponent==0); } } public static Polynomial add(Polynomial p, Polynomial q) { Polynomial r = new Polynomial(); double coefficient; int exponent; termNode first = p.head; termNode second = q.head; termNode sum = r.head; termNode term; while (first != null && second != null) { if (first.getExp() == second.getExp()) { if (first.getCoeff() != 0 && second.getCoeff() != 0); { double addCoeff = first.getCoeff() + second.getCoeff(); term = new termNode(addCoeff,first.getExp()); sum.setNext(term); first.getNext(); second.getNext(); } } else if (first.getExp() < second.getExp()) { sum.setNext(second); term = new termNode(second.getCoeff(),second.getExp()); sum.setNext(term); second.getNext(); } else { sum.setNext(first); term = new termNode(first.getNext()); sum.setNext(term); first.getNext(); } } while (first != null) { sum.setNext(first); } while (second != null) { sum.setNext(second); } return r; } } Here is my Node class: class termNode implements Comparable { private int exp; private double coeff; private termNode next; public termNode(double coefficient, int exponent) { coeff = coefficient; exp = exponent; next = null; } public termNode(termNode inTermNode) { coeff = inTermNode.coeff; exp = inTermNode.exp; } public void setData(double coefficient, int exponent) { coefficient = coeff; exponent = exp; } public double getCoeff() { return coeff; } public int getExp() { return exp; } public void setNext(termNode link) { next = link; } public termNode getNext() { return next; } public String toString() { if (exp == 0) { return(coeff + " "); } else if (exp == 1) { return(coeff + "x"); } else { return(coeff + "x^" + exp); } } public int compareTo(Object other) { if(exp ==((termNode) other).exp) return 0; else if(exp < ((termNode) other).exp) return -1; else return 1; } } And here is my Test class to run the program. import java.util.Scanner; class PolyTest{ public static void main(String [] args) { Scanner kb = new Scanner(System.in); Polynomial r; Polynomial p = new Polynomial(); System.out.println("Enter first polynomial."); p.readPolynomial(kb); Polynomial q = new Polynomial(); System.out.println(); System.out.println("Enter second polynomial."); q.readPolynomial(kb); r = Polynomial.add(p,q); System.out.println(); System.out.print("The sum of "); p.display(); System.out.print(" and "); q.display(); System.out.print(" is "); r.display(); } }

    Read the article

  • How to prevent a globally overridden "new" operator from being linked in from external library

    - by mprudhom
    In our iPhone XCode 3.2.1 project, we're linking in 2 external static C++ libraries, libBlue.a and libGreen.a. libBlue.a globally overrides the "new" operator for it's own memory management. However, when we build our project, libGreen.a winds up using libBlue's new operator, which results in a crash (presumably because libBlue.a is making assumptions about the kinds of structures being allocated). Both libBlue.a and libGreen.a are provided by 3rd parties, so we can't change any of their source code or build options. When we remove libBlue.a from the project, libGreen.a doesn't have any issues. However, no amount of shuffling the linking order of the libraries seems to fix the problem, nor does any experimentation with the various linking flags. Is there some way to tell XCode to tell the linker to "have libGreen's use of the new operator use the standard C++ new operator rather than the one redefined by libBlue"?

    Read the article

  • SQL query using information from 4 tables (not all directly linked)

    - by Yvonne
    I'm developing a simple classroom system, where teachers manage classes and their subjects. I have 2 levels of access in my teachers table, assigned by an integer (1 = admin, 2 = user)... Meaning that the headteacher is the admin :) A teacher (of level 1) can have have many classes and a class can have many teachers (so I have 'TeachersClasses' table). A class can have many subjects, and a teacher can have many subjects. Basically, I'm attempting a query to display the admin teacher's (level 1) subjects. However, only teachers with a level of 2, are directly related to a subject, which is set by the admin user. The headteacher can view all of their subjects via the classroom, but I cannot get all of the subjects to be displayed on one page, instead I can only get the subjects to appear under a specific classroom right now... This is what I have so far, which is returning nothing. (I'm guessing this may require an SQL clause more advanced that 'INNER JOIN' which is the only join type I am familiar with, and thought it would be enough! $query = "SELECT subjects.subjectid, subjects.subjectname, subjects.subjectdetails, classroom.classid, classroom.classname FROM subjects INNER JOIN classroom ON subjects.subjectid = classroom.classid INNER JOIN teacherclasses ON classroom.classid = teacherclasses.classid INNER JOIN teachers ON teacherclasses.teacherid = teachers.teacherid WHERE teachers.teacherid = '".intval( $_SESSION['SESS_TEACHERID'] )."'"; In order for all subjects related to the headteachers class to be displayed, I'm gathering that all of my tables will need to be called up here? Thanks for any help! Example output: subject name: maths // teacher: mr smith // classroom: DG99 x10 for all the subjects associated with the headteachers classrooms :)

    Read the article

  • Qmake project dependencies (linked libraries)

    - by Stick it to THE MAN
    I have a project that links to a number of shared libraries. Lets say project A depends on projects B and C Ideally, I want to impose the following dependencies in my project file: Rebuild project A if either B or C has been rebuilt since last time project A was built Use the output for the relevant configuration (i.e. if building project A in debug mode, then use the debug versions of the libs for project B and C) Does anyone know how I may explicitly express such dependencies in my project file?

    Read the article

  • Delphi - Capture stdout and stderr output from statically linked MSVC++ compiled DLL

    - by Alan G.
    I have been trying to capture stdout and stderr output from a DLL compiled in MSVC++ that my Delphi app statically links to, but so far have been unsuccessful. procedure Test; var fs: TFileStream; begin fs := TFileStream.Create('C:\temp\output.log', fmCreate or fmShareDenyWrite); SetStdHandle(STD_OUTPUT_HANDLE, fs.Handle); SetStdHandle(STD_ERROR_HANDLE, fs.Handle); dllFunc(0); // Writes to stdout in MSVC++ console app, but not here // fs.Length is always zero fs.Free; end; Thought I was on the right track, but it does not work. Is SetStdHandle() enough? Is TFileStream the right thing to use here? Am I using TFileStream properly for SetStdHandle()? Is it possible that the DLL sets its stdout/stderr handles when the app loads? If so, where is the best place to use SetStdHandle() or equivalent? Any help would be appreciated.

    Read the article

  • Linked api Integration

    - by sree
    Hi friends i am using linkedin api to integrate linkedin profile and messages to my website. I got one sample example throgh googling.but the output is coming in xml output. then how can i bind all those things to my website controls

    Read the article

  • XCode project complains about missing files if a linked framework contains private headers

    - by darklight
    My Problem is this: My framework contains public and private headers - the public headers import private headers in the framework My app that links against this framework imports public headers Now when I compile it, XCode complains about missing files (the private headers that are indirectly imported via the frameworks public headers). I read somewhere on stackoverflow that I should do this: "In the public header file use @class to include other interfaces and use #import in the implementation file (.m)." I find this solution pretty unsatisfying - you have to use it for circular dependencies, too. Is there any better way to keep my headers private?

    Read the article

  • Separating weakly linked database schemas

    - by jldugger
    I've been tasked with revisiting a database schema we designed and use internally for various ticketing and reporting systems. Currently there exists about 40 tables in one Oracle database schema supporting perhaps six webapps. However, there's one unifying relationship amongst them all: a rooms table describing the room. Room name, purpose and other data are thrown into a shared table for each app. My initial idea was to pull each of these applications into a separate database, and perform joins between a given database and the room database. But I've discovered this solution prevents foreign key constraints in SQL Server 2005. It seems silly to duplicate one table for each app and keep those multiple copies synchronized. Should I just leave everything in one large DB, or is there something else I can do separate the tables without losing FK constraints?

    Read the article

  • A linked list with multiple heads in Java

    - by Emile
    Hi, I have a list in which I'd like to keep several head pointers. I've tried to create multiple ListIterators on the same list but this forbid me to add new elements in my list... (see Concurrent Modification exception). I could create my own class but I'd rather use a built-in implementation ;) To be more specific, here is an inefficient implementation of two basic operations and the one wich doesn't work : class MyList <E { private int[] _heads; private List<E _l; public MyList ( int nbHeads ) { _heads = new int[nbHeads]; _l = new LinkedList<E(); } public void add ( E e ) { _l.add(e); } public E next ( int head ) { return _l.get(_heads[head++]); // ugly } } class MyList <E { private Vector<ListIterator<E _iters; private List<E _l; public MyList ( int nbHeads ) { _iters = new Vector<ListIterator<E(nbHeads); _l = new LinkedList<E(); for( ListIterator<E iter : _iters ) iter = _l.listIterator(); } public void add ( E e ) { _l.add(e); } public E next ( int head ) { // ConcurrentModificationException because of the add() return _iters.get(head).next(); } } Emile

    Read the article

  • MySQL - optimising selection across two linked tables

    - by user293594
    I have two MySQL tables, states and trans: states (200,000 entries) looks like: id (INT) - also the primary key energy (DOUBLE) [other stuff] trans (14,000,000 entries) looks like: i (INT) - a foreign key referencing states.id j (INT) - a foreign key referencing states.id A (DOUBLE) I'd like to search for all entries in trans with trans.A 30. (say), and then return the energy entries from the (unique) states referenced by each matching entry. So I do it with two intermediate tables: CREATE TABLE ij SELECT i,j FROM trans WHERE A30.; CREATE TABLE temp SELECT DISTINCT i FROM ij UNION SELECT DISTINCT j FROM ij; SELECT energy from states,temp WHERE id=temp.i; This seems to work, but is there any way to do it without the intermediate tables? When I tried to create the temp table with a single command straight from trans: CREATE TABLE temp SELECT DISTINCT i FROM trans WHERE A30. UNION SELECT DISTINCT j FROM trans WHERE A30.; it took a longer (presumably because it had to search the large trans table twice. I'm new to MySQL and I can't seem to find an equivalent problem and answer out there on the interwebs. Many thanks, Christian

    Read the article

  • Caching linked pages in ASP.NET

    - by n0e
    I'm thinking of a way of creating a local backup for the pages I will be linking to from my site. This would be text-only, similar to Google's 'Copy' feature on the search pages. The idea is to be sure that the pages I would reference to, or cite from, do not dissapear from the Web in the near future. I know I could just keep local copies, but I will have A LOT of citations. What would be the best way of achieving this in ASP.NET? Some custom caching in database?

    Read the article

  • Concurrent Linked HashMap java

    - by Nilesh
    Please help me use/create Concurrent LinkedHashMap. As per my belief, if I use Collections.synchronizedMap(), I would have to use synchronized blocks for getter/setter. If I use ConcurrentSkipListMap, is there any way to implement a Comparator to store sequentially. I would like to use java's built in instead of third party packages. Thanks

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >