Wikipedia:Reference desk/Archives/Computing/2013 June 19

Computing desk
< June 18 << May | June | Jul >> June 20 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


June 19

edit

Rectangulation

edit

This is a problem similar to polygon triangulation. I want to divide arbitrary shapes, which are built out of square tiles (like pixels), into the least number of rectangles. What could the algorithm be?  Card Zero  (talk) 03:08, 19 June 2013 (UTC)[reply]

The paper Graph-Theoretic Solutions to Computational Geometry Problems by David Eppstein has a solution to this rectangle dissection problem in section 3. This stack overflow article has a nice explanation of the algorithm. --Mark viking (talk) 03:34, 19 June 2013 (UTC)[reply]
Thank you. I think that's the same as my tentative solution:
* If an inner corner is opposite another (orthogonally), make a slice.
* Except, if it is opposite two others, do nothing.
* Slice the remaining shapes up anyhow, with slices starting at inner corners.
Now I can find the mistakes in that.  Card Zero  (talk) 12:55, 19 June 2013 (UTC)[reply]

Changing result display format of Axiom

edit

Axiom by default displays results as "ASCII art" to imitate the appearance of natural mathematical expressions (on paper, on websites...). How to change to Axiom linear notation? Czech is Cyrillized (talk) 03:44, 19 June 2013 (UTC)[reply]

§4.3 Common Features of Using Output Formats. "You can use the )set output system command..." Nimur (talk) 05:51, 19 June 2013 (UTC)[reply]

Where to place .h files when compiling with MinGW-w64

edit

See also Wikipedia:Reference desk/Archives/Computing/2013 June 11#C++ bignum library in Quincy

I am giving this bignum library a second try, this time without using an IDE and simply using MinGW w64. I use the same code as before to test the library:

#include <iprecision> #include <iostream> using namespace std; int main() { int_precision i1(1); int_precision i2(4); int_precision i3; i3=i1+i2; cout << "i3 is " << i3 << endl; return 0; }

However, when I try to compile with g++ bignum_test.cpp, I get the error

bignum_test.cpp:1:22: fatal error: iprecision: No such file or directory
compilation terminated.

Where do I need to place the iprecision.h file for the compiler to find it? -- Toshio Yamaguchi 06:19, 19 June 2013 (UTC)[reply]

Last time you asked, we mentioned that you need to learn how the compiler interprets its flags. This is still true. In fact, you've switched IDE, but are still using the same compiler and therefore having the same problem!
gcc's C preprocessor will look for included files in the current working directory if you use "double quotes" and will look for files in the include path if you use <brackets>. Specify the include path using the -I compiler flag. Here's the official documentation: GCC's search path; and here is specifically for the MinGW variant running on Windows; because on Windows, the default Unix paths don't apply... you actually do want to pass a compiler flag so it knows where you put iprecision.h.
Once this is working, be sure to pass a library path flag also (-L ...) so that your code links after it compiles. This is also a mandatory compiler-flag if you're using an external library that isn't distributed with the compiler - like bignum. Nimur (talk) 06:35, 19 June 2013 (UTC)[reply]
Well, I made a directory C:\Bignum and placed the library in there, but the compiler still tells me it doesn't find the library. These are the parameters
g++ bignum_test.cpp -iquote C:\Bignum
(the compiler says -I- is deprecated, so it seems I must use -iquote instead).
And I do have #include "iprecision" at the top. -- Toshio Yamaguchi 07:46, 19 June 2013 (UTC)[reply]
Also, I checked: Whether I use #include <iprecision> or #include "iprecision" doesn't make a difference at all. Both yield the error
bignum_test.cpp:1:22: fatal error: iprecision: No such file or directory
compilation terminated.
-- Toshio Yamaguchi 07:59, 19 June 2013 (UTC)[reply]
Are you sure you're not getting confused between "-I" and "-I-"? The latter may be deprecated, but I don't think the basic "-I" is. Never mind Rojomoke (talk) 08:10, 19 June 2013 (UTC)[reply]
g++ bignum_test.cpp -I C:\Bignum
gives
bignum_test.cpp:1:22: fatal error: iprecision: No such file or directory
compilation terminated.
Maybe this bignum library is bugged. Does my example program above compile for you? Though the error message doesn't seem to indicate a problem with the library so I suspect I simply must be doing something wrong. -- Toshio Yamaguchi 08:26, 19 June 2013 (UTC)[reply]
There shouldn't be a space after the -I
But once you get that done, you'll find that this library wasn't coded with g++ in mind (it's got some VC++ -isms running through it). To get it to work, I had to do a bunch of stuff:
  • I had to use this compile line: g++ -I. -static-libgcc -static-libstdc++ -o biggie.exe biggie.cpp precisioncore.cpp (note that I just dumped the library into the same directory as my source, hence the -I.
  • In precisioncore.cpp replace include of stdafx.h with include of cstdlib
  • Also in precisioncore.cpp I had to remove the casts to int_precision in int_precision_fastdiv and _int_precision_fastrem
  • And I changed the includes at the top of your file to be
#include <iostream>
#include <cstdlib>
#include <iprecision.h>
With all that done, your basic example works. -- Finlay McWalterTalk 09:14, 19 June 2013 (UTC)[reply]
note that I used biggie.cpp rather than bignum_test.cpp for your file, for no particular reason -- Finlay McWalterTalk 09:16, 19 June 2013 (UTC)[reply]

Portable headphones

edit

Which make better audio quality portable headphones (not professional or DJ headphones) - Sony or Audio technica? I can't tell the difference between the 2. They sound similar. Clover345 (talk) 08:21, 19 June 2013 (UTC)[reply]

Then get whichever is cheaper. ¦ Reisio (talk) 08:26, 19 June 2013 (UTC)[reply]
You may also want to consider things other than sound quality - e.g. build quality, size, comfort, sound isolation etc. Sound quality is also exceedingly subjective, depending on your ears, what you expect, and the kind of music you listen too, so listen to them as you have done and make up your own mind - if you can't hear a difference then to you (at least for the music you have tested, at the quality you have it stored at) there is no difference. Equisetum (talk | contributions) 15:35, 19 June 2013 (UTC)[reply]
If you can't tell the difference in quality, then take the other factors into consideration (as suggested above.) It would be great if you couldn't tell the difference so you bought the cheaper one, but what if the cheaper one broke down and you had to replace it (and end up spending more than if you had just bought the more expensive one)? --Yellow1996 (talk) 16:47, 19 June 2013 (UTC)[reply]

GeForce 210, upgrade?

edit

I have a GeForce 210 Intel Core 2 Quad rig with a PowerLogic 500 W Max/Peak Power and 250 W Pure/Real Power (I have no idea what it means) with a Gigabyte G41MT-S2 motherboard and I'm really considering to upgrade to a better card. However, because PowerLogic is known as a bad power supply, it makes me cannot choose any card I wanted. So, here is my card requirements:

1. I still don't know what card to use, either ATi or NVidia, but they said that ATi is better at mining bitcoins than NVidia, so ATi is preferred but Nvidia is still fine. But I have no idea how my current applications will responds if I change the card, maybe there will a compatibility issues?

2.It is compatible with my current power supply

3.It needs to be reasonably cheap

118.136.5.235 (talk) 12:09, 19 June 2013 (UTC)[reply]

May I ask why you need to keep your current power supply, even though you acknowledge that it's a 'bad power supply'? The GeForce 210 seems to be retailing at around $50 at the moment - for $100 you could get yourself a new power supply for $30-ish, and an upgrade on your GPU with the other $70. I'm no expert on graphics cards, so I'll leave the recommendations to others. - Cucumber Mike (talk) 12:37, 19 June 2013 (UTC)[reply]
I recently upgraded the 210 in my Linux workstation when decent games like Left4Dead2 became available on that platform, meaning the card had more to do that simple compositing. I upgraded the 210 to an nVidia GTX 550 Ti (I can't tell you the cost, as I scavenged it from another machine). The framerate in L4D2 went from an unplayable 13 fps to over 300 fps. If you're on Windows, the OS will insist on removing and reinstalling the device (so several reboots); it will not in Linux. I agree with Cucumber Mike's sentiment that if the power supply is limiting you then you should fix that rather than try to work around it. I don't know anything about BitCoin mining. -- Finlay McWalterTalk 11:42, 20 June 2013 (UTC)[reply]
Well my family isn't really convinced that buying a power supply and graphic card is better and cheaper than throwing the computer completely and buying a new one, so well... Probably I could save up some money to do that. Anyway, is Left 4 dead really already in linux? — Preceding unsigned comment added by 140.0.229.26 (talk) 00:22, 22 June 2013 (UTC)[reply]