Search Results

Search found 21 results on 1 pages for 'derp derpington'.

Page 1/1 | 1 

  • Should *'s go next to the type or the variable name? [closed]

    - by derekerdmann
    Possible Duplicate: int* i; or int *i; or int * i; When working in C or C++, how should pointers be declared? Like this: char* derp; or this: char *derp; I typically use the first method, because the variable is a character pointer, but I know that it can create confusion when declaring multiple variables at once: char* herp, derp; herp becomes a character pointer, while derp is just a character. I know it often comes down to coding style, but which one is "better?" Should I sacrifice clarity to eliminate potential confusion?

    Read the article

  • How to convert a function that returns a int to a function that returns a bool using boost::bind?

    - by user814628
    I have something like the following: struct A{ virtual int derp(){ if(herp()) return 1; else return 0; } void slurp(){ boost::function<bool(int x, int y> purp = /** boost bind derp to match lvalue sig **/; } } Any ideas? I want to create the function prup which basically calls derp and ignores the (x,y) passed in. I need something like bool purp(int x, int y){ return derp(); } but want to avoid creating it as a member function, and rather just create it locally if possible?

    Read the article

  • How to emulate mod_rewrite in PHP

    - by Tyler Crompton
    I have a few URLs that I want to map to certain files via PHP. Currently, I am just using mod_rewrite in Apache. However, my application is getting too large for the rewriting to be done with regular expressions. So I created a file router.php that does the rewriting. I understand to do a redirect I could just send the Location: header. However, I don't always want to do a redirect. For example, I may want /api/item/ to map to the file /herp/derp.php relative to the document root. I need to preserve the HTTP method as well. "No problem," I thought. I made my .htaccess have the following snippet. RewriteEngine On RewriteRule ^api/item/$ /cgi-bin/router.php [L] And my router.php file looks as follows: <?php $uri = parse_url($_SERVER['REQUEST_URI']); $query = isset($uri['query']) ? $uri['query'] ? array(); // some code that modifies the query require_once "{$_SERVER['DOCUMENT_ROOT']}/herp/derp.php?" . http_build_query($query); ?> However, this doesn't work, because the OS is looking for a file named derp.php?some=query. How can I simulate a rewrite rule such as RewriteRule ^api/item/$ /herp/derp/ [L] in PHP. In other words, how do I tell the server to process a different URL than requested and preserve the query and HTTP method without causing a redirect? Note: Using variables set in router.php is less than desirable and is bad structure since it's only supposed to be responsible for handling URLs. I am open to using a light-weight third party solution.

    Read the article

  • php-fpm: very high server load

    - by Derp Derpington
    Since today my webserver (nginx + php-fpm + mysql on a VPS) is very slow. htop says: 1 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Tasks: 63 total, 13 running 2 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Load average: 11.67 10.95 6.95 3 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Uptime: 00:18:40 4 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] 5 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] 6 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Mem[||||||||||| 137/1280MB] Swp[ 0/0MB] PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 6802 www 20 0 76232 12320 5716 R 27.0 0.9 0:06.48 php-fpm: pool www 7048 www 20 0 75200 12136 5700 R 52.0 0.9 0:03.64 php-fpm: pool www 6699 www 20 0 74176 11124 5700 R 27.0 0.8 0:07.36 php-fpm: pool www 7029 www 20 0 73668 10380 5676 R 42.0 0.8 0:03.52 php-fpm: pool www 6995 www 20 0 76228 12456 5644 R 42.0 1.0 0:03.98 php-fpm: pool www 6858 www 20 0 74172 10684 5620 R 35.0 0.8 0:05.52 php-fpm: pool www 6998 www 20 0 75200 12072 5620 R 37.0 0.9 0:03.95 php-fpm: pool www 7098 www 20 0 75200 12052 5616 R 42.0 0.9 0:02.33 php-fpm: pool www 7093 www 20 0 76228 12496 5612 R 37.0 1.0 0:03.02 php-fpm: pool www 7226 www 20 0 74692 11080 5588 R 32.0 0.8 0:00.66 php-fpm: pool www CPU: (cat /proc/cpuinfo | grep model) model : 44 model name : Intel(R) Xeon(R) CPU E5620 @ 2.40GHz model : 44 model name : Intel(R) Xeon(R) CPU E5620 @ 2.40GHz model : 44 model name : Intel(R) Xeon(R) CPU E5620 @ 2.40GHz model : 44 model name : Intel(R) Xeon(R) CPU E5620 @ 2.40GHz model : 44 model name : Intel(R) Xeon(R) CPU E5620 @ 2.40GHz model : 44 model name : Intel(R) Xeon(R) CPU E5620 @ 2.40GHz I think a load of 10 and 100% cpu usage is not normal... How can i fix that?

    Read the article

  • Is my DFD accurate?

    - by Dummy Derp
    This is my first ever DFD that I made after my fair share of learning but I have no way of verifying whether it is correct or not. Although I have taken utmost care to make sure it is right, I may be wrong. Here is the scenario: Bebop Records is a mail-order company that distributes CDs and tapes at discount prices to record club members. When an order processing clerk receives an order form, he or she verifies that the sender is a club member by checking the Member file. If the sender is not a member, the clerk returns the order along with a membership application form. If the customer is a member, the clerk verifies the order item data by checking the Item file. Then the clerk enters the order data and saves it to the Daily Order file. The clerk also prints an invoice and shipping list for each order, which are forwarded to Order Fulfilment. And here is my diagram:

    Read the article

  • Is my sequence diagram correct?

    - by Dummy Derp
    NOTE: I am self studying UML so I have nobody to verify my diagrams and hence I am posting here, so please bear with me. This is the problem I got from some PDF available on Google that simply had the following problem statement: Problem Statement: A library contains books and journals. The task is to develop a computer system for borrowing books. In order to borrow a book the borrower must be a member of the library. There is a limit on the number of books that can be borrowed by each member of the library. The library may have several copies of a given book. It is possible to reserve a book. Some books are for short term loans only. Other books may be borrowed for 3 weeks. Users can extend the loans. Draw a use case diagram for a library. I already drew the Use Case diagram and had it checked by a community member. This time I drew sequence diagrams for borrowing a book and extending the date of return. Please let me know if they are correct. I drew them using Visual Paradigm and I dont know how to keep a control of the sequence numbers. If you do, please let me know :) Diagrams

    Read the article

  • Is my use case diagram correct?

    - by Dummy Derp
    NOTE: I am self studying UML so I have nobody to verify my diagrams and hence I am posting here, so please bear with me. This is the problem I got from some PDF available on Google that simply had the following problem statement: Problem Statement: A library contains books and journals. The task is to develop a computer system for borrowing books. In order to borrow a book the borrower must be a member of the library. There is a limit on the number of books that can be borrowed by each member of the library. The library may have several copies of a given book. It is possible to reserve a book. Some books are for short term loans only. Other books may be borrowed for 3 weeks. Users can extend the loans. 1. Draw a use case diagram for a library. 2. Give a use case description for two use cases: • Borrow copy of book • Extend loan Diagram: Use case description: 1. Borrow a copy of the book: If the person wishes to borrow a book from Derpville Public Library, he/she must be a member of the library in which case they will be allowed to issue a certain number of books. If the person is not a member, the book will not be issued to them for taking away, rather they will have to sit and read in the library. 2. Extending loan: Some books will be lent for 3 weeks while others will be lent for more than 3 weeks in which case the person borrowing has to come to the library and get the date extended. There is a limit on how much the user can extend the date of a particular book.

    Read the article

  • How fast does a language get outdated?

    - by Dummy Derp
    I started learning Java recently. I started learning it using books that I picked up from the library, some that I bought, and here and there from Java documentation. The book that I use for Java was published in the year 2011. In 2012, Java8 will be released followed by Java9 in the year 2013. The questions are: How do I keep myself updated about developments in Java without having to buy a tome for Java8 and/or Java9 Is a book published in 2008 an outdated book for studying JSP and Servelets? I'm talking about Head First Servlets and JSP

    Read the article

  • How does eMail encryption work?

    - by Dummy Derp
    I have been going over YouTube watching videos on eMail encryption and everyone seems to explain it from a different perspective. Some do it for a CompTIA exam while others just provide a primer. Here is what I understood: Step1: You compose an email that you want to send. Without encryption, it will be simple ASCII text that will be visible to anyone along the way. Step2: You generate a digital signature to make sure that nobody gets to re-transmit your email and claim it was you. Digital Signature is generated using Sender's private key which is usually a hash of the password and is then combined with the original message to form one long hash string. These signatures are one-time-use-only and a new one is calculated for every email. Step 3: You encrypt the compose of your email using Receiver's public key so that the only person who can read it is the intended receiver using their private key Step 4: When you hit the send the email, what is transmitted now is gibberish to everyone apart from the intended receiver who will decrypt is using their private key And there are various ways to do it like PEM, PGP, etc. Correct me where I am wrong or refine where necessary.

    Read the article

  • How are Java ByteBuffer's limit and position variable's updated?

    - by Dummy Derp
    There are two scenarios: writing and reading Writing: Whenever I write something to the ByteBuffer by calling its put(byte[]) method the position variable is incremented as: current position + size of byte[] and limit stays at the max. If, however, I put the data in a view buffer then I will have to, manually, calculate and update the position Before I call the write(ByteBuffer) method of the channel to write something, I will have to flip() the Bytebuffer so that position points to zero and limit points to the last byte that was written to the ByteBuffer. Reading: Whenever I call the read(ByteBuffer) method of a channel to read something, the position variable stays at 0 and the limit variable of the ByteBuffer points to the last byte that was read. So, if the ByteBuffer is smaller than the file being read, the limit variable is pushed to max This means that the ByteBuffer is already flipped and I can proceed to extracting the values from the ByteBuffer. Please, correct me where I am wrong :)

    Read the article

  • How do PGP and PEM differ?

    - by Dummy Derp
    Email messages are sent in plain text which means that the messages I send to Derpina are visible to anyone who somehow gets access to them while they are in transit. To overcome this, various encryption mechanisms were developed. PEM and PGP are two of them. PEM - canonically converts-adds digital signature-encrypts and sends PGP does exactly the same. So where do they differ? Or is it that PGP (being a program) is used to generate a PEM message?

    Read the article

  • How quickly does the Java language get outdated?

    - by Dummy Derp
    I started learning Java recently. I started learning it using books that I picked up from the library, some that I bought, and here and there from Java documentation. The book that I use for Java was published in the year 2011. In 2012, Java8 will be released followed by Java9 in the year 2013. The questions are: How do I keep myself updated about developments in Java without having to buy a tome for Java8 and/or Java9 Is a book published in 2008 an outdated book for studying JSP and Servelets? I'm talking about Head First Servlets and JSP

    Read the article

  • Is there a difference between multi-tasking and time-sharing?

    - by Dummy Derp
    Just going over my school notes, my teacher identifies multi-tasking OS, and time-sharing OS as two different things. I really don't see a difference between the two. MULTI-TASKING: You load a number of programs in the memory and execute them. You execute another program if the time quantum allocated to the current program expires OR if it goes on to do I/O and leaves the CPU OR if it finishes execution. TIME-SHARING: the same,again. The same applies in case of serial processing and batch processing. Although they are the same, I guess the only difference would be the way in which control information is passed to the CPU. Maybe, and again MAYBE, in serial processing you need to provide the punch cards with all the processes while in batch, the entire batch uses the same set of control information. Like all the print jobs would have the same control information.

    Read the article

  • Where will the image be saved? [closed]

    - by Dummy Derp
    import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import java.io.File; ... public void captureScreen(String fileName) throws Exception { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Rectangle screenRectangle = new Rectangle(screenSize); Robot robot = new Robot(); BufferedImage image = robot.createScreenCapture(screenRectangle); ImageIO.write(image, "png", new File(fileName)); } ... Going over this code I found on the internet. I got everything except the part where file is created. In what format file name should be? Should it be C:/myFolder/myImage.png" or just myImage.png and where will it be saved? Here is what docs say: File public File(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname. If the given string is the empty string, then the result is the empty abstract pathname. Parameters: pathname - A pathname string Throws: NullPointerException - If the pathname argument is null

    Read the article

  • How quickly does a language get outdated?

    - by Dummy Derp
    I started learning Java recently. I started learning it using books that I picked up from the library, some that I bought, and here and there from Java documentation. The book that I use for Java was published in the year 2011. In 2012, Java8 will be released followed by Java9 in the year 2013. The questions are: How do I keep myself updated about developments in Java without having to buy a tome for Java8 and/or Java9 Is a book published in 2008 an outdated book for studying JSP and Servelets? I'm talking about Head First Servlets and JSP

    Read the article

  • Cached css/javascript files on Sun Java System Web Server

    - by Derp
    I'm doing front-end web development in a Solaris 10 / Sun Java System Web Server 7.0U2 environment. I have noticed that changes to static css or javascript files often do not take effect immediately, whereas changes to static html files always do. My best guess is that a default setting in the web server causes it to cache certain file types in order to provide reasonable performance out of the box. I don't have the admin server running--I'll need to edit the config files by hand. What change(s) can I make so that all of my css and javascript edits take effect immediately? Thanks!

    Read the article

  • Add entry to list and remove first one in Python

    - by wagglewax
    I have a list of about 40 entries. And I frequently want to append an item to the start of the list (with id 0) and want to delete the last entry (with id 40) of the list. how do i do this the best? like: (example with 5 entries) [0] = "herp" [1] = "derp" [2] = "blah" [3] = "what" [4] = "da..." after adding "wuggah" and deleting last it should be like: [0] = "wuggah" [1] = "herp" [2] = "derp" [3] = "blah" [4] = "what" or appending one and deleting first. And I don't want to end up manually moving them one after another all of the entries to the next id.

    Read the article

  • Printing a field with additional dots in haskell

    - by Frank Kluyt
    I'm writing a function called printField. This function takes an int and a string as arguments and then then prints a field like this "Derp..." with this: printField 7 "Derp". When the field consists of digits the output should be "...3456". The function I wrote looks like this: printField :: Int -> String -> String printField x y = if isDigit y then concat(replicate n ".") ++ y else y ++ concat(replicate n ".") where n = x - length y This obviously isn't working. The error I get from GHC is: Couldn't match type `[Char]' with `Char' Expected type: Char Actual type: String In the first argument of `isDigit', namely `y' In the expression: isDigit y In the expression: if isDigit y then concat (replicate n ".") ++ y else y ++ concat (replicate n ".") I can't get it to work :(. Can anyone help me out? Please keep in mind that I'm new to Haskell and functional programming in general.

    Read the article

  • (solved) jQuery click and drag/scroll window: jagged movement

    - by Josh
    Edit: derp, using pageX/Y instead of clientX/Y -- apparently scrollBy expects input with that offset rather than the other. Jaggy movement gone. I am getting jagged movement when doing small scroll increments using the following bindings. Can anyone point me in the right direction for how to smooth this out? FYI, its intermittent. It seems like, if I click and hold for a second, then drag at a decent speed there are no problems. Edit: What the hell? I get this output on debug... obvious jog backwards and forwards. This will happen in succession and seems to have no correlation with the mouse, other than the mouse is moving. x 398 : 403 y 374 : 377 x 403 : 399 y 377 : 374 x 399 : 404 y 374 : 377 Josh sococo.client.panMap = function(e){ e.preventDefault(); var movex = sococo.client.currX - e.pageX ; var movey = sococo.client.currY - e.pageY; console.log( sococo.client.currX +" : " + e.pageX ); window.scrollBy(movex,movey); sococo.client.currY = e.pageY; sococo.client.currX = e.pageX; } $(document).mousedown( function(e){ e.preventDefault(); sococo.client.currX = e.pageX; sococo.client.currY = e.pageY; $(document).bind( "mousemove", sococo.client.panMap ); }); $(document).mouseup( function(e){ e.preventDefault(); $(document).unbind( "mousemove", sococo.client.panMap ); });

    Read the article

  • Weird margin in a list

    - by kevin
    I'm trying to style a menu, but I keep running into this weird margin that's appearing in both FF4 and IE. This is the only affecting css: #header ul { display: inline; } #header ul li { list-style-type: none; background: #000; display: inline; margin: 0; padding: 0; } #header ul li a { color: #fff; text-decoration: none; display: inline-block; width: 100px; text-align: center; } And this is the HTML: <div id="header"> <ul id="toplinks"> <li><a href="#">Hello</a></li> <li><a href="#">Herp</a></li> <li><a href="#">Derp</a></li> </ul> </div> As you can see, there's a margin appearing on both sides, and I'd like it so it would have no margin (or maybe 1px would be okay)...

    Read the article

  • Wrong data retrieved from database

    - by holyredbeard
    So, I want to retrieve the order of the elements of a list. The order is set before by the user, and are stored in the table below. Because I also want to retrieve name and description of the list elements I need to combine two tables (see below). However, what is actually retrieved is an array containing 16 elements (should be four because it only exists four elements as for now). The array is too long to post here, but I put it in a phpFiddle to be found here if you're interested. Well, I have really tried to find what's wrong (probably something easy as always), but with no luck. Thanks a lot for your time and help! listModel.php: public function GetOrderedElements($userId, $listId) { // $userId = 46 // $listId = 1 $query = "SELECT le.listElemId, le.listElemName, le.listElemDesc, lo.listElemOrderPlace FROM listElement AS le INNER JOIN listElemOrder AS lo ON le.listId = lo.listId WHERE lo.userId = ? AND lo.listId = ? ORDER BY listElemId"; $stmt = $this->m_db->Prepare($query); $stmt->bind_param("ii", $userId, $listId); $listElements = $this->m_db->GetOrderedElements($stmt); return $listElements; } database.php: public function GetOrderedElements(\mysqli_stmt $stmt) { if ($stmt === FALSE) { throw new \Exception($this->mysqli->error); } if ($stmt->execute() == FALSE) { throw new \Exception($this->mysqli->error); } if ($stmt->bind_result($listElemId, $listElemName, $listElemDesc, $listElemOrderPlace) == FALSE) { throw new \Exception($this->mysqli->error); } $listElements = array(); while ($stmt->fetch()) { $listElements[] = array('listElemId' => $listElemId, 'listElemName' => $listElemName, 'listElemDesc' => $listElemDesc, 'listElemOrderPlace' => $listElemOrderPlace); } var_dump($listElements); $stmt->Close(); return $listElements; } from the database: listElemOrder: listElemOrderId | listId | listElemId | userId | listElemOrderPlace 1 1 1 46 1 2 1 2 46 4 3 1 3 46 2 4 1 4 46 3 listElement: listElemId | listElemName | listId | listElemDesc | listElemOrderPlace 1 Elem A 1 Derp NULL 2 Elem B 1 Herp NULL 3 Elem C 1 Lorum NULL 4 Elem D 1 Ipsum NULL Note: 'listElemOrderPlace' in the table listElement is the final order of the elements (all users average), not to be mixed with the one with the same name in the other table, that's only a specific user's order of the list elements (which is the interesting one in this case).

    Read the article

1