Search Results

Search found 6825 results on 273 pages for 'mt head'.

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

  • Undefined reference to ...

    - by Patrick LaChance
    I keep getting this error message every time I try to compile, and I cannot find out what the problem is. any help would be greatly appreciated: C:\DOCUME~1\Patrick\LOCALS~1\Temp/ccL92mj9.o:main.cpp:(.txt+0x184): undefined reference to 'List::List()' C:\DOCUME~1\Patrick\LOCALS~1\Temp/ccL92mj9.o:main.cpp:(.txt+0x184): undefined reference to 'List::add(int)' collect2: ld returned 1 exit status code: //List.h #ifndef LIST_H #define LIST_H #include <exception> //brief Definition of linked list class class List { public: /** \brief Exception for operating on empty list */ class Empty : public std::exception { public: virtual const char* what() const throw(); }; /** \brief Exception for invalid operations other than operating on an empty list */ class InvalidOperation : public std::exception { public: virtual const char* what() const throw(); }; /** \brief Node within List */ class Node { public: /** data element stored in this node */ int element; /** next node in list */ Node* next; /** previous node in list */ Node* previous; Node (int element); ~Node(); void print() const; void printDebug() const; }; List(); ~List(); void add(int element); void remove(int element); int first()const; int last()const; int removeFirst(); int removeLast(); bool isEmpty()const; int size()const; void printForward() const; void printReverse() const; void printDebug() const; /** enables extra output for debugging purposes */ static bool traceOn; private: /** head of list */ Node* head; /** tail of list */ Node* tail; /** count of number of nodes */ int count; }; #endif //List.cpp I only included the parts of List.cpp that might be the issue #include "List.h" #include <iostream> #include <iomanip> using namespace std; List::List() { //List::size = NULL; head = NULL; tail = NULL; } List::~List() { Node* current; while(head != NULL) { current = head-> next; delete current->previous; if (current->next!=NULL) { head = current; } else { delete current; } } } void List::add(int element) { Node* newNode; Node* current; newNode->element = element; if(newNode->element > head->element) { current = head->next; } else { head->previous = newNode; newNode->next = head; newNode->previous = NULL; return; } while(newNode->element > current->element) { current = current->next; } if(newNode->element <= current->element) { newNode->previous = current->previous; newNode->next = current; } } //main.cpp #include "List.h" #include <iostream> #include <string> using namespace std; //void add(int element); int main (char** argv, int argc) { List* MyList = new List(); bool quit = false; string value; int element; while(quit==false) { cin>>value; if(value == "add") { cin>>element; MyList->add(element); } if(value=="quit") { quit = true; } } return 0; } I'm doing everything I think I'm suppose to be doing. main.cpp isn't complete yet, just trying to get the add function to work first. Any help will be greatly appreciated.

    Read the article

  • How to Update with LINQ?

    - by DaveDev
    currently, I'm doing an update similar to as follows, because I can't see a better way of doing it. I've tried suggestions that I've read in blogs but none work, such as http://msdn.microsoft.com/en-us/library/bb425822.aspx and http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx Maybe these do work and I'm missing some point. Has anyone else had luck with them? // please note this isn't the actual code. // I've modified it to clarify the point I wanted to make // and also I didn't want to post our code here! public bool UpdateMyStuff(int myId, List<int> funds) { // get MyTypes that correspond to the ID I want to update IQueryable<MyType> myTypes = database.MyTypes.Where(xx => xx.MyType_MyId == myId); // delete them from the database foreach (db.MyType mt in myTypes) { database.MyTypes.DeleteOnSubmit(mt); } database.SubmitChanges(); // create a new row for each item I wanted to update, and insert it foreach (int fund in funds) { database.MyType mt = new database.MyType { MyType_MyId = myId, fund_id = fund }; database.MyTypes.InsertOnSubmit(mt); } // try to commit the insert try { database.SubmitChanges(); return true; } catch (Exception) { return false; throw; } } Unfortunately, there isn't a database.MyTypes.Update() method so I don't know a better way to do it. Can sombody suggest what I could do? Thanks. ..as a side note, why isn't there an Update() method?

    Read the article

  • Zend Framework: how to remove rendered views in the controller?

    - by takpar
    i want to render one of these sets of views: head body-$id1 foot OR head body-$id2 foot which set exsists. i do it like this: try { $this->render("head"); $this->render("body-$id1"); $this->render("foot"); } catch (Exception $e) { $this->render("head"); $this->render("body-$id2"); $this->render("foot"); } but it causes the head view be rendered twice if body-$id1 does not exists. do you have a better solution? in another saying, may i check the existance of body-$id1 before rendering it?

    Read the article

  • Javascript recursive data structure definition

    - by Matt Bierner
    I need to define a data structure recursively in Javascript. Here is a simple example of a circular linked list: // List a very simplified example of what the actual (non list) code does. function List(f, r) { return function(){ return [f, r]; }; } var head = List('a', List('b', List('c', head))); When this is executed, head in List 'c' is resolved to undefined, not List 'a' as I need. List is an example function that returns a function (It is not an Javascript list that I can append to). I tried to wrap the definition of head is a self executing named function, but that blew the stack when head was resolved. What is the Javascript style solution that I am overlooking?

    Read the article

  • Last element not getting insert in Tree

    - by rdk1992
    So I was asked to make a Binary Tree in Haskell taking as input a list of Integers. Below is my code. My problem is that the last element of the list is not getting inserted in the Tree. For example [1,2,3,4] it only inserts to the tree until "3" and 4 is not inserted in the Tree. data ArbolBinario a = Node a (ArbolBinario a) (ArbolBinario a) | EmptyNode deriving(Show) insert(x) EmptyNode= insert(tail x) (Node (head x) EmptyNode EmptyNode) insert(x) (Node e izq der) |x == [] = EmptyNode --I added this line to fix the Prelude.Head Empty List error, after I added this line the last element started to be ignored and not inserted in the tree |head x == e = (Node e izq der) |head x < e = (Node e (insert x izq) der) |head x > e = (Node e izq (insert x der)) Any ideas on whats going on here? Help is much appreciated

    Read the article

  • Hard drive failed, suspected filesystem corruption, still cannot salvage any data from harddrive

    - by Hippy-Head
    Firstly, I am terribly sorry if this is a duplicate, but I couldn't find a similar issue to mine, so here goes. I have a 1TB hdd bought around 8 months ago used as backup hard drive. I have not used the drive for a period of time whatsoever, and when I was trying to get back to some files on it, it was completely wiped just like that. At first it would not boot I tried everything from command line chkdsk and filesystem recovery software to rebuilt it. After a few attempts I managed to initialize it, at that time it was an achievement. The problems started when I tried to recover the data inside, I have used A LOT of software free and commercial software on both Mac and Windows, with the help of cmd or Terminal commands, however no data of any kind was recovered, even after leaving it thoroughly scan for around 9-10 hours all night sometimes longer, with no results at all. I am somewhat desperate, I am usually good at retrieving data from corrupt hard drives, but this is not the case. Call me paranoid, but I do not want to give it to someone to fix it for me, as I have a lot of photos and personal stuff that I do not want anyone to see.

    Read the article

  • Ragdoll continuous movement

    - by Siddharth
    I have created a ragdoll for my game but the problem I found was that the ragdoll joints are not perfectly implemented so they are continuously moving. Ragdoll does not stand at fix place. I here paste my work for that and suggest some guidance about that so that it can stand on fix place. chest = new Chest(pX, pY, gameObject.getmChestTextureRegion(), gameObject); head = new Head(pX, pY - 16, gameObject.getmHeadTextureRegion(), gameObject); leftHand = new Hand(pX - 6, pY + 6, gameObject.getmHandTextureRegion() .clone(), gameObject); rightHand = new Hand(pX + 12, pY + 6, gameObject .getmHandTextureRegion().clone(), gameObject); rightHand.setFlippedHorizontal(true); leftLeg = new Leg(pX, pY + 18, gameObject.getmLegTextureRegion() .clone(), gameObject); rightLeg = new Leg(pX + 7, pY + 18, gameObject.getmLegTextureRegion() .clone(), gameObject); rightLeg.setFlippedHorizontal(true); gameObject.getmScene().registerTouchArea(chest); gameObject.getmScene().attachChild(chest); gameObject.getmScene().registerTouchArea(head); gameObject.getmScene().attachChild(head); gameObject.getmScene().registerTouchArea(leftHand); gameObject.getmScene().attachChild(leftHand); gameObject.getmScene().registerTouchArea(rightHand); gameObject.getmScene().attachChild(rightHand); gameObject.getmScene().registerTouchArea(leftLeg); gameObject.getmScene().attachChild(leftLeg); gameObject.getmScene().registerTouchArea(rightLeg); gameObject.getmScene().attachChild(rightLeg); // head revolute joint revoluteJointDef = new RevoluteJointDef(); revoluteJointDef.enableLimit = true; revoluteJointDef.initialize(head.getHeadBody(), chest.getChestBody(), chest.getChestBody().getWorldCenter()); revoluteJointDef.localAnchorA.set(0f, 0f); revoluteJointDef.localAnchorB.set(0f, -0.5f); revoluteJointDef.lowerAngle = (float) (0f / (180 / Math.PI)); revoluteJointDef.upperAngle = (float) (0f / (180 / Math.PI)); headRevoluteJoint = (RevoluteJoint) gameObject.getmPhysicsWorld() .createJoint(revoluteJointDef); // // left leg revolute joint revoluteJointDef.initialize(leftLeg.getLegBody(), chest.getChestBody(), chest.getChestBody().getWorldCenter()); revoluteJointDef.localAnchorA.set(0f, 0f); revoluteJointDef.localAnchorB.set(-0.15f, 0.75f); revoluteJointDef.lowerAngle = (float) (0f / (180 / Math.PI)); revoluteJointDef.upperAngle = (float) (0f / (180 / Math.PI)); leftLegRevoluteJoint = (RevoluteJoint) gameObject.getmPhysicsWorld() .createJoint(revoluteJointDef); // right leg revolute joint revoluteJointDef.initialize(rightLeg.getLegBody(), chest.getChestBody(), chest.getChestBody().getWorldCenter()); revoluteJointDef.localAnchorA.set(0f, 0f); revoluteJointDef.localAnchorB.set(0.15f, 0.75f); revoluteJointDef.lowerAngle = (float) (0f / (180 / Math.PI)); revoluteJointDef.upperAngle = (float) (0f / (180 / Math.PI)); rightLegRevoluteJoint = (RevoluteJoint) gameObject.getmPhysicsWorld() .createJoint(revoluteJointDef); // left hand revolute joint revoluteJointDef.initialize(leftHand.getHandBody(), chest.getChestBody(), chest.getChestBody().getWorldCenter()); revoluteJointDef.localAnchorA.set(0f, 0f); revoluteJointDef.localAnchorB.set(-0.25f, 0.1f); revoluteJointDef.lowerAngle = (float) (0f / (180 / Math.PI)); revoluteJointDef.upperAngle = (float) (0f / (180 / Math.PI)); leftHandRevoluteJoint = (RevoluteJoint) gameObject.getmPhysicsWorld() .createJoint(revoluteJointDef); // right hand revolute joint revoluteJointDef.initialize(rightHand.getHandBody(), chest.getChestBody(), chest.getChestBody().getWorldCenter()); revoluteJointDef.localAnchorA.set(0f, 0f); revoluteJointDef.localAnchorB.set(0.25f, 0.1f); revoluteJointDef.lowerAngle = (float) (0f / (180 / Math.PI)); revoluteJointDef.upperAngle = (float) (0f / (180 / Math.PI)); rightHandRevoluteJoint = (RevoluteJoint) gameObject.getmPhysicsWorld() .createJoint(revoluteJointDef);

    Read the article

  • Timout dead connections to Digi PortServer TS16

    - by MT
    We are using Digi portservers for console management of our routers. Basically users telnet to the Digis on ports 2001-2016 (corresponding to the physical serial port they want to connect to). Does anyone know if there is a way to cause the digi to close/release a user's connection after an period of idle time and if possible, where that time can be specified?

    Read the article

  • What affects video encoding speeds?

    - by Pig Head
    FRAPs doesn't compress its videos when you record, so the files are enormous. In a long recording you can get up to a few hundred gigabytes. Obviously, usually you would need to convert/compress them. What affects the speed of this? I don't think the RAM does, as when I converted 600 gb my RAM usage only went to 6 gig, but the processor was at 100%, which is surprising as I have a 6 core processor @ 3.46 ghz. Would clock speed or cores help the most?

    Read the article

  • Is there a way to snip part of the screen with a hotkey?

    - by Head of Catering
    I'm able to launch the snipping tool, select an option and then copy based on my selection. Is there a way to launch a default snipping option so that I can create partial screen screenshots without using a third-party tool? Essentially, I'm looking for winkey+S without having to use OneNote. Both OneNote and SnagIt implement this perfectly. If OneNote is running, pressing winkey+S allows me to click and drag any portion of the screen, including pop-out menus with selections that are active. SnagIt does almost the exact same thing, invoked by the prt screen key.

    Read the article

  • When using gt5 in my home directory I get a blank page.

    - by MT
    When using gt5 in various directories on my system (including my home directory) I get blank results. If I limit the max-depth enough, I get results. For example, in my home directory 'gt5 --max-depth 2' produces a listing, while 'gt5 --max-depth 3' produces a blank page. I've noticed that the temporary html file that gets created in tmp (such as '/tmp/gt5.9035.kJVM08Y9/gt5.html' is a zero-byte file. I can successfully do a du in the same directory (which is what I thought gt5 was using), so I'm not sure what to check?

    Read the article

  • Query specific nameserver for a particular domain upon VPN connect

    - by MT
    Some background: I have a work laptop with Ubuntu 9.10 on it. I have a small network at home where I've been running some basic services (for myself/my family) for 10 some years. In my home network there is a nameserver (Fedora) running Bind 9 with two "views". One view is the "outside" view and it provides name resolution (to the Internet at large) for email, a wiki, and a couple of blogs. The "inside" view provides name resolution (to the internal RFC1918 addresses of theses servers) as well as all the inside hosts, network equipment, ...etc. I connect with an openvpn client to my home network from outside (such as work). What I'd like to be able to do is resolve names on my internal network across this VPN (so I get the RFC1918 "inside" responses) without fully changing my resolver to the DNS server at my hose. For example, if I connect to the VPN from work, I can change my resolver (by editing resolv.conf) to the DNS server at my house (across the VPN) and then successfully resolve all of the inside DNS names on my home network. The issue I have with this is that now I'm no longer able to resolve "inside" names provided by my work's DNS servers (because I'm using my home DNS server). Alternatively, I can connect to the VPN and access my home severs via IP addresses directly, but this is inconvenient and causes issues with Apache name-based hosting (among other things). In the end, the effect I'm trying to achieve is as follows: When I connect to the VPN I automatically start sending DNS requests for *.myhomedomain.com to my home nameserver, but any other requests continue to go the the nameserver I was using before (the one I received on my company LAN via DHCP). When I disconnect the VPN, requests for *.myhomedomain.com go back to the local LAN DNS server (e.g. all requests are going there now). I'm looking for suggestion at to how this can be accomplished.

    Read the article

  • Excel Subtotal if adjacent column is not blank

    - by Head of Catering
    I'm trying to create a subtotal for a range that excludes rows that don't have a wholesale price. I have a range of products, prices and units that have subtotals by brand, although the brand subtotal is a sum and not a subtotal because the total needs to be displayed regardless of what the user chooses to filter. These subtotal rows do not have wholesale prices. Here is the sumif formula I'm using to calculate totals in the summary area above the range: =SUMIF(B5:B12, "", D5:D12) I need to have a subtotal formula that works the same way. Is there an equivalent to the sumif formula for subtotals? Or maybe a worksheet function I can use? I need to be able to do this without using VBA.

    Read the article

  • JAVASCRIPT changing on click

    - by Webby
    Hello, Id like some help changing this javascript onclick event to just load the data on page the page load... Preferably not using the body on load tag... So obviously I'd pre set the var for term inside the script term rather than the excisting on click event.. Hope that made sense <p><a id="keywordlink" href="?term=wombats">Get keywords for wombats</a></p> <script type="text/javascript" src="keywords.js"></script> <script type="text/javascript"> var x = document.getElementById('keywordlink'); if(x){ x.onclick = function(){ var term = this.href.split('=')[1]; this.innerHTML += ' (loading...)'; KEYWORDS.get(term,seed); return false; } } function seed(o){ var div = document.createElement('div'); var head = document.createElement('h2'); head.innerHTML = 'Keywords for '+o.term; div.appendChild(head); var p = document.createElement('p'); p.innerHTML = o.toplist; div.appendChild(p); var head = document.createElement('h3'); head.innerHTML = 'Details:'; div.appendChild(head); var list = document.createElement('ol'); for(var i=0,j=o.keywords.length;i<j;i++){ var li = document.createElement('li'); li.innerHTML = o.keywords[i].term + '('+o.keywords[i].amount+')'; list.appendChild(li); } div.appendChild(list); x.parentNode.replaceChild(div,x); } </script>

    Read the article

  • create graph using adjacency list

    - by sum1needhelp
    #include<iostream> using namespace std; class TCSGraph{ public: void addVertex(int vertex); void display(); TCSGraph(){ head = NULL; } ~TCSGraph(); private: struct ListNode { string name; struct ListNode *next; }; ListNode *head; } void TCSGraph::addVertex(int vertex){ ListNode *newNode; ListNode *nodePtr; string vName; for(int i = 0; i < vertex ; i++ ){ cout << "what is the name of the vertex"<< endl; cin >> vName; newNode = new ListNode; newNode->name = vName; if (!head) head = newNode; else nodePtr = head; while(nodePtr->next) nodePtr = nodePtr->next; nodePtr->next = newNode; } } void TCSGraph::display(){ ListNode *nodePtr; nodePtr = head; while(nodePtr){ cout << nodePtr->name<< endl; nodePtr = nodePtr->next; } } int main(){ int vertex; cout << " how many vertex u wan to add" << endl; cin >> vertex; TCSGraph g; g.addVertex(vertex); g.display(); return 0; }

    Read the article

  • Frameset isn't working in IE

    - by Cameroon
    First of all, why use a frame set in the first place you ask? answer: Because my boss told me. That been said, I have 2 files. Index.html and Head.html. Contents of index.html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Site Title</title> </head> <frameset rows="122,*" FRAMEBORDER=NO FRAMESPACING=2 BORDER=0> <frame name="t" src="head.html" scrolling="no" marginheight="0" marginwidth="0"> <frame name="b" src="http://www.website.com"> </frameset> <noframes> <p>You have frames turned off on your browser, please turn it on and reload this page.</p> </noframes> </html> Contents of head.html: <div style="border-bottom:2px solid #000;height:120px"> <center>This is the frame head.</center> </div> The code works fine in all browsers except Internet Explorer 7 and 8 (I don't care about 6). Is there anything I am doing wrong, and if not then can the same effect be achieved without frames and if so how?

    Read the article

  • faster way to draw an image

    - by iHorse
    im trying to combine two images into a single image. unfortunately this has to be done very quickly in response to a user sliding a UISlider. i can combine the two images into a single image no problem. but the way I'm doing it is horribly slow. the sliders stick and jump rather frustratingly. i don't think i can throw the code into a background thread because i would run out of threads to quickly. i haven't actually tired that yet. below is my code. any ideas on how to speed it up would be helpful. UIGraphicsBeginImageContext(CGSizeMake(bodyImage.theImage.image.size.width * 1.2, bodyImage.theImage.image.size.height * 1.2)); [bodyImage.theImage.image drawInRect: CGRectMake(-2 + ((bodyImage.theImage.image.size.width * 1.2) - bodyImage.theImage.image.size.width)/2, kHeadAdjust, bodyImage.theImage.image.size.width * bodyImage.currentScale, bodyImage.theImage.image.size.height * bodyImage.currentScale)]; if(isCustHead) { [Head.theImage.image drawInRect: CGRectMake((bodyImage.theImage.image.size.width * 1.2 - headWidth)/2 - 11, 0, headWidth * 0.92, headWidth * (Head.theImage.image.size.height/Head.theImage.image.size.width) * 0.92)]; } else { [Head.theImage.image drawInRect: CGRectMake((bodyImage.theImage.image.size.width * 1.2 - (headWidth * defaultHeadAdjust))/2 - 10, 0, (headWidth * defaultHeadAdjust * 0.92), (headWidth * defaultHeadAdjust) * (Head.theImage.image.size.height/Head.theImage.image.size.width) * 0.92)]; } drawSurface.theImage.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();

    Read the article

  • Git graph with ref logs

    - by Francisco Garcia
    I am trying to improve my custom git log format string. I have almost everything I want except the ref names. I can already get a log similar to what I want: > git log --all --source --pretty=oneline --graph * b7c7ad3855b54e94ad7ac03f2d2e5b96d6e5ac1d refs/heads/b1 na | * 695e1482622a79230fa1d83afb8d70e86847334a refs/heads/master Merge branch 'b1' | |\ | |/ |/| * | ec21f370f82096c0208f43b390da234d92e8c74a refs/heads/b1 beta * | c6bc1f55ab3b1bd568493a5de4298dfcb4f66d8d refs/heads/b1 alfa * | 762dd868ae87753afc1cbf9803744c76f9a9e121 refs/heads/b1 tango | * 57fb27bff06ee9bb569f93ba815e9dcd69521c13 refs/heads/master little last post commit |/ | * 8d613d09b43152a7263b6e02d47ec8a4304f54be refs/heads/b3 the other commit | * e1f32b7cb86633351df06e37c2c58ef3f9fafc40 refs/heads/b3 something |/ | * 01b5c6728cf25dd576733211ce75dd3ecc29c7ba refs/heads/b2 this time a I am fighting to get a customized output with my own format string like this: > git log --pretty=format:'%h - %gD %s' --source -g b7c7ad3 - HEAD@{0} na ec21f37 - HEAD@{1} beta 01b5c67 - HEAD@{2} this time a 01b5c67 - HEAD@{3} this time a 695e148 - HEAD@{4} Merge branch 'b1' 57fb27b - HEAD@{5} little last post commit My main problem is that I cannot get the ref names I want. I assume it is one of the %g? format strings, but none of them seem to give me the full ref name. Another problem is that the %g? format strings are empty unless I walk the reflogs (-g). However git refuses to combine --graph with -g How can reproduce the first sample with a format string which I can further customize?

    Read the article

  • Extract title tags from normal text

    - by pravin
    I am working on one task, to extract title tag from given normal text ( it's not a HTML DOM ). I have below cases where need to extract title tag(s) : Case 1 : <html> <head> <title>Title of the document</title> </head> <body> The content of the document...... </body> </html> Expected : Title of the document Case 2 : <html> <head> <title>Title of the document</title> <title>Continuing title</title> </head> <body> The content of the document...... </body> </html> Expected : Title of the document Continuing title Case 3 (Nested title tags) <html> <head> <title>Title of the document <title>Continuing title</title></title> </head> <body> The content of the document...... </body> </html> Expected : Title of the document Continuing title I wanted to extract title tags using regular expression in javascript. Reg-ex should work for above case. Is anyone knows about this..please let me know... Thanks in Advance

    Read the article

  • HTML converted to jQuery collection not searchable with selectors?

    - by jimp
    I am trying to dynamically load a page using $.get(), parse the return with var $content = $(data), and ultimately use selectors to find only certain parts of the document. Only I cannot figure out why the jQuery collection returned from $(data) does not find some very basic selectors. I set up a jsFiddle to illustrate the problem using a very small string of HTML. <html> <head> <title>See Our Events</title> </head> <body><div id="content">testing</div></body> </html> I want to find the <title> node. var html = "<html>\n"+ "<head>\n"+ " <title>See Our Events</title>\n"+ "</head>\n"+ "<body><div id=\"content\">testing</div></body>\n"+ "</html>"; var $content = $(html); console.log($content.find('title').length); // Logs 0. Why? If I wrap a <div> around the HTML, then the selector works. (But if you look at the jsFiddle, other variations of the selector still do not work!) var html = "<div><html>\n"+ "<head>\n"+ " <title>See Our Events</title>\n"+ "</head>\n"+ "<body><div id=\"content\">testing</div></body>\n"+ "</html></div>"; var $content = $(html); console.log($content.find('title').length); // Logs 1. Please look at the jsFiddle, too. It contains more examples than my code here to keep the post easier to read. Why does my otherwise very basic selector not return the title node?

    Read the article

  • How to implement a simple queue properly?

    - by Stephen Hsu
    The current Go library doesn't provide the queue container. To implement a simple queue, I use circle array as the underlying data structure. It follows algorithms mentioned in TAOCP: Insert Y into queue X: X[R]<-Y; R<-(R+1)%M; if R=F then OVERFLOW. Delete Y from queue X: if F=R then UNDERFLOW; Y<-X[F]; F<-(F+1) % M. F: Front, R: Rear, M: Array length. Following is the code: package main import ( "fmt" ) type Queue struct { len int head, tail int q []int } func New(n int) *Queue { return &Queue{n, 0, 0, make([]int, n)} } func (p *Queue) Enqueue(x int) bool { p.q[p.tail] = x p.tail = (p.tail + 1) % p.len return p.head != p.tail } func (p *Queue) Dequeue() (int, bool) { if p.head == p.tail { return 0, false } x := p.q[p.head] p.head = (p.head + 1) % p.len return x, true } func main() { q := New(10) for i := 1; i < 13; i++ { fmt.Println(i, q.Enqueue(i)) } fmt.Println() for i := 1; i < 13; i++ { fmt.Println(q.Dequeue()) } } But the output is obviously wrong: 1 true 2 true 3 true 4 true 5 true 6 true 7 true 8 true 9 true 10 false 11 true 12 true 11 true 12 true 0 false 0 false 0 false 0 false 0 false 0 false 0 false 0 false 0 false 0 false I think I need one more field to make the code work properly. What do you suggest?

    Read the article

  • Problem painting JLabel class to another JPanel class

    - by jjpotter
    I have created a class that extends JLabel to use as my object moving around a JPanel for a game. import javax.swing.*; public class Head extends JLabel { int xpos; int ypos; int xvel; int yvel; ImageIcon chickie = new ImageIcon("C:\\Users\\jjpotter.MSDOM1\\Pictures\\clavalle.jpg"); JLabel myLabel = new JLabel(chickie); public Head(int xpos, int ypos, int xvel, int yvel){ this.xpos = xpos; this.ypos = ypos; this.xvel = xvel; this.yvel = yvel; } public void draw(){ myLabel.setLocation(xpos, ypos); } public double getXpos() { return xpos; } public double getYpos() { return ypos; } public int getXvel() { return xvel; } public int getYvel() { return yvel; } public void setPos(int x, int y){ xpos = x; ypos = y; } } I am then trying to add it onto my JPanel. From here I will randomly have it increment its x and y coordinates to float it around the screen. I can not get it to paint itself onto the JPanel. I know there is a key concept I am missing here that involves painting components on different panels. Here is what I have in my GamePanel class import java.awt.Dimension; import java.util.Random; import javax.swing.*; public class GamePanel extends JPanel { Random myRand = new Random(); Head head = new Head(20,20,0,0); public GamePanel(){ this.setSize(new Dimension(640, 480)); this.add(head); } } Any suggestions on how to get this to add to the JPanel? Also, is this a good way to go about having the picture float around the screen randomly for a game?

    Read the article

  • controlling css with javascript works with mozilla but not with webkit based browsers

    - by GlassGhost
    Im having problems with applying css text variable in this javascript with webkit based browsers(Chrome & Safari) but it works in firefox 3.6 the function: function addGlobalStyle(sCss) { var head = document.getElementsByTagName('head')[0]; if( !head || head == null ) { return false; } var oStyle = document.createElement('style'); oStyle.type = 'text/css'; oStyle.rel = 'stylesheet'; oStyle.media = 'screen'; if ( is_gecko ) { // firefox WORKING !!! oStyle.href = 'FireFox.css'; oStyle.innerHTML = sCss; head.appendChild(oStyle); return true; } else {//nothing but firefox works oStyle.href = 'FireFox.css'; oStyle.innerHTML = sCss; head.appendChild(oStyle); return true; } } the use of the function: var NewSyleText = //The page styling "h1, h2, h3, h4, h5 {font-family: 'Verdana','Helvetica',sans-serif; font-style: normal; font-weight:normal;}" + "body, b {background: #fbfbfb; font-style: normal; font-family: 'Cochin','GaramondNo8','Garamond','Big Caslon','Georgia','Times',serif;font-size: 11pt;}" + "p { margin: 0pt; text-indent:2.5em; margin-top: 0.3em; }" + "a { text-decoration: none; color: Navy; background: none;}" + "a:visited { color: #500050;}" + "a:active { color: #faa700;}" + "a:hover { text-decoration: underline;}"; addGlobalStyle(NewSyleText);//inserts the page styling

    Read the article

  • HeadJS ready for both document and script

    - by Yashua
    Current code: head.ready(function() { console.log($('.thing a').val()); }); It will sometimes fail with error that $ is not ready. I have loaded jquuery earlier with the label 'jquery'. Neither of these work: head.ready(document, function() { console.log($('.thing a').val()); }); head.ready('jquery', function() { console.log($('.thing a').val()); }); I would like to not do this if possible: head.ready(document, function() { head.ready('jquery', function() { console.log($('.thing a').val()); }); }); And also avoid refactoring current code to place that snippet at bottom of body though that I think may be the solution. Is it possible with HeadJS to define a ready call() using head.ready(), that is not placed at the bottom, that will wait for both a labeled script and the DOM to be loaded? UPDATE: the nested script doesn't actually work. I think the inner one erases/superseds the other :(

    Read the article

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