Search Results

Search found 101 results on 5 pages for 'nils pipenbrinck'.

Page 4/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Calling constructors in c++ without new

    - by Nils
    I've often seen that people create objects in C++ using Thing myThing("asdf"); Instead of Thing myThing = myThing("asdf"); This seems to work (using gcc), at least as long as there are no templates involved. My question now, is the first line correct and if so should I use it?

    Read the article

  • Using pragma once in a C++ project in Xcode 4

    - by Nils
    I know that #pragma once is non-standard, however it is supported by most compilers. So on my Mac I can compile C++ code with headers that use #pragma once on the command line using clang++. The strange thing however is that it does not seem to work within Xcode. I get Invalid preprocessing directive when I try to use #pragma once. I am using the newest version of OSX (10.8.2) and Xcode (Version 4.5.1 (4G1004)).

    Read the article

  • Confusion over C++ new operator and classes

    - by Nils
    Hi all I created a simple class in C++ which has a private dynamic array. In the constructor I initialize the array using new and in the destructor I free it using delete. When I instantiate the class using Class a = Class(..); it works as expected, however it seems I cannot instantiate it using the new operator (Like Class *a = new Class(..);), I always get a segmentation fault. What I don't understand is when I should use new to instantiate a class and when just call the constructor or should it be possible to instantiate a class either with new or by just calling the constructor. float** A = new float*[3]; for (int i=0; i<3; i++) { A[i] = new float[3]; } A[0][0] = 3; A[0][1] = 3; A[0][2] = 4; A[1][0] = 5; A[1][1] = 6; A[1][2] = 7; A[2][0] = 1; A[2][1] = 2; A[2][2] = 3; Matrix *M = new Matrix(A, 3, 3); delete[] A; delete M; Below the class definition.. class Matrix { private: int width; int height; int stride; float* elements; public: Matrix(float** a, int n, int m); ~Matrix(); }; Matrix::Matrix(float** a, int n, int m) { // n: num rows // m: elem per rows elements = new float[n*m]; for (int i=0; i<n; i++) { for (int j=0; j<m; j++) { elements[i*n + j] = a[n][m]; } } } Matrix::~Matrix() { delete[] elements; }

    Read the article

  • How to create a 2D map of room by a few images/movie frames ?

    - by Nils
    I'd like to create a simple 2D map of a room by getting pictures (ceiling) of all directions (360° - e.g. movie frames), recognize the walls by edge detection, delete other unwanted objects, concat the images at the right position (cf. walls, panorama) and finally create the approximate 2D map (looking on it from above). Getting the scale would be another parameter, which might be useful. I have some own ideas at the moment, by using e.g. the Sobel algorithm, but it would be interesting if somebody out there knows some project or software (GPL,freeware prefered) doing this already, as I'm still looking for some examples, which might help me. Thanks.

    Read the article

  • How to properly design a simple favorites and blocked table?

    - by Nils Riedemann
    Hey, i am currently writing a webapp in rails where users can mark items as favorites and also block them. I came up two ways and wondered which one is more common/better way. 1. Separate join tables Would it be wise to have 2 tables for this? Like: users_favorites - user_id - item_id users_blocked - user_id - item_id 2. single table users_marks (or so) - users_id - item_id - type (["fav", "blk"]) Both ways seem to have advantages. Which one would you use and why?

    Read the article

  • Solve Physics exercise by brute force approach..

    - by Nils
    Being unable to reproduce a given result. (either because it's wrong or because I was doing something wrong) I was asking myself if it would be easy to just write a small program which takes all the constants and given number and permutes it with a possible operators (* / - + exp(..)) etc) until the result is found. Permutations of n distinct objects with repetition allowed is n^r. At least as long as r is small I think you should be able to do this. I wonder if anybody did something similar here..

    Read the article

  • Calculating a parabola: What am I doing wrong? [closed]

    - by Nils
    I was following this thread and copied the code in my project. Playing around with it turns out that it seems not to be very precise. Recall the formula: y = ax^2 + bx +c Since the first given point I have is at x1 = 0, we already have c=y1 . We just need to find a and b. Using: y2 = ax2^2 + bx2 +c y3 = ax3^2 + bx3 +c Solving the equations for b yields: b = y/x - ax - cx Now setting both equations equal to each other so b falls out y2/x2 - ax2 - cx2 = y3/x3 - ax3 - cx3 Now solving for a gives me: a = ( x3*(y2 - c) + x2*(y3 - c) ) / ( x2*x3*(x2 - x3) ) (is that correct?!) And then using again b = y2/x2 - ax2 - cx2 to find b. However so far I haven't found the correct a and b coeffs. What am I doing wrong?

    Read the article

  • C++ methods which take templated classes as argument.

    - by Nils
    I have a templated class Vector<class T, int N> Where T is the type of the components (double for example) and n the number of components (so N=3 for a 3D vector) Now I want to write a method like double findStepsize(Vector<double,2> v) {..} I want to do this also for three and higher dimensional vectors. Of course I could just introduce further methods for higher dimensions, but the methods would have a lot of redundant code, so I want a more generic solution. Is there a way to create a method which takes a templated class without further specializing it (in this case without specifying T or N)? Like double findStepsize(Vector<T,N> v) ?

    Read the article

  • Data Flow Diagram

    - by Nilesh
    Can anyone help me to draw a data flow diagram for a travel request form for a company in which an employee can request for travel and request approval by his/her by project manager and HR department. Regards Nils

    Read the article

  • multipleview inside update panel

    - by Nilesh
    hi.......... i have create a two views inside multiview and also put two radio buttons above the multiview. now check changed on radio button according to view is display. now i want to use update panel in this page because at the time of check changed hall page is load.... how to put update panel on radio button....??? plz help me out regards Nils

    Read the article

  • DATA command hangs

    - by Tharban
    Hello, what can i do, if a Mailserver accepts a connection but does not return any data? The default javax.mail implementation just hangs indefinitley. Event setting the smtp.timeout does not help - it still hangs. I even tried to set a custom SocketFactory to set the sotimeouts and solinger directly, but it still hangs. Somehow the socket does get kept alive? But how? Thx for any ideas! Ciao, Nils

    Read the article

  • gnu screen - changing the default escape command key to ALT-X?

    - by Siva
    In GNU screen, I want to change the default command binding to Alt-s (by tweaking .screenrc) instead of the default C-a, the reason is I use emacs hence GNU screen binds the C-a key, sending "C-a" to the emacs becomes tedious (as @Nils said, to send "C-a" I should type "C-a a"), as well as "C-a" in bash shell, and I could change the escape to C- but some of them are already mapped in emacs and other combinations are not as easy as ALT-s . If anyone has already done a ALT key mapping, please do let me know.

    Read the article

  • Error found - too many arguments to method call expected 1 have 2 - in app email

    - by Anthony Farah
    There seems to be an error with my coding, and it says that there are to many nils or something I need help MFMailComposeViewController *composer = [[MFMailComposeViewController alloc]init]; if ([MFMailComposeViewController canSendMail]) { [composer setToRecipients:[NSArray arrayWithObject:@"[email protected]", nil]]; [composer setSubject:nil];[composer setMailComposeDelegate:self]; [composer setMessageBody:nil isHTML:YES]; [composer setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];

    Read the article

  • A Simple Solution For NetBeans RCP Apps That Need A Groovy Editor

    - by Geertjan
    Take a look at Nils Hoffmann's metabolomic analyzer, especially at the Groovy editor contained within it: Obviously, it would be cool if the Groovy editor in the app above were to have syntax coloring and other editor features helpful in coding Groovy. However, as I showed in If You Include the Groovy Editor, there are multiple dependencies that the NetBeans Groovy support has on other modules that would be completely superfluous in the above application, while they'd make the app much heavier than it is, simply because of all the Groovy dependencies. But today I thought of a simple solution. Why not take the Groovy.g file (i.e., the ANTLR definition), such as this one [though that's probably not the most up to date one, wondering how to find the most up to date one] and then apply the content of this screencast (made by me) to the Groovy.g file: Within a few minutes, you should end up with Groovy syntax coloring. OK, so that's not a full blown Groovy editor, but syntax coloring is surely a cool thing to have in the app with which this blog entry started? Sure, this means creating a new Groovy editor from scratch. But the point is that doing so can be very simple, i.e., the syntax coloring can simply be generated via the simple instructions above. I'm going to try it myself in the next few days, but would be cool if others out there would try this too!

    Read the article

  • Route multiple subdomains on one external ip to multiple internal ips

    - by Abenil
    i have several subdomains(git.example.org, build.example.org, etc.), i have a router with an external ip and i have several virtual machines on a host computer with internal ips. Now i want to route git.example.org to internal ip 10.0.2.1 and build.example.org to internal ip 10.0.2.2. How can I do this? I setup in the Router that all traffic on port 80 is comming to my host computer with internal ip 10.0.2.3 and installed Squid on that computer. I added the following lines to the squid.conf file: cache_peer 10.0.2.1 parent 80 0 no-query originserver name=server_1 cache_peer_domain server_1 git.example.org cache_peer 10.0.2.2 parent 80 0 no-query originserver name=server_2 cache_peer_domain server_2 build.example.org But this is not working for me. :( Any help appreciated. Regards Nils Update: Here is the solution for Apache http://serverfault.com/a/273693

    Read the article

  • Assign to an array and replace emerged nil values

    - by Tobias
    Greetings! When assigning a value to an array as in the following, how could I replace the nils by 0? array = [1,2,3] array[10] = 2 array # => [1, 2, 3, nil, nil, nil, nil, nil, nil, nil, 2] If not possible when assigning, how would I do it the best way afterwards? I thought of array.map { |e| e.nil? ? 0 : e }, but well… Thanks!

    Read the article

  • How to convert code to properly release memory

    - by BankStrong
    I've taken over a code base that has subtle flaws - audio player goes mute, unlogged crashes, odd behavior, etc. I found a way to provoke one instance of the problem and tracked it to this code snippet: NSURL *soundURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:[[soundsToPlay objectAtIndex:count] description] ofType:@"mp3"]]; self.audioPlayer = nil; self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:nil]; self.audioPlayer.delegate = self; AudioSessionSetActive(YES); [audioPlayer play]; When I comment out the 2nd line (nil) and add a release to the end, this problem stops. [self.audioPlayer release]; Where do I go from here? Nils are used in a similar fashion throughout the code (and may cause similar problems) - is there a safe way to remove them? I'm new to memory management - how can I discern proper nil usage from bad nil usage?

    Read the article

  • problems, custum wrap (class) around PDO, doesn't work

    - by Knarf
    DB::construct(); $STH = DB::prepare('INSERT INTO users (username, password, email, activationkey) VALUES (?, UNHEX(?), ?, ?)'); var_dump($STH); $result = $STH->execute(array('test', 'nils', '[email protected]', '227a038fe9c81515b514cb152188e95c')); echo "working? <br />"; if($result == false) echo 'noooo...'; It outputs and doesn't put anything in the database. Works with a similare code with DPO just without my DB class. But I doesn't get any errors. Anyone have an idea what the problem could be? object(PDOStatement)#2 (1) { ["queryString"]=> string(87) "INSERT INTO users (username, password, email, activationkey) VALUES (?, UNHEX(?), ?, ?)" } working? <br /> noooo...

    Read the article

  • linebreak in url with Bibtex and hyperref package

    - by Tim
    Why is this item not shown properly in my bibliography? @misc{ann, abstract = {ANN is an implbmentation of nearest neighbor search.}, author = {David M. Mount and Sunil Arya}, howpublished = {\url{http://www.cs.umd.edu/~mount/ANN/}}, keywords = {knn}, posted-at = {2010-04-08 00:05:04}, priority = {2}, title = {ANN.}, url = "http://www.cs.umd.edu/~mount/ANN/", year = {2008} } @misc{Nilsson96introductionto, author = {Nilsson, Nils J.}, citeulike-article-id = {6995464}, howpublished = {\url{http://robotics.stanford.edu/people/nilsson/mlbook.html}}, keywords = {*file-import-10-04-11}, posted-at = {2010-04-11 06:52:28}, priority = {2}, title = {Introduction to Machine Learning: An Early Draft of a Proposed Textbook.}, year = {1996} } EDIT: I am using \usepackage{hyperref}, not \usepackage{url}. I don't know what changes I just made made the first item appear properly now @misc{ann, abstract = {ANN is an implbmentation of nearest neighbor search.}, author = {David M. Mount and Sunil Arya}, howpublished = {\url{http://www.cs.umd.edu/~mount/ANN/}}, keywords = {ann}, posted-at = {2010-04-08 00:05:04}, priority = {2}, title = {The \textsc{A}pproximate \textsc{N}earest \textsc{N}eighbor \textsc{S}earching \textsc{L}ibrary.}, url = "http://www.cs.umd.edu/~mount/ANN/", year = {2008} } EDIT: Since I am using hyperref package, it produces error when using url package together with it. So the two cannot work together? I would like to use hyper links inside pdf file, so I would like to use hyperref package instead of url package. I googled a bit, and try \usepackage[hyperindex,breaklinks]{hyperref}, but there is still no line break just as before. How can I do it? Is there conflict in the packages that I am now using?: \usepackage{amsmath} \usepackage{amsfonts} \usepackage[dvips]{graphicx} \usepackage{wrapfig} \graphicspath{{./figs/}} \DeclareGraphicsExtensions{.eps} \usepackage{fixltx2e} \usepackage{array} \usepackage{times} \usepackage{fancyhdr} \usepackage{multirow} \usepackage{algorithmic} \usepackage{algorithm} \usepackage{slashbox} \usepackage{multirow} \usepackage{rotating} \usepackage{longtable} \usepackage[hyperindex,breaklinks]{hyperref} \usepackage{forloop} \usepackage{lscape} \usepackage{supertabular} \usepackage{amssymb} \usepackage{amsthm}

    Read the article

  • Reverse-projection 2D points into 3D

    - by ehsan baghaki
    Suppose we have a 3d Space with a plane on it with an arbitary equation : ax+by+cz+d=0 now suppose that we pick 3 random points on that plane: (x0,y0,z0) (x1,y1,z1) (x1,y1,z1) now i have a different point of view(camera) for this plane. i mean i have a different camera that will look at this plane from a different point of view. From that camera point of view these points have different locations. for example (x0,y0,z0) will be (x0',y0') and (x1,y1,z1) will be (x1',y1') and (x2,y2,z2) will be (x2',y2') from the new camera point of view. So here is my a little hard question! I want to pick a point for example (X,Y) from the new camera point of view and tell where it will be on that plane. All i know is that 3 points and their locations on 3d space and their projection locations on the new camera view. Do you know the coefficients of the plane-equation and the camera positions (along with the projection), or do you only have the six points? - Nils i know the location of first 3 points. therefore we can calculate the coefficients of the plane. so we know exactly where the plane is from (0,0,0) point of view. and then we have the camera that can only see the points! So the only thing that camera sees is 3 points and also it knows their locations in 3d space (and for sure their locations on 2d camera view plane). and after all i want to look at camera view, pick a point (for example (x1,y1)) and tell where is that point on that plane. (for sure this (X,Y,Z) point should fit on the plane equation). Also i know nothing about the camera location.

    Read the article

  • An Alphabet of Eponymous Aphorisms, Programming Paradigms, Software Sayings, Annoying Alliteration

    - by Brian Schroer
    Malcolm Anderson blogged about “Einstein’s Razor” yesterday, which reminded me of my favorite software development “law”, the name of which I can never remember. It took much Wikipedia-ing to find it (Hofstadter’s Law – see below), but along the way I compiled the following list: Amara’s Law: We tend to overestimate the effect of a technology in the short run and underestimate the effect in the long run. Brook’s Law: Adding manpower to a late software project makes it later. Clarke’s Third Law: Any sufficiently advanced technology is indistinguishable from magic. Law of Demeter: Each unit should only talk to its friends; don't talk to strangers. Einstein’s Razor: “Make things as simple as possible, but not simpler” is the popular paraphrase, but what he actually said was “It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience”, an overly complicated quote which is an obvious violation of Einstein’s Razor. (You can tell by looking at a picture of Einstein that the dude was hardly an expert on razors or other grooming apparati.) Finagle's Law of Dynamic Negatives: Anything that can go wrong, will—at the worst possible moment. - O'Toole's Corollary: The perversity of the Universe tends towards a maximum. Greenspun's Tenth Rule: Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. (Morris’s Corollary: “…including Common Lisp”) Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law. Issawi’s Omelet Analogy: One cannot make an omelet without breaking eggs - but it is amazing how many eggs one can break without making a decent omelet. Jackson’s Rules of Optimization: Rule 1: Don't do it. Rule 2 (for experts only): Don't do it yet. Kaner’s Caveat: A program which perfectly meets a lousy specification is a lousy program. Liskov Substitution Principle (paraphrased): Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it Mason’s Maxim: Since human beings themselves are not fully debugged yet, there will be bugs in your code no matter what you do. Nils-Peter Nelson’s Nil I/O Rule: The fastest I/O is no I/O.    Occam's Razor: The simplest explanation is usually the correct one. Parkinson’s Law: Work expands so as to fill the time available for its completion. Quentin Tarantino’s Pie Principle: “…you want to go home have a drink and go and eat pie and talk about it.” (OK, he was talking about movies, not software, but I couldn’t find a “Q” quote about software. And wouldn’t it be cool to write a program so great that the users want to eat pie and talk about it?) Raymond’s Rule: Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter.  Sowa's Law of Standards: Whenever a major organization develops a new system as an official standard for X, the primary result is the widespread adoption of some simpler system as a de facto standard for X. Turing’s Tenet: We shall do a much better programming job, provided we approach the task with a full appreciation of its tremendous difficulty, provided that we respect the intrinsic limitations of the human mind and approach the task as very humble programmers.  Udi Dahan’s Race Condition Rule: If you think you have a race condition, you don’t understand the domain well enough. These rules didn’t exist in the age of paper, there is no reason for them to exist in the age of computers. When you have race conditions, go back to the business and find out actual rules. Van Vleck’s Kvetching: We know about as much about software quality problems as they knew about the Black Plague in the 1600s. We've seen the victims' agonies and helped burn the corpses. We don't know what causes it; we don't really know if there is only one disease. We just suffer -- and keep pouring our sewage into our water supply. Wheeler’s Law: All problems in computer science can be solved by another level of indirection... Except for the problem of too many layers of indirection. Wheeler also said “Compatibility means deliberately repeating other people's mistakes.”. The Wrong Road Rule of Mr. X (anonymous): No matter how far down the wrong road you've gone, turn back. Yourdon’s Rule of Two Feet: If you think your management doesn't know what it's doing or that your organisation turns out low-quality software crap that embarrasses you, then leave. Zawinski's Law of Software Envelopment: Every program attempts to expand until it can read mail. Zawinski is also responsible for “Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems.” He once commented about X Windows widget toolkits: “Using these toolkits is like trying to make a bookshelf out of mashed potatoes.”

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >