Daily Archives

Articles indexed Tuesday June 15 2010

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

  • Filling in gaps for outlines

    - by user146780
    I'm using an algorithm to generate quads. These become outlines. The algorithm is: void OGLENGINEFUNCTIONS::GenerateLinePoly(const std::vector<std::vector<GLdouble>> &input, std::vector<GLfloat> &output, int width) { output.clear(); if(input.size() < 2) { return; } int temp; float dirlen; float perplen; POINTFLOAT start; POINTFLOAT end; POINTFLOAT dir; POINTFLOAT ndir; POINTFLOAT perp; POINTFLOAT nperp; POINTFLOAT perpoffset; POINTFLOAT diroffset; POINTFLOAT p0, p1, p2, p3; for(unsigned int i = 0; i < input.size() - 1; ++i) { start.x = static_cast<float>(input[i][0]); start.y = static_cast<float>(input[i][1]); end.x = static_cast<float>(input[i + 1][0]); end.y = static_cast<float>(input[i + 1][1]); dir.x = end.x - start.x; dir.y = end.y - start.y; dirlen = sqrt((dir.x * dir.x) + (dir.y * dir.y)); ndir.x = static_cast<float>(dir.x * 1.0 / dirlen); ndir.y = static_cast<float>(dir.y * 1.0 / dirlen); perp.x = dir.y; perp.y = -dir.x; perplen = sqrt((perp.x * perp.x) + (perp.y * perp.y)); nperp.x = static_cast<float>(perp.x * 1.0 / perplen); nperp.y = static_cast<float>(perp.y * 1.0 / perplen); perpoffset.x = static_cast<float>(nperp.x * width * 0.5); perpoffset.y = static_cast<float>(nperp.y * width * 0.5); diroffset.x = static_cast<float>(ndir.x * 0 * 0.5); diroffset.y = static_cast<float>(ndir.y * 0 * 0.5); // p0 = start + perpoffset - diroffset //p1 = start - perpoffset - diroffset //p2 = end + perpoffset + diroffset // p3 = end - perpoffset + diroffset p0.x = start.x + perpoffset.x - diroffset.x; p0.y = start.y + perpoffset.y - diroffset.y; p1.x = start.x - perpoffset.x - diroffset.x; p1.y = start.y - perpoffset.y - diroffset.y; p2.x = end.x + perpoffset.x + diroffset.x; p2.y = end.y + perpoffset.y + diroffset.y; p3.x = end.x - perpoffset.x + diroffset.x; p3.y = end.y - perpoffset.y + diroffset.y; output.push_back(p2.x); output.push_back(p2.y); output.push_back(p0.x); output.push_back(p0.y); output.push_back(p1.x); output.push_back(p1.y); output.push_back(p3.x); output.push_back(p3.y); } } The problem is that there are then gaps as seen here: http://img816.imageshack.us/img816/2882/eeekkk.png There must be a way to fix this. I see a pattern but I just cant figure it out. There must be a way to fill the missing inbetweens. Thanks

    Read the article

  • problems with Apache on Snow Leopard

    - by Hristo
    I kind of screwed up the Apache "stuff" on my Mac. Usually when I visit http://localhost/, I would see the "It Works!" but now it just lists the directory and files inside /Library/WebServer/Documents. When I try to stop/start/restart the server with sudo apachectl stop, I get: httpd: Syntax error on line 68 of /etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_disk_cache.so into server: dlopen(/usr/libexec/apache2/mod_disk_cache.so, 10): Symbol not found: _apr_file_info_get$INODE64\n Referenced from: /usr/libexec/apache2/mod_disk_cache.so\n Expected in: flat namespace\n in /usr/libexec/apache2/mod_disk_cache.so I don't want to do the MacPorts install, I tried it earlier but... I just want to do it via source code with the usual ./configure, make, make install. Any ideas on how to get this working? Is there a way to totally remove Apache and then reinstall a fresh version? Thanks, Hristo

    Read the article

  • Sync OneNote Notebooks to/on SkyDrive

    - by Sam
    I've got OneNote running on all computers in our house, using it all the time with several people and computers. The only drawback: I want to keep the copies of OneNote in sync without having to run a dedicated server myself. Right now one of my computers has a folder share, where all others sync to, but this is highly impractical since the computer is not always running. So my question is: is it possible to put the notebook files on a (private) SkyDrive Folder and have all the computers sync to there? This way all computers could keep in sync whenever they got access to the web. Can this be done? and, of course, How? [Update] Maybe I should not have taken knowledge about OneNote as granted: OneNote uses a propietary file format, but has a very good in-file-syncing, working on network shares. Generic 'just sync the complete file' won't be useful at all, because I'd just have 'file has changed on server and on client' conflicts all the time. The sync needs to know OneNote files and be able to sync the content - eg. OneNote itself needs to sync the files, not some generic sync tool.

    Read the article

  • Dlink DIR-615 suddenly stops working - Orange internet light

    - by zm15
    I unplugged my Dlink DIR-615 router last night from the wall due to a storm rolling in. I've done this countless times, no problem. However, when I went to plug it in and use the internet today, nothing. Check everything, cycled everything. Hard reset the router, nothing. The little globe on the front is red/orange, and it should be green. Windows gives me an error of a "DNS Issue", and the internet works when connected directly to the modem. How can I fix this issue? Why would it suddenly stop working?

    Read the article

  • Two BULK INSERT issues I worked around recently

    - by AaronBertrand
    Since I am still afraid of SSIS, and because I am dealing mostly with CSV files and table structures that are relatively simple and require only one of the three letters in the acronym "ETL," I find myself using BULK INSERT a lot. I have been meaning to switch to using CLR, since I am doing a lot of file system querying using xp_cmdshell, but I haven't had the chance to really explore it yet. I know, a lot of you are probably thinking, wow, look at all those bad habits. But for every person thinking...(read more)

    Read the article

  • CakePHP dynamic element

    - by Logic Artist
    I am trying to create a message-board type element in a CakePHP app. This element will be displayed on all pages and views that use a particular layout. I want it to display all the messages in the model, then show the add form when a link is clicked, then return to the updated message list when submitted. All this without affecting the current view/page. I have my message model/controller/index set up, with a message board element that requests the index action. This works fine. However I am perplexed about how to return back to the original page/action from which the link was clicked. I can't use $this-referer() because that will link back to the add() action; what I want rather is to link to the page/view before that. Any general pointers on how to achieve something like this?

    Read the article

  • Where to begin with multi-threaded programming with c++?

    - by zoke
    I'm trying to implement my own IRC client as a personal proejct and I realized I needed a way to read and write from the socket at the same time. I realized I could have a reading thread which reads from the socket in the background and puts data in a queue and I could have another thread which writes data from a queue to the socket. However I have no idea on how to start with multithreaded programing or how to do it with c++. Where do I go from here?

    Read the article

  • software that meets all needs in a project

    - by taz
    Hello all, I have a got couple of software projects that I want to run with my friends(max 10 persons) privately(at least for now). But I'm kind of lost between software management systems. I am not even sure about the definitions of my needs. Dear all, what is the definition/name of the system/software that meets my needs listed below? Continuous Integration? And please suggest me a good ALL-IN-ONE instance of it: project roadmap/planning project resource(people) allocation project issue&bug tracking project mailing list project forum project wiki source control server source control client repository change notifier client build system(like scons) nightly build automation IDE integration(VS) Note: I tried Redmine and liked it, but found it kind of slow. All-in-one kind ones will be the most appreciated but if your suggestion includes more than 3 softwares, please suggest me the ones that work together painlessly. thanks in advance..

    Read the article

  • Could the Print document ive built in .net cause a UriFormatException?

    - by Smoka
    After adding Print Document, Dialog, and Button to my Forms app i now have UriFormatException and A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.Drawing.dll Additional information: Access is denied Is there something wrong with the strings in my Document? Preview looks fine. but unhandled exception's when it tries to print.

    Read the article

  • Concatenation Operator

    - by Chaitanya
    This might be a silly question but it struck me, and here i ask. <?php $x="Hi"; $y=" There"; $z = $x.$y; $a = "$x$y"; echo "$z"."<br />"."$a"; ?> $z uses the traditional concatenation operator provided by php and concatenates, conversely $a doesn't, My questions: by not using the concatenation operator, does it effect the performance? If it doesn't why at all have the concatenation operator. Why have 2 modes of implementation when one does the work?

    Read the article

  • Is it possible to run php exec through cygwin?

    - by Scarface
    Hey guys I have one command that works on my remote linux server but not my windows (WAMP package) local server. I really want to create an identical workstation so I can test locally and then update my remote server. If anyone has any suggestions or solutions other than converting to linux, I would really appreciate it. <?php $safe_path = escapeshellarg('fake-virus.txt'); $command = '/usr/bin/clamscan --stdout ' . $safe_path; $out = ''; $int = -1; exec($command, $out, $int); echo $int; if ($int == 0) { // all good; } else { echo 'o no';// VIRUS!; } ?>

    Read the article

  • javascript - document.activeElement

    - by Fernando SBS
    Hello, I have a few inputTextBoxes and I'm using document.activeElement to handle value changes of those inputboxes called by "change()" function of inputBox element. the problem is when I change the value of one of the inputboxes and then click in another inputbox... the function will get the document.activeElement of the new inputbox and will not work... how to make the function "know" that the one that changed was the previous one?

    Read the article

  • app engine jpa N-way joins ?

    - by cometta
    may i know is the latest version of jgae support N-way joins? or still limit to 2-way join? reference: http://gae-java-persistence.blogspot.com/2010/03/executing-simple-joins-across-owned.html?showComment=1276491851890_AIe9_BEqp-CCn0bibiOUY8JUbbSFwFE02aF9d68baX0squIcfBnve8K3iIT3IEhPhpJxEBSZQLlz8tH-NMq1XGzOV0fAA8othN4f3zhR2B6xN0WzsTRpyEZJl2vPDonhVY38iUhJGe8Ot9URs3IjYk4HoH9LG41az7l0blTBNNnpJuyI-xl5CDJGoPLGk5jw4tLvtvsCYhq3n7XuiZwJIaBMWjHSDdy7-fB1NYszI0G4f9JRjZ5UdDM4at3o3tAhd-CYK2Af1dnG#c3679507832415682306

    Read the article

  • Redirection in Rails

    - by Cyborgo
    Hi, I have a small question regarding rails. I have a search controller which searches for a name in database, if found shows the details about it or else I am redirecting to the new name page. Is there anyway after redirection that the name searched for to automatically appear in the new form page? Thanks in advance.

    Read the article

  • Effects of the `extern` keyword on C functions

    - by Elazar Leibovich
    In C I did not notice any effect of the extern keyword used before function declaration. At first I thougth that when defining extern int f(); in a single file forces you to implement it outside of the files scope, however I found out that both extern int f(); int f() {return 0;} And extern int f() {return 0;} Compiles just fine, with no warnings from gcc. I used gcc -Wall -ansi, he wouldn't even accept // comments. Are there any effects for using extern before function definitions? Or is it just an optional keyword with no side effects for functions. In the latter case I don't understand why did the standard designers chose to litter the grammar with superfluous keywords. EDIT: to clarify, I know there's usage for extern in variables, but I'm only asking about extern in functions.

    Read the article

  • python command line yes/no input

    - by h3
    Is there any short way to achieve what APT does in Python ? I mean, when the package manager prompts a yes/no question followed by "[Yes/no]". The scripts accepts YES/Y/yes/y or "enter" (defaults to Yes as hinted by the capital) The only thing I find in the official doc is input/raw_input.. I know it's not that hard to emulate, but it's annoying to rewrite :|

    Read the article

  • Set Controls with arbitrary positions on CTabItem

    - by Daziplqa
    Hi Guyz, I am new to GWT, and I need to set the controls positions arbitrary on CTabItem. I've used the following code, but it seems that it had no positioning effect, it just add the component to (0, 0) Label userName = new Label(folder, SWT.NONE); userName.setText("username"); userName.setBounds(10, 200, 200, 50); item.setControl(userName);

    Read the article

  • NOT A DUPLICATE! VS2010 - How to automatically stop compile on first compile error

    - by Ben Robbins
    {rant}First I'd like to say that this IS NOT A DUPLICATE. I've asked this question previously but it got closed as a duplicate when it isn't. This question is SPECIFIC to VS 2010 and the answers to the so-called duplicate work in VS 2008 but not in VS 2010 (at least not for me or anyone I know). So before you go closing something as a duplicate how about you read the question carefully and try the answer for yourself and see if it actually works. Apologies for the rant but there is no obvious way to contact the SO police that closed the issue or get it reopened. {/rant} At work we have a C# solution with over 80 projects. In VS 2008 we use a macro to stop the compile as soon as a project in the solution fails to build (see this question for several options for VS 2005 & VS 2008: http://stackoverflow.com/questions/134796/how-to-automatically-stop-visual-c-build-at-first-compile-error). Is it possible to do the same in VS 2010? What we have found is that in VS 2010 the macros don't work (at least I couldn't get them to work) as it appears that the environment events don't fire in VS 2010. The default behaviour is to continue as far as possible and display a list of errors in the error window. I'm happy for it to stop either as soon as an error is encountered (file-level) or as soon as a project fails to build (project-level). Answers for VS 2010 only please. If the macros do work then a detailed explanation of how to configure them for VS 2010 would be appreciated. Thanks.

    Read the article

  • Django Passing Custom Form Parameters to Formset

    - by Paolo Bergantino
    I have a Django Form that looks like this: class ServiceForm(forms.Form): option = forms.ModelChoiceField(queryset=ServiceOption.objects.none()) rate = forms.DecimalField(widget=custom_widgets.SmallField()) units = forms.IntegerField(min_value=1, widget=custom_widgets.SmallField()) def __init__(self, *args, **kwargs): affiliate = kwargs.pop('affiliate') super(ServiceForm, self).__init__(*args, **kwargs) self.fields["option"].queryset = ServiceOption.objects.filter(affiliate=affiliate) I call this form with something like this: form = ServiceForm(affiliate=request.affiliate) Where request.affiliate is the logged in user. This works as intended. My problem is that I now want to turn this single form into a formset. What I can't figure out is how I can pass the affiliate information to the individual forms when creating the formset. According to the docs to make a formset out of this I need to do something like this: ServiceFormSet = forms.formsets.formset_factory(ServiceForm, extra=3) And then I need to create it like this: formset = ServiceFormSet() Now how can I pass affiliate=request.affiliate to the individual forms this way?

    Read the article

  • Understanding Ruby Enumerable#map (with more complex blocks)

    - by mstksg
    Let's say I have a function def odd_or_even n if n%2 == 0 return :even else return :odd end end And I had a simple enumerable array simple = [1,2,3,4,5] And I ran it through map, with my function, using a do-end block: simple.map do |n| odd_or_even(n) end # => [:odd,:even,:odd,:even,:odd] How could I do this without, say, defining the function in the first place? For example, # does not work simple.map do |n| if n%2 == 0 return :even else return :odd end end # Desired result: # => [:odd,:even,:odd,:even,:odd] is not valid ruby, and the compiler gets mad at me for even thinking about it. But how would I implement an equivalent sort of thing, that works?

    Read the article

  • regex , php, preg_match

    - by Michael
    I'm trying to extract the mileage value from different ebay pages but I'm stuck as there seem to be too many patterns because the pages are a bit different . Therefore I would like to know if you can help me with a better pattern . Some examples of items are the following : http://cgi.ebay.com/ebaymotors/1971-Chevy-C10-Shortbed-Truck-/250647101696?cmd=ViewItem&pt=US_Cars_Trucks&hash=item3a5bbb4100 http://cgi.ebay.com/ebaymotors/1987-HANDICAP-LEISURE-VAN-W-WHEEL-CHAIR-LIFT-/250647101712?cmd=ViewItem&pt=US_Cars_Trucks&hash=item3a5bbb4110 http://cgi.ebay.com/ebaymotors/ws/eBayISAPI.dll?ViewItemNext&item=250647101696 Please see the patterns at the following link (I still cannot figure it out how to escape the html here http://pastebin.com/zk4HAY3T However they are not enough many as it seems there are still new patters....

    Read the article

  • Why do my horizontal toolstrips keep stacking verticaly?

    - by Eric
    I'm using a ToolStripContainer that contains three ToolStrips. At design time I move the ToolStrips to the positions I want them in, which is in a horizontal row across the top of the form like this: I then close and save the Form. However, if I open the form up again the ToolStrips end up stacked up on the left side of the ToolStripContainer like this: How can I keep the ToolStrips in the positions that I specify?

    Read the article

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