Jump to content

Wikipedia:Reference desk/Archives/Computing/2011 April 26

From Wikipedia, the free encyclopedia
Computing desk
< April 25 << Mar | April | May >> April 27 >
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.


April 26

[edit]

2006 Honda civic hybrid

[edit]

My 06 Honda civic hybrid was in an accident where someone ran into the side of my car driving a 2004 Lincoln.I was stopped at a red light for more than 60 seconds and did not go forward until my signal light turned green. I would like to know if the computer in my car will prove my car was stopped just prior to being hit and at what speed I was going when hit. I would also like to know if the computer in the 04 Lincoln will show the speed it was going when it ran into my car. Both cars came to a sudden stop when the collision occurred. ---four tildes — Preceding unsigned comment added by Bracet01 (talkcontribs) 02:11, 26 April 2011 (UTC)[reply]

Your Honda mechanic would know. I would think just the positions of the cars after the collision, and even the impact points would be enough to suggest you had stopped, though, unless the average speed you would have been going even having not been stopped at a red light would match the speed you'd have been going had you been. ¦ Reisio (talk) 03:04, 26 April 2011 (UTC)[reply]

Building a DOS command containing the current directory.

[edit]

Let's say I want to issue the following DOS command:

DIR "C:\Documents and Settings\Owner\foo.bar"

But let's say the current directory string is way too long to type in. I know that CD will tell me the name of the current directory, so can I use that somehow to build the above command ? (Yes, I realize you don't need to specify the current directory for the DIR command, but I want to know how to do this for other commands, too.) StuRat (talk) 05:22, 26 April 2011 (UTC)[reply]

The current directory has the codename "." and the parent directory the name "..", so:
DIR ".\foo.bar"
should do what you want. Let me know if it doesn't - it's been a while since I've used DOS! --Tango (talk) 06:20, 26 April 2011 (UTC)[reply]

Thanks. That did work for the DIR command, but not for the following command, issued from a system call within a FORTRAN program:

@start "" /b "C:\Program Files\Internet Explorer\iexplore.exe" ".\draw.gif"'  

However, this does work:

@start "" /b "C:\Program Files\Internet Explorer\iexplore.exe" "C:\Program Files\gfortran\StuRat\draw.gif"'

I think the problem is that IE considers "C:\Program Files\Internet Explorer" to be it's home directory. The FORTRAN program does know what the home directory really is, and a "CD" issued from it does produce the proper results. Now I just have to figure how to stuff that result into this command. StuRat (talk) 07:41, 26 April 2011 (UTC)[reply]

Another option is to use the subst command so you don't have to type all that stuff. Here is Microsoft's page on it (from the Windows XP days). As that page suggests, you might use:
subst z: b:\user\betty\forms
...so in future you just use z: instead of the whole pathname. Comet Tuttle (talk) 17:04, 26 April 2011 (UTC)[reply]
Unfortunately, that just displaces the problem. That is, I now need to figure out how to stuff the current directory into the "subst" command in my program. StuRat (talk) 17:48, 26 April 2011 (UTC)[reply]
Depending on the context of your program, the environment variable %CD% may be set. Try echo %CD% to see if it works in your context. Nimur (talk) 19:50, 26 April 2011 (UTC)[reply]
You could just use pushd . to store the current directory and then popd will change you back to it.  ZX81  talk 23:37, 26 April 2011 (UTC)[reply]
Can you explain better what you're doing? Are you really running under DOS and using DOS's command.com, or are you using the Windows command prompt (cmd.exe)? Is there some reason why you must use a command prompt (which is basically another programming language) to determine the current directory and to run your program, rather than just doing these things directly from your Fortran program? Which Fortran environment is it? -- BenRG (talk) 04:26, 28 April 2011 (UTC)[reply]

I am using gFortran, and the command is:

call system (' @start "" /b "C:\Program Files\Internet Explorer\iexplore.exe" "C:\Program Files\gfortran\StuRat\draw.gif" ')

This works, but right now I have to write the current directory path to a file, then read it in, to insert it into the string as "C:\Program Files\gfortran\StuRat". I was hoping for a more elegant way to do this. StuRat (talk) 06:42, 28 April 2011 (UTC)[reply]

As I already posted above, you can use the %CD% on Windows platforms, or the platform-portable GETCWD in gfortran. Nimur (talk) 15:29, 30 April 2011 (UTC)[reply]
GETCWD works, thanks ! StuRat (talk) 18:11, 30 April 2011 (UTC)[reply]
Resolved

StuRat (talk) 18:11, 30 April 2011 (UTC)[reply]

Quality problem with animated GIF.

[edit]

On the right is a file I created as a PPM. I then used imagemagick to create an animated GIF, and have captured the matching frame on the left. There's a significant decrease in the image quality. How can I prevent this ? Do I need to abandon animated GIFs and go for some other movie format ? Is there one which other people are likely to be able to read ? How do I produce this format ? (I already tried two of imagemagick's other movie formats, FLC and MNG. The FLC file was huge (58MB versus 4MB) and I couldn't display either movie to check on the quality.) StuRat (talk) 07:16, 26 April 2011 (UTC)[reply]

This is due to GIF having a small fixed palette. There is no way to get a GIF to perform any better (you can tweak ImageMagick's dither algorithm slightly, but the problem will remain). Ideally you'd use the MNG format, but browser manufacturers would rather implement new ways to do drop shadows than give us a decent animation format, so it's barely supported. That leaves a genuine movie format. Use ffmpeg this: ffmpeg -r 25 -i foo%03d.png out.mp4 (where 25 is the frame rate; adjust as you need). -- Finlay McWalterTalk 08:20, 26 April 2011 (UTC)[reply]
And would I then use a movie player to display the results, versus a browser or other software ? StuRat (talk) 09:37, 26 April 2011 (UTC)[reply]
Yes. If you intend to put the animation on Wikipedia, you'd encode the video to OGG Theora (.ogv) [I'll figure out the commands for that if you want) and MediaWiki will present the animation in a flash-based player. -- Finlay McWalterTalk 09:51, 26 April 2011 (UTC)[reply]
(Edit conflict, but I'll just post this anyway.) GIFs are limited to 256 colours per frame; I suspect that's the cause of the problem here. The best file formats for this sort of thing, in particular MNG and APNG, tend to be poorly supported by most programs. Unfortunately, most well-supported formats (e.g. WMV or MPEG-4) use lossy compression, which means you won't be able to get a pixel-perfect representation. Furthermore, they tend to be patented, which may also pose a problem. All in all I'd still say APNG is the best (it's non-patented, lossless, and designed especially for animations with many colours and no audio), despite the fact that only a few applications support it. --Link (tcm) 08:53, 26 April 2011 (UTC)[reply]
Thanks. Since I already produced an MNG, how can I view it ? StuRat (talk) 09:37, 26 April 2011 (UTC)[reply]
Multiple-image Network Graphics lists some viewers. Support for it is pretty disappointing. -- Finlay McWalterTalk 09:51, 26 April 2011 (UTC)[reply]

Also, I should add that I would like a format which supports running in a loop. StuRat (talk) 09:37, 26 April 2011 (UTC)[reply]

I was going to say that that GIF did a pretty good job of representing a very large range of colors with its palette of just 256 colors. Dithering is the technique used to do this with such a small palette, and dithering is the cause of the artifacts you're complaining about. Comet Tuttle (talk) 16:51, 26 April 2011 (UTC)[reply]
Dithering might not be so bad, but this seems to be a particularly poor job of dithering. If it can't find the exact color match in it's palette, it should be able to find something closer to what was chosen. I just did another test, restricting the color output to 256 colors per frame, and there was no horrid dithering, so that's one option. StuRat (talk) 17:54, 26 April 2011 (UTC)[reply]
I'm not familiar with imagemagick, but programs like Paint Shop Pro give options for optimizing the pallet used which can significantly improve (or worsen!) the final GIF. I agree with Comet Tuttle, though, that the image looks pretty darn good for only 256 colours and you're not likely to improve it much while still using the GIF format. Still, it may be worth a try since you've come this far already. Matt Deres (talk) 19:03, 26 April 2011 (UTC)[reply]
Try Photoshop's "Save for Web" option. It has several algorithms for selecting an optimum 256 color palette. (Usually the best one is "perceptual"). Also, if you choose the dithering option of "pattern" rather than "diffusion", it may make the dithering less apparent when animated. --24.249.59.89 (talk) 16:04, 28 April 2011 (UTC)[reply]

Here, I used Irfanview to reduce the image's color palette to 256 colors and got the above, which is clearly a way better dithering job. I am not familiar with imagemagick, either, but maybe it used a palette based on some standardized set of "web-safe colors" or the like? Comet Tuttle (talk) 21:28, 28 April 2011 (UTC)[reply]

OK, thanks for the answers everybody. StuRat (talk) 23:18, 30 April 2011 (UTC)[reply]

Resolved

StuRat (talk) 23:18, 30 April 2011 (UTC)[reply]

Legality of deep linking

[edit]

I want to know what is the legality of deep linking in the US, the UK, and India? In archive search, I found an old discussion here, but that does not shade much light on this issue. I searched Google and found the following results:

In the US

  • [1][2] A Texas court judge said deep linking "qualify as a copied display or performance of plaintiff's copyrightable material". But at the same time the judge was criticized. It is mentioned in the Wikipedia article. But it does not shed light on the overall legal situation in the US.

In the UK

  • I do not find any information.

In India

  • The Wikipedia article gives one example of court ruling which says court critical of deep linking.
  • [3] This says, "There is no decided case law in the area of deep linking, although there have been several high profile cases settled out of court and a recent partial decision in one large case."

I was browsing the Guardian website and saw how they used massive deep linking. Is that legal? --Goqer (talk) 09:41, 26 April 2011 (UTC)[reply]

The trouble is, there aren't any laws against it, just questions about whether deep linking has any interpretation within the framework of copyright law. It's entirely unclear that it does, as you can see above. Given how common the practice is, even amongst the various governments in question, it seems safe to assume that most people don't assume deep linking has any legal implications. That's not the same thing as being safe, though — all it takes is a few lawsuits squeaking through and you're in trouble. It is one of those areas of the law which is not yet fully determined. It seems to me incredibly unlikely that any general decision against deep linking will occur; the argument that it appropriates content is rather specious, and it's technically quite easy for a linked-to site to prevent sites from linking to their content (add a paywall or whatever). But one should never underestimate the technical ignorance of judges, who actually make these kinds of decisions in the absence of legislation. --Mr.98 (talk) 12:20, 26 April 2011 (UTC)[reply]
Some sites even forbid linking to them at all - check this list; some on that have changed since, but not all - if you read their T&C at face value, the Wikipedia Ocado article violates it. Worse, are website T&Cs legally enforceable, civilly or even criminally? No, or maybe, or yes, even if no-one reads them. You can guess yourself, or pay a lawyer to guess for you. -- Finlay McWalterTalk 13:29, 26 April 2011 (UTC)[reply]
It's of note that the final "yes" there was an extremely specific legal case that had nothing to do with linking, and the judge in question explicitly put limits on their own ruling. I'd want to see specific cases about deep linking before drawing any big conclusions about whether the TOS clauses matter at all in that area. --Mr.98 (talk) 14:02, 26 April 2011 (UTC)[reply]
What you really want are law review articles that address this specific point. They'll give you a good overview, and link you to the specific cases on point. It's much better for you to get your information from someone that spent a semester toiling over this question than any of us here, no matter how Jeopardy-esque some of us are.
I found a few, although some are a little older. Here's a list of cites. They're not generally available online so you may need to find yourself a local law library: 29 Stetson L. Rev. 203 (1999-2000); 49 Case W. Res. L. Rev. 181 (1998-1999); 2000 Stan. Tech. L. Rev. 1 (2000); 1998 J. Info. L. & Tech., Issue 2 (1998); 82 Tex. L. Rev. 1053 (2003-2004); 16 Berk. Tech. L.J. 1273 (2001). There are many more. This might be a good place to start though. Shadowjams (talk) 19:20, 27 April 2011 (UTC)[reply]

HTM page in "www.south-pole.com" brings down the browser

[edit]
Resolved

Doing a Google search I cannot follow the link to page "www.south-pole.com/p0000101.htm". With Firefox 3.6.16 all Firefox windows are brought down. With IE 8.0.6001.18702 I get the error "We were unable to return you to south-pole.com.". This behaviour occurs even if I try and access the cached version of the page. I'm using Windows XP SP3. Any advice on how to get more information about this problem? By the way, I have nothing to do with the site, I'm just trying to follow a link. Jan1naD (talkcontrib) 13:20, 26 April 2011 (UTC)[reply]

The menu at the top is a Java applet; your java install may be broken. -- Finlay McWalterTalk 13:31, 26 April 2011 (UTC)[reply]
Thanks very much, that's exactly what it was. Jan1naD (talkcontrib) 14:06, 26 April 2011 (UTC)[reply]

Google and its web of lies!

[edit]

If I search Google using 'SV40PA', I find the following page as the first result. This page contains a string of letters including 'TCAGCCATACCACATTTGTAGAGGTTTTACTTGCTTTAAAAAACCTC', which Google includes as an excerpt. If, however, I search Google using 'TCAGCCATACCACATTTGTAGAGGTTTTACTTGCTTTAAAAAACCTC', it tells me a bare-faced lie that there are no results. Are there any search engines which don't discriminate against geneticists? --129.215.47.59 (talk) 14:42, 26 April 2011 (UTC)[reply]

What you're using is Google Search, a generic text search engine chiefly intended for searching normal human written text for dictionary words and proper names. Such engines perform poorly for indexing, and searching on, textual information that's mostly not composed of words (e.g. computer source code, mathematical expressions, genetic or chemical data, and numerical data). So you're using the wrong tool, and you're no more being discriminated against than if you were trying to a hammer a nail in with a cat and finding the cat uncooperative. Google does have an experimental search engine for computer source code but I'm not aware that they have one for genetic data. Genome.gov lists some more specialised options here. -- Finlay McWalterTalk 14:54, 26 April 2011 (UTC)[reply]
  • That's simply because you used only a part of the "word" appearing on the page. The search engine is designed for finding words, because that's what people seek in Google most often. Use the whole 'word' ATCTAGATAACTGATCATAATCAGCCATACCACATTTGTAGAGGTTTTACTTGCTTTAAAAAACCTCCCACA and Google will find it – [4] --CiaPan (talk) 15:41, 26 April 2011 (UTC)[reply]
By what I've understood, a lie is deliberate misinformation. Google search engine is not perfect, and as far as I know, doesn't claim to be. I'm also fairly sure it doesn't discriminate against geneticists, but rather has a "competence" issue, in other words, a bug or technical limitation. Zakhalesh (talk) 16:12, 26 April 2011 (UTC)[reply]

There is a search engine called QueryGene that uses Google to search based on partial nucleotide sequence data, but it doesn't seem to be operational at the moment. Looie496 (talk) 17:12, 26 April 2011 (UTC)[reply]

Google seems to have a habit of serving up pages nowadays that don't contain your search term. Sometimes the term is in a page you can reach from the page that you got (often behind a paywall) - sometimes I think it's only present in other pages that link to the page you got. That's not just for genetics, but in general. Wnt (talk) 02:18, 29 April 2011 (UTC)[reply]

Edit

[edit]

Where has the 'Edit' link gone, it seems to come and go, a Wiki problem or my computer?--85.211.238.236 (talk) 16:49, 26 April 2011 (UTC) Damn it! it's back again!--85.211.238.236 (talk) 16:50, 26 April 2011 (UTC)[reply]

For performance reasons, people who view Wikipedia when not signed in see a version served to them typically from a cache, and sometimes see weird effects where things appear and disappear, depending on which cache they're looking at (as, for performance reasons, the different web caches are not synchronised or consistent). If you create an account and view the site when signed in you get an uncached, definitive view of the site, and such now-you-see-it antics won't happen. -- Finlay McWalterTalk 17:02, 26 April 2011 (UTC)[reply]

This has been an issue for a while now, here is one of the recent discussions on it. It's a problem with Wikipedia not your computer. To clear it when it happens you can try purging the server cache like this. 82.43.89.63 (talk) 20:20, 26 April 2011 (UTC)[reply]

In Firefox, just hit ctrl-F5 to reload the page clearing the cache, and the edit button should come back. I don't know the equivalent in other browsers. 69.111.194.167 (talk) 06:29, 27 April 2011 (UTC)[reply]

That will clear Firefoxes cache, but the problem is happening with Wikimedias cache. I've tested and even a completely new instance of Firefox with all browsing data cleared will suffer the problem when it happens. 82.43.89.63 (talk) 16:22, 27 April 2011 (UTC)[reply]
Did you hit ctrl-F5, and what happened? I think it does more than just clear the browser cache. I haven't looked at the wire traffic but it may be sending different cache-control headers to the server, or something like that. Anyway, it always works for me. You can also put ?action=purge at the end of a WP url, e.g.
http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/Computing?action=purge
69.111.194.167 (talk) 07:41, 28 April 2011 (UTC)[reply]

Where does gcc literally write binary to the .o file?

[edit]

Getting past the conversion of high-level language and supposing in your .s file you have some assembly line like ADD r6, r1, r2 (add r1 + r2 and store in r6) where would you find the code in gcc that would be running at the moment 0x223020 (the MIPS example from here, suppose that was your target architecture) was written to the .o file? Thanks. 20.137.18.50 (talk) 21:41, 26 April 2011 (UTC)[reply]

Presumably you mean a recent version of GCC. The general process you describe is performed by the assembler, as. You might find the GNU C Compiler Internals wikibook helpful as an overview; here are very technical resources for you: GCC Selected Readings. The exact implementation (and thus, the "line of code" and even the source file) for as depends on your specific toolchain; if you are on an ordinary Intel-style PC, your flow generally goes from C code expression to GIMPLE intermediate representation to gcc RTL to x86 object file format, as described here, in from RTL to Object, and finally your operating system's loader (or GNU ld) will help GCC convert a .o into an executable program that meets your operating system's execution contract. In GCC 4.1 and more recent:
Each target architecture has its description represented as struct gcc_target targetm. Default initializers are available in file targhooks.c.
The backend generates the assembly code for the specified target platform. Function output_asm_insn() is called for each instruction written to the assembly file. Function final_start_function() generates the prolog of the function before it is saved to the assembly file.
In most cases, the result is a .s assembly-language file, which typically only exists as a Unix pipe between gcc and your as driver. as then does a dumb machine translate between textual mnemonics and binary code.
Understand that not all architectures are created equally; so your as may vary.
As a last note, understand that the GNU toolchain is actually a very complicated software system; feel free to ask for clarification if you're lost or just need more technical details. This is a very sophisticated system, and it's surprising how few people on the planet spend the time to learn how it actually works. If the Kernel embodies a net worth of a half billion dollars of invested software engineering time, imagine how valuable our Free Compiler is, which is a requisite to building the Kernel! Point is, a lot of man-hours are invested in this stuff, it's incredibly complicated. Nimur (talk) 22:16, 26 April 2011 (UTC)[reply]