Daily Archives

Articles indexed Thursday November 8 2012

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

  • Pattern for a class that does only one thing

    - by Heinzi
    Let's say I have a procedure that does stuff: void doStuff(initalParams) { ... } Now I discover that "doing stuff" is quite a compex operation. The procedure becomes large, I split it up into multiple smaller procedures and soon I realize that having some kind of state would be useful while doing stuff, so that I need to pass less parameters between the small procedures. So, I factor it out into its own class: class StuffDoer { private someInternalState; public Start(initalParams) { ... } // some private helper procedures here ... } And then I call it like this: new StuffDoer().Start(initialParams); or like this: new StuffDoer(initialParams).Start(); And this is what feels wrong. When using the .NET or Java API, I always never call new SomeApiClass().Start(...);, which makes me suspect that I'm doing it wrong. Sure, I could make StuffDoer's constructor private and add a static helper method: public static DoStuff(initalParams) { new StuffDoer().Start(initialParams); } But then I'd have a class whose external interface consists of only one static method, which also feels weird. Hence my question: Is there a well-established pattern for this type of classes that have only one entry point and have no "externally recognizable" state, i.e., instance state is only required during execution of that one entry point?

    Read the article

  • How to promote code reuse and documentation?

    - by Graviton
    As a team lead of about 10+ developers, I would want to promote code reuse. We have written a lot of code-- a lot of them are repetitive over the past few years. The problem now is that a lot of these code are just duplicate of some other code or a slight variation of them. I have started the movement ( discussion) on how to make code into components so that they can be reused for the future projects, but the problem is that I afraid the new developers or other developers who are ignorant of the components will just go forward and write their own thing. Is there anyway to remind the developers to reuse the components/ improve the documentation/ contribute to the underlying component instead of duplicating the existing code and tweaking on it or just write their own? How to make the components easily discover-able, easily usable so that everyone will use it? Edit: I think every developer knows about the benefit of reusable components and wants to use them, it's just that we don't know how to make them discoverable. Also, the developers when they are writing code, they know they should write reusable code but lack of the motivation to do so.

    Read the article

  • What types of programming contest problems are there?

    - by Alex
    Basically, I want to make a great reference for use with programming contests that would have all of the algorithms that I can put together that I would need during a contest as well as sample useage for the code. I'm planning on making this into a sort of book that I could print off and take with me to competitions. I would like to do this rather than simply bringing other books (such as Algorithms books) because I think that I will learn a lot more by going over all of the algorithms myself as well as I would know exactly what I have in the book, making it more efficient to have and use. So, I've been doing research to determine what types of programming problems and algorithms are common on contests, and the only thing I can really find is this (which I have seen referenced a few times): Hal Burch conducted an analysis over spring break of 1999 and made an amazing discovery: there are only 16 types of programming contest problems! Furthermore, the top several comprise almost 80% of the problems seen at the IOI. Here they are: Dynamic Programming Greedy Complete Search Flood Fill Shortest Path Recursive Search Techniques Minimum Spanning Tree Knapsack Computational Geometry Network Flow Eulerian Path Two-Dimensional Convex Hull BigNums Heuristic Search Approximate Search Ad Hoc Problems The most challenging problems are Combination Problems which involve a loop (combinations, subsets, etc.) around one of the above algorithms - or even a loop of one algorithm with another inside it. These seem extraordinarily tricky to get right, even though conceptually they are ``obvious''. Now that's good and all, but that study was conducted in 1999, which was 13 years ago! One thing I know is that there are no BigNums problems any more (as Java has a BigInteger class, they have stopped making those problems). So, I'm wondering if anyone knows of any more recent studies of the types of problems that may be seen in a programming contest? Or what the most helpful algorithms on contests would be?

    Read the article

  • How can I discourage the use of Access?

    - by Greg Buehler
    Lets pretend that a very large company (revenue numbers with more than 8 figures) is looking to do a refresh on a software system, particularly the dashboard used by employees. This system was originally put together in the early 1990's to handle inventory tracking and storage across a variety of facilities (10+). Since this large company is now in the process of implementing some of these inventory processes with SAP they are in need of a major refresh. The existing system: Microsoft Access project performs dashboard duties Unique shipping/receiving configurations at different facilities require unique forms and queries within the Access project Uses 3rd party libraries referenced by Access to directly interface with at control system (read: motors, conveyors, and counters) Individual SQL Server 2000 instances (some traces of pre-update SQL Server 6.0 documents) at each facility The Issue: This system started as a home brewed inventory tracking scheme with a single internal sponsor who is still in charge of the technical direction. The original sponsor prescribing the desired deliverables that are being called for in the current RFP. The RFP describes a system based around a single Access project. Any suggestion that Access is ill suited for a project of this scope are shot down under the reasoning that "it works for the scope now". Are there any case studies, notices, or statements that can be used to disuade this potential customer from repeating their mistake? Does Microsoft make any statements directly about when it is highly recommended to ditch Access?

    Read the article

  • Professional iOS Development as a Backup Career [closed]

    - by New Coder
    I am a research chemist by day and I am a self-taught hobbyist iOS programmer by night. I am in the process of developing a moderately complex iOS app and hope to launch it within a month or two. I love everything about iOS development (and programming in general). I want to know if iOS development could become a backup career for me if I loose my job. My question: Let's say I had a couple of apps in the app store, a solid foundation in objective-C and the apple frameworks and basic knowledge on network integrated apps. Without a formal CS degree, what other experience/knowledge would I need to land a job as a professional iOS developer? Forgive me if this question is out of bounds for this forum. If it is, suggestions on where to post such a question would be appreciated.

    Read the article

  • What criteria would I use SQL Stream Insight vs TPL Dataflow [closed]

    - by makerofthings7
    There is an add-in to the Task Parallel Library (TPL) called TPL Dataflow that allows a variety of data processing scenarios. It seems that there are some parallels to the SQL Stream Insight product, however since SQL's Stream Insight has some interesting licensing around it, and it has a better performance depending on what license I get... I found myself asking myself should I use TPL Dataflow and not have any licensing issues, and possibly better performance. Can anyone tell me if performance is a valid criteria for comparing SQL Stream Insight vs TPL Dataflow? What other criteria should I be looking at when comparing the two?

    Read the article

  • How important is to sacrifice your free time for accomplishing goals? [closed]

    - by Darf Zon
    I was reading a book about XP programming and about agile teams. While I was reading, I saw this scenario. I've never worked with a development team (just in school). So I would like what do you opine on this situation: Your boss has asked you to deliver software in a time that can only be possible to meet the project team asking if you want to work overtime without pay. All team members have young children. Discuss whether it should accept this request from your boss or should persuade the team to give their time to the organization rather than their families. What could be significant factors in the decision? As a programmer, you are offered an upgrade as project manager, but his feeling is that you can have a more effective contribution in a technical role in one administrative. Write when you should accept that promotion. Somethimes, I sacrifice my free time for accomplishing hits at work, so it's very important to me to know your opinion base of your experience.

    Read the article

  • Best method to implement a filtered search

    - by j0N45
    I would like to ask you, your opinion when it comes to implement a filtered search form. Let's imagine the following case: 1 Big table with lots of columns It might be important to say that this SQL Server You need to implement a form to search data in this table, and in this form you'll have several check boxes that allow you to costumize this search. Now my question here is which one of the following should be the best way to implement the search? Create a stored procedure with a query inside. This stored procedure will check if the parameters are given by the application and in the case they are not given a wildcard will be putted in the query. Create a dynamic query, that is built accordingly to what is given by the application. I am asking this because I know that SQL Server creates an execution plan when the stored procedure is created, in order to optimize its performance, however by creating a dynamic query inside of the stored procedure will we sacrifice the optimization gained by the execution plan? Please tell me what would be the best approach in your oppinion.

    Read the article

  • When to update jQuery?

    - by epaulk
    When you recommend updating jQuery/jQuery UI? Or in other words: what are the best practices for updating jQuery/jQuery UI? I’m working on a long project that will take at least one more year. In that time span, I’m sure that jQuery/jQuery UI will be updated many times. Do you recommend update my jQuery/jQuery UI files every time an update is released? Or is better to stick with a particular version until the end of the project? I’m afraid of “breaking” code changes, and every time an update is released, I have to test everything. That takes too much time. But on the other hand, if I didn’t update, I’m afraid of bugs that later will bite me in the rear. The project is an ASP.MVC and I use jQuery a lot. Any thoughts?

    Read the article

  • Printing in booklet fomat

    - by To Do
    In the past I had a printer that had the booklet format option that would print the document two pages at a time ordered in a way that folding the whole printout would produce a booklet which could be stapled in the middle. My current printer does not support this feature. I would like to use some utility or script to convert an A4 pdf to an A5 booklet one. I found this page but I'm getting an error : pdfjam ERROR: can't find pdflatex! How do I get past this issue? Does anybody know of any other solution? I'm on Ubuntu 12.10 AMD64

    Read the article

  • Audio PC Software running on UBUNTU

    - by Stuart
    Hi I recently built my own home studio PC. i5 CPU) 8Gb RAM, solid state drive etc. Basically the fastest PC I've ever built. I have a 32bit version of XP and all the music software I have runs on this. However I want to use all the RAM and can only do so by moving to 64bit Windows. My questions are: Will Ubuntu run my Audio software or would I need to get Linux specific Audio software? Are there any good (pro) shareware linux based multi-track audio software packages? Will VST plug-ins work through UBUNTU? Cheers, Stu.

    Read the article

  • How to install hardware drivers for my laptop

    - by John Flisk
    Everytime I change the OS I usually format my laptop. It is an HP tx-2 Touchsmart. It has a touchscreen and additional hardware that isn't working (i.e. volume control buttons and the network discovery) If I was on windows I would just download the hardware drivers from the HP website. How do I go about installing the software for the built-in hardware of my laptop? I am new to the community and I really want to get this computer working like it used to, to get the full Ubuntu experience. Please direct me, thank you.

    Read the article

  • Radeon Open Source Drivers Configuration

    - by Andy Turfer
    How does one configure the Radeon Open Source drivers? I have just installed Ubuntu 12.10 and want to try the Open Source drivers instead of the proprietary AMD binaries. After the installation, the driver seems to be installed, I have wobbly windows working (can't use a PC without wobbly windows!), and life is generally good. I have a problem when I connect a secondary monitor. Performance is killed (everything becomes laggy and jerky) and my laptop sits on the right-hand side of the monitor, not the left. I'd like to know how to turn off the Laptop's monitor so I'm just using the external monitor. How can I do this using the Open Source Radeon drivers? I can't find a GUI management tool, and there's no longer an xorg.conf. What to do?

    Read the article

  • rake aborted! undefined local variable or method

    - by Subhransu
    In a fresh new Ubuntu machine, I have installed ruby with sudo apt-get install ruby1.8 and then installed rubygem1.8 with : sudo apt-get install rubygems and after that installed rails3.2.8 with : gem install rails The procedure was very simple. But here comes the problem. When I tried checking the version of rake with rake --trace -version I got the following error: rake aborted! undefined local variable or method `rsion' for #<Rake::Application:0xb72c731c> /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:316:in `standard_rake_options' /usr/lib/ruby/1.8/optparse.rb:1298:in `eval' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:316:in `standard_rake_options' /usr/lib/ruby/1.8/optparse.rb:1298:in `call' /usr/lib/ruby/1.8/optparse.rb:1298:in `parse_in_order' /usr/lib/ruby/1.8/optparse.rb:1254:in `catch' /usr/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order' /usr/lib/ruby/1.8/optparse.rb:1248:in `order!' /usr/lib/ruby/1.8/optparse.rb:1339:in `permute!' /usr/lib/ruby/1.8/optparse.rb:1360:in `parse!' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:425:in `handle_options' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:74:in `init' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:72:in `init' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:64:in `run' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run' /var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake:33 /usr/local/bin/rake:19:in `load' /usr/local/bin/rake:19 Is it the problem due to I have installed straight from ubuntu apt-get package manager ?

    Read the article

  • How can I install new locale to Ubuntu?

    - by UniMouS
    $ locale -a get output like this: C C.UTF-8 en_AG en_AG.utf8 en_AU.utf8 en_BW.utf8 en_CA.utf8 en_DK.utf8 en_GB.utf8 en_HK.utf8 en_IE.utf8 en_IN en_IN.utf8 en_NG en_NG.utf8 en_NZ.utf8 en_PH.utf8 en_SG.utf8 en_US.utf8 en_ZA.utf8 en_ZM en_ZM.utf8 en_ZW.utf8 POSIX zh_CN.utf8 zh_SG.utf8 How can I install a new locale, for example en_US.ISO-8859-1. After this operation, I wish en_us.ISO-8859-1 could be listed in the locale -a list.

    Read the article

  • Ubuntu Server 12 not spawning a serial ttyS0 when running on Xen

    - by segfaultreloaded
    I have this problem on more than one host, so the specific hardware is not an issue. Bare metal Ubuntu 12 is not creating a login process on the only serial port, in the default configuration. The serial port works correctly with the firmware. It works correctly with Grub2. I have even connected the serial line to 2 different external client boxes, so the problem is neither the hardware nor the remote client. When finally booted, the system fails to create the login process. root@xenpro3:~# ps ax | grep tty 1229 tty4 Ss+ 0:00 /sbin/getty -8 38400 tty4 1233 tty5 Ss+ 0:00 /sbin/getty -8 38400 tty5 1239 tty2 Ss+ 0:00 /sbin/getty -8 38400 tty2 1241 tty3 Ss+ 0:00 /sbin/getty -8 38400 tty3 1245 tty6 Ss+ 0:00 /sbin/getty -8 38400 tty6 1403 tty1 Ss+ 0:00 /sbin/getty -8 38400 tty1 1996 pts/0 S+ 0:00 grep --color=auto tty root@xenpro3:~# dmesg | grep tty [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.2.0-30-generic root=/dev/mapper/xenpro3-root ro console=ttyS0,115200n8 [ 0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-3.2.0-30-generic root=/dev/mapper/xenpro3-root ro console=ttyS0,115200n8 [ 0.000000] console [ttyS0] enabled [ 2.160986] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 2.203396] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A [ 2.263296] 00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 2.323102] 00:09: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A root@xenpro3:~# uname -a Linux xenpro3 3.2.0-30-generic #48-Ubuntu SMP Fri Aug 24 16:52:48 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux root@xenpro3:~# I have tried putting a ttyS0.conf file in /etc/initab, which solves the problem bare metal but I still cannot get the serial port to work when booting Ubuntu on top of Xen, as domain 0. My serial line output looks like this, when booting Xen /dev/ttyS0 at 0x03f8 (irq = 4) is a 16550A * Exporting directories for NFS kernel daemon... [ OK ] * Starting NFS kernel daemon [ OK ] SSL tunnels disabled, see /etc/default/stunnel4 [ 18.654627] XENBUS: Unable to read cpu state [ 18.659631] XENBUS: Unable to read cpu state [ 18.664398] XENBUS: Unable to read cpu state [ 18.669248] XENBUS: Unable to read cpu state * Starting Xen daemons [ OK ] mountall: Disconnected from Plymouth At this point, the serial line is no longer connected to a process. Xen itself is running just fine. Dmesg gives me a long list of [ 120.236841] init: ttyS0 main process ended, respawning [ 120.239717] ttyS0: LSR safety check engaged! [ 130.240265] init: ttyS0 main process (1631) terminated with status 1 [ 130.240294] init: ttyS0 main process ended, respawning [ 130.242970] ttyS0: LSR safety check engaged! which is no surprise because I see root@xenpro3:~# ls -l /dev/ttyS? crw-rw---- 1 root tty 4, 64 Nov 7 14:04 /dev/ttyS0 crw-rw---- 1 root dialout 4, 65 Nov 7 14:04 /dev/ttyS1 crw-rw---- 1 root dialout 4, 66 Nov 7 14:04 /dev/ttyS2 crw-rw---- 1 root dialout 4, 67 Nov 7 14:04 /dev/ttyS3 crw-rw---- 1 root dialout 4, 68 Nov 7 14:04 /dev/ttyS4 crw-rw---- 1 root dialout 4, 69 Nov 7 14:04 /dev/ttyS5 crw-rw---- 1 root dialout 4, 70 Nov 7 14:04 /dev/ttyS6 crw-rw---- 1 root dialout 4, 71 Nov 7 14:04 /dev/ttyS7 crw-rw---- 1 root dialout 4, 72 Nov 7 14:04 /dev/ttyS8 crw-rw---- 1 root dialout 4, 73 Nov 7 14:04 /dev/ttyS9 If I manually change the group of /dev/ttyS0 to dialout, it gets changed back. I have made no changes to the default udev rules, so I cannot see where this problem is coming from. Sincerely, John

    Read the article

  • How to get Nvidia 555M working on Ubuntu 12.10 (drivers, optimus, cuda)?

    - by bluudz
    I'm trying for few days to get my GPU working properly on Alienware M14x with GPU NVidia 555M, but I have no luck at all. After fresh ubuntu install I did follow the guide here NVIDIA Optimus and Ubuntu 12.10 and istalled Bumblebee without problems. Tested glxspheres/optirun glxspheres both working fine. Now I was continuing to install CUDA as is said here How can I get nVidia CUDA or OpenCL working on a laptop with nVidia discrete card/Intel Integrated Graphics? but I'm getting: Driver: Not Selected Toolkit: Installation Failed. Using unsupported Compiler. Samples: Installation Failed. Missing required libraries. I did not select the driver as I though Bumblebee installed driver already. How should I proceed? And also at what point is the NVidia driver being installed and how can I try its working? Bumblebee seems to be installing the driver, CUDA wants to do the same, its all a bit confusing really. Sorry if its lame question, but I would really want to at least get graphic card and second screen working.. Thank you for any help.

    Read the article

  • Ubuntu 12.04 does not power off

    - by G K
    I'm not able to power off Ubuntu, which was working fine a couple of days ago. When I click shut down, a blank screen appears and stays like that forever. It does not power off by itself and I'm forced to physically power off using the power button. I've even tried 'sudo shutdown now' and 'sudo shutdown -h now' and both don't seem to work! Please suggest some fix for this problem. Thanx in advance. Edit: Restart works fine. Also 'sudo poweroff' doesn't work!

    Read the article

  • Ubuntu Server 12.04 Samba Server timeout

    - by phileaton
    I am a beginner with servers. I checked the error logs for Samba and it appears that Samba is timing out when I transfer large files. I can successfully add PDFs for instance to my file server. However, I tried to add a large 1.2Gb video file and it did not succeed. This is the error in the log: smbd/process.c:244(read_packet_remainder) read_fd_with_timeout failed for client 0.0.0.0 read error = NT_STATUS_CONNECT$ Is there a way I can stop it from timing out? Any pointers would be great! Thanks!

    Read the article

  • Every command fails with "command not found" after changing .bash_profile?

    - by Blankman
    I was updating my .bash_profile, and unfortunetly I made a few updates and now I am getting: env: bash: No such file or directory env: bash: No such file or directory env: bash: No such file or directory env: bash: No such file or directory env: bash: No such file or directory -bash: tar: command not found -bash: grep: command not found -bash: cat: command not found -bash: find: command not found -bash: dirname: command not found -bash: /preexec.sh.lib: No such file or directory -bash: preexec_install: command not found -bash: sed: command not found -bash: git: command not found My bash_profile actually pulls in other .sh files (sources them) so I am not exactly sure which modification may have caused this. Now if I even try and to a list of files, I get: >ls -bash: ls: command not found -bash: sed: command not found -bash: git: command not found Any tips on how to trace the source of the error, and how to be able to use the terminal for basic things like listing files etc?

    Read the article

  • Unable to install any packages due to unrecoverable fatal error /var/lib/dpkg/diversions

    - by gforces
    I am currently unable to install any packages. I receive the following error: dpkg: unrecoverable fatal error, aborting: too-long line or missing newline in `/var/lib/dpkg/diversions I have tried various approaches: sudo dpkg --configure -a sudo apt-get clean sudo dpkg-divert --list sudo apt-get check sudo apt-get install -f etc. but all to no avail. Either the output was apparently normal or the error above was thrown. I'm stumped as to how to proceed and would appreciate any assistance. If any further info is required just ask. Thanks for the reply. I followed the suggestions and am now getting a different error: (Reading database ... 50%dpkg: unrecoverable fatal error, aborting: files list file for package 'libksane0' is missing final newline E: Sub-process /usr/bin/dpkg returned an error code (2) Here is the link for the current diversions: http://paste.ubuntu.com/823500/ and the old broken one: http://paste.ubuntu.com/823502/ I tried to reinstall libksane0 but the same error occurred.

    Read the article

  • How to set Monday as the first day of the week in GNOME Calendar applet?

    - by Jonik
    What is the recommended way to change the first day of the week to Monday (instead of Sunday, as in the screenshot below)? I couldn't find anything related in Clock Preferences, nor in System - Preferences, or System - Administration. This probably has something to do with tweaking locales, so here's (possibly relevant) output from locale: LANG=en_US.utf8 LC_CTYPE="en_US.utf8" LC_NUMERIC="en_US.utf8" LC_TIME="en_US.utf8" ... LC_ALL= NB: I want to keep English as the UI language both in GNOME and on command line. Dates are currently displayed like this (e.g. ls -l): 2010-10-06 15:32, and I also want to keep that as it is.

    Read the article

  • How to Organize Subdirectories? [closed]

    - by Gary Iverson
    I am working on my first major (several hundred pages) website design and development project. I want to create subdirectories for each of the website's categories, which in turn have their own subdirectories for easy user navigation. Example: website.com/directory. I am aware that by placing an index.html file within each directory, the browser automatically detects and navigates to that page, but that seems like a messy solution (having multiple index.html files, albeit in distinct folders), and I cannot imagine everyone does that. So my question is...how do you properly organize and use subdirectories?

    Read the article

  • Annoying flickering of vertices and edges (possible z-fighting)

    - by Belgin
    I'm trying to make a software z-buffer implementation, however, after I generate the z-buffer and proceed with the vertex culling, I get pretty severe discrepancies between the vertex depth and the depth of the buffer at their projected coordinates on the screen (i.e. zbuffer[v.xp][v.yp] != v.z, where xp and yp are the projected x and y coordinates of the vertex v), sometimes by a small fraction of a unit and sometimes by 2 or 3 units. Here's what I think is happening: Each triangle's data structure holds the plane's (that is defined by the triangle) coefficients (a, b, c, d) computed from its three vertices from their normal: void computeNormal(Vertex *v1, Vertex *v2, Vertex *v3, double *a, double *b, double *c) { double a1 = v1 -> x - v2 -> x; double a2 = v1 -> y - v2 -> y; double a3 = v1 -> z - v2 -> z; double b1 = v3 -> x - v2 -> x; double b2 = v3 -> y - v2 -> y; double b3 = v3 -> z - v2 -> z; *a = a2*b3 - a3*b2; *b = -(a1*b3 - a3*b1); *c = a1*b2 - a2*b1; } void computePlane(Poly *p) { double x = p -> verts[0] -> x; double y = p -> verts[0] -> y; double z = p -> verts[0] -> z; computeNormal(p -> verts[0], p -> verts[1], p -> verts[2], &p -> a, &p -> b, &p -> c); p -> d = p -> a * x + p -> b * y + p -> c * z; } The z-buffer just holds the smallest depth at the respective xy coordinate by somewhat casting rays to the polygon (I haven't quite got interpolation right yet so I'm using this slower method until I do) and determining the z coordinate from the reversed perspective projection formulas (which I got from here: double z = -(b*Ez*y + a*Ez*x - d*Ez)/(b*y + a*x + c*Ez - b*Ey - a*Ex); Where x and y are the pixel's coordinates on the screen; a, b, c, and d are the planes coefficients; Ex, Ey, and Ez are the eye's (camera's) coordinates. This last formula does not accurately give the exact vertices' z coordinate at their projected x and y coordinates on the screen, probably because of some floating point inaccuracy (i.e. I've seen it return something like 3.001 when the vertex's z-coordinate was actually 2.998). Here is the portion of code that hides the vertices that shouldn't be visible: for(i = 0; i < shape.nverts; ++i) { double dist = shape.verts[i].z; if(z_buffer[shape.verts[i].yp][shape.verts[i].xp].z < dist) shape.verts[i].visible = 0; else shape.verts[i].visible = 1; } How do I solve this issue? EDIT I've implemented the near and far planes of the frustum, with 24 bit accuracy, and now I have some questions: Is this what I have to do this in order to resolve the flickering? When I compare the z value of the vertex with the z value in the buffer, do I have to convert the z value of the vertex to z' using the formula, or do I convert the value in the buffer back to the original z, and how do I do that? What are some decent values for near and far? Thanks in advance.

    Read the article

  • How do I use Content.Load() with raw XML files?

    - by xnanewb
    I'm using the Content.Load() mechanism to load core game definitions from XML files. It works fine, though some definitions should be editable/moddable by the players. Since the content pipeline compiles everything into xnb files, that doesn't work for now. I've seen that the inbuild XNA Song content processor does create 2 files. 1 xnb file which contains meta data for the song and 1 wma file which contains the actual data. I've tried to rebuild that mechanism (so that the second file is the actual xml file), but for some reason I can't use the namespace which contains the IntermediateSerializer class to load the xml (obviously the namespace is only available in a content project?). How can I deploy raw, editable xml files and load them with Content.Load()?

    Read the article

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