Wikipedia:Reference desk/Archives/Computing/2008 July 27

Computing desk
< July 26 << Jun | July | Aug >> July 28 >
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.


July 27

edit

PDF files

edit

Is there anyway to turn PDF files into something more like a book? —Preceding unsigned comment added by Tyler123459 (talkcontribs) 00:03, 27 July 2008 (UTC)[reply]

Yes, there is a device that was invented for this purpose. It is called called printer. --Juliano (T) 00:23, 27 July 2008 (UTC)[reply]
I believe most PDF viewers have the option to display a PDF in book format. That is, with two pages shown at once, and you flip the pages two at a time. However, be advised that you would need to have quite a small number of lines on each page or a rather large, high resolution screen, to be able to read it at that scale. For a typical PDF file and screen resolution, you could only read it if about half a page is shown at a time. StuRat (talk) 04:55, 27 July 2008 (UTC)[reply]
I occasionally export PDF files to png files, then read them with Mangariini. I find that a pretty pleasant way to read on my tablet. APL (talk) 13:47, 28 July 2008 (UTC)[reply]
It is possible you are looking for optical character recognition. This will convert a PDF into text form, and you may then be able to use a word-processor to reformat the text in whatever way you like. Nimur (talk) 15:21, 28 July 2008 (UTC)[reply]

Challenge

edit

Is there a Wikipedia article on a website which has a higher Google ranking than that website for a search of the websites name? Skomorokh 04:09, 27 July 2008 (UTC)[reply]

Do you mean Googlefight or Google Trends or Alexa Internet ? 87.102.86.73 (talk) 11:20, 27 July 2008 (UTC)[reply]
I just meant came higher when one did a Google.com search for the website's name. But, if you want to get technical, let's make it the "I'm feeling lucky" result. Think you got one? Skomorokh 11:24, 27 July 2008 (UTC)[reply]
For google the page to read is PageRank - that's what they use to put the search results in order..87.102.86.73 (talk) 12:15, 27 July 2008 (UTC)[reply]
I'm not looking to read anything, I'm looking for empirical evidence of a link to a wikipedia article on website x appearing higher in a Google search for "website x" than websitex.com. Comprende? Skomorokh 12:21, 27 July 2008 (UTC)[reply]
So you want for example
http://en.wikipedia.org/wiki/Msn
to have a higher page rank than
http://www.msn.com/
?
None I can find - have you tried looking for yourself?87.102.86.73 (talk) 12:47, 27 July 2008 (UTC)[reply]
Aye, that's it. Skomorokh 13:10, 27 July 2008 (UTC)[reply]
There are lots of them if you use generic nouns. For example, Soda is higher than soda.com. Also, the occasion long-disbanded classic rock band words too (Sweet (band) vs. thesweet.com). As far as products and companies go, probably not. —Akrabbimtalk 13:04, 27 July 2008 (UTC)[reply]
Interesting, thanks Akrabbim. If we were to narrow the criteria again such that the website name had to have as it's most common use that entity, could you find any? Skomorokh 13:10, 27 July 2008 (UTC)[reply]
I think they meant "wikipedia article on a website that is 'more notable' than the website itself"?87.102.86.73 (talk) 13:08, 27 July 2008 (UTC)[reply]
More notable in Google terms, not Wikipedia's, of course. Skomorokh 13:10, 27 July 2008 (UTC)[reply]
Was there any specific topic area you where thinking of?87.102.86.73 (talk) 13:20, 27 July 2008 (UTC)[reply]
No, I was just curious if it happened at all. Skomorokh 13:57, 27 July 2008 (UTC)[reply]

It doesn't happen very often - because wikipedia does not establish notability in itself any site that might fulfill your criteria would probably we deleted as non-notable..

Two possibilities exist 1. Sites that no longer exist 2. Sites that no-one wants to visit but people have heard off eg http://www.google.co.uk/search?hl=en&q=goatse&meta= change the search term to 'goatse.cz' and the situation is reversed.87.102.86.73 (talk) 13:43, 27 July 2008 (UTC)[reply]

Insightful, I hadn't considered those angles, thanks. Skomorokh 13:57, 27 July 2008 (UTC)[reply]
(Sorry about the initial misunderstanding - I've become so used to incoherent questions I didn't notice that yours made sense - and interpreted it incorrectly...)87.102.86.73 (talk) 14:06, 27 July 2008 (UTC)[reply]
De nada, thanks for all your help and effort. I help out at the ref desks occasionally so I now how it can get. Mahalo, Skomorokh 14:12, 27 July 2008 (UTC)[reply]

Bash script

edit

Is it possible to write a script which will create directories and subdirectories based on information in a spreadsheet? Specifically, i want it to begin on the A1 of the spreadsheet and create a directory in the "home" directory using the data in A1 as a name. Then for every cell to the right of A1 (A2,A3,A4...) which isn't empty create a subdirectory in the directory created again using the data in the cell as a name. Repeat for A2, A3, A4 etc until it comes to an empty cell. Is this possible? --212.120.246.239 (talk) 13:36, 27 July 2008 (UTC)[reply]

Many spreadsheet programs have a macro language built-in. TBH I don't know for sure, but I would assume that a sufficently sophisticated macro language would be able to call system functions to do things like create file or directories. It would however very much depend on which OS and spreadsheet program you are using. Astronaut (talk) 14:33, 27 July 2008 (UTC)[reply]
Perhaps the bsh script could execute a command to export data from the spreadsheet into a flat file, possibly using a macro to format it, then read that data and go from there. If not, you would need to manually export the data from the spreadsheet before firing off the bsh script. StuRat (talk) 15:22, 27 July 2008 (UTC)[reply]
Some spreadsheet programs save the sheet as XML anyway (or have this as an option). So, if you're prepared to change gear from Bash to something like Python / Perl / Ruby then you can just grab an XML parser, and do whatever you like with the data. --78.86.164.115 (talk) 23:31, 27 July 2008 (UTC)[reply]
PS I don't mean to say that this will be impossible in Bash but possible in Python / Perl / Ruby, just that it'll be like a million times easier. --78.86.164.115 (talk) 23:32, 27 July 2008 (UTC)[reply]
I agree that Perl or similar is more appropriate for this kind of thing, but the following will work if you save your spreadsheet as comma-separated values and your data isn't too weird:
cat mysheet.csv | while read ; do mkdir -p "${REPLY//,//}"; done
--Sean 14:29, 28 July 2008 (UTC)[reply]

Reading a BMP file

edit

I am trying to read a BMP file. First, of course, I read the BitmapFileHeader and BitmapInfoHeader structures. I define the integer

PaddingBytes := (bmpInfoHeader.biSizeImage - (bmpInfoHeader.biWidth * bmpInfoHeader.biHeight * bmpInfoHeader.biBitCount div 8)) div bmpInfoHeader.biHeight;

Then, if biBitCount is less than 24, I try to read the palette. For every integer i in [0, biClrUsed - 1], I read bytes blue, green, red, and flag and store those in palPalEntry[i] of a new LogPalette structure. Finally, I read the pixel data, from the last to the first line. The length of each line, I have experimentally found to equal

linewidth := (bmpInfoHeader.biWidth * bmpInfoHeader.biBitCount) div 8 + PaddingBytes;

(where the "surprise" is the addition of the PaddingBytes constant - actually, what I found experimentally was that tis constant is often non-zero). This approach works very well for most bitmaps where bfType = 19778 ("BM"), biCompression = 0, and biBitCount is 16, 24 or 32, i.e. for almost all modern bitmaps. However, if biBitCount is smaller, the colours get wrong and, even if the incorrect colours are ignored, the drawing appears corrupted, in a way I would blame on an incorrect value of PaddingBytes. What could be wrong? --Andreas Rejbrand (talk) 14:24, 27 July 2008 (UTC)[reply]

Your PaddingBytes calculation is confusing to me, first because I don't know how the height could be relevant and second because I don't know what language it is in so I can't be confident about what "div" means. According to BMP file format#Bitmap data, the padding after each row of the image is to make the total number of bytes per row a multiple of 4. So in C it would be calculated as (width*bitsperpixel)%4 ? 4-(width*bitsperpixel)%4 : 0 --tcsetattr (talk / contribs) 18:47, 27 July 2008 (UTC)[reply]
Dammit, that was wrong. I forgot to convert the bit count to a byte count. But I hope you get the idea. --tcsetattr (talk / contribs) 18:48, 27 July 2008 (UTC)[reply]
Time for some correct code... it'll be easy (and more educational) if I remove the macho "do it in one big expression" aspect.
bitsperline = bitsperpixel * pixelsperline;
bytesperline = (bitsperline + 7) / 8;
padding = 4 - bytesperline % 4;
if(padding == 4)
  padding = 0;
--tcsetattr (talk / contribs) 19:17, 27 July 2008 (UTC)[reply]
Thank you for your code, though it appears to do the same thing as my first code. Here is how I think: if there were no padding bytes, the size of the pixel data would be equal to the product
bmpInfoHeader.biWidth * bmpInfoHeader.biHeight * bmpInfoHeader.biBitCount div 8
where the "div" operator simply means (integer) division.
But the actual size of the pixel data is stored in the BitmapInfoHeader structure as bmpInfoHeader.biSizeImage, so, the total number of padding bytes must equal the difference
bmpInfoHeader.biSizeImage - (bmpInfoHeader.biWidth * bmpInfoHeader.biHeight * bmpInfoHeader.biBitCount div 8)
Thus, the number of padding bytes per line is given by my expression for PaddingBytes.
--Andreas Rejbrand (talk) 19:57, 27 July 2008 (UTC)[reply]
Does anyone know if there is a web site with sample code for reading a BMP file (with any value of biBitCount)? --Andreas Rejbrand (talk) 20:20, 27 July 2008 (UTC)[reply]
If there were no padding bytes, there could still be unused bits at the end of each row, if the number of bits per row is not a multiple of 8. But the whole idea of calculating a "total padding" amount for the whole image and then dividing it among the rows is asking for trouble. Calculate the padding per row by rounding the bpp*width up to a multiple of 32 bits, and ignore the stupid biSizeImage field. Being redundant, the only thing it can add is inconsistency. --tcsetattr (talk / contribs) 21:44, 27 July 2008 (UTC)[reply]
You might be right; in some cases my code does not work at all. --Andreas Rejbrand (talk) 23:46, 27 July 2008 (UTC)[reply]
But, then again, perhaps not... I have not found a single bitmap where our expressions differ, and your code produces the same error as mine. For instance, on one particular bitmap, both our methods give PaddingBytes = 0, where a "manual override" to PaddingBytes = 1 is needed to make the picture appear as it should. --Andreas Rejbrand (talk) 13:51, 28 July 2008 (UTC)[reply]
It's possible you have an error somewhere else in your code. Or you might have found one of the rarer bmp variants. Could you provide a sample image? I'd like to see the file, just to be sure. You can zero out everything after the header if the image data is private. Or just paste a hex dump of the first 54 bytes. --tcsetattr (talk / contribs) 18:55, 28 July 2008 (UTC)[reply]
The bitmaps that do not work are the 1 and 4 bit BMP images in the archive found at http://pobox.com/~jason1/bmpsuite/. These files look just fine if the padding number is 1, but both our expressions return 0. If I could just find a way to determine when to perform this "manual override", then my program appears to be able to read all (uncompressed) bitmaps. --Andreas Rejbrand (talk) 22:19, 28 July 2008 (UTC)[reply]
OK, that proves you're misinterpreting something. There are definitely no padding bytes in g01bg.bmp, for example. There is a single unused bit in the last byte of each row, but no padding bytes. Your error is elsewhere. --tcsetattr (talk / contribs) 23:18, 28 July 2008 (UTC)[reply]
You are probably right; I need to study the distinction between "ordinary" padding bytes and this unused bit a bit more. --Andreas Rejbrand (talk) 09:56, 30 July 2008 (UTC)[reply]

best video database

edit

What is the best database solution for storing large amounts of images and videos? I have used rar formats and zip but they become slow at large file sizes and zip only has a 4GB limit. ZigZap (talk) 14:53, 27 July 2008 (UTC)[reply]

Is there a problem with using your OS's filesystem? Images and video don't really compress that well anyway.--mboverload@ 20:28, 27 July 2008 (UTC)[reply]
iTunes will help store and index videos for you, if you're using windows or mac. —Preceding unsigned comment added by 75.31.172.73 (talk) 21:59, 27 July 2008 (UTC)[reply]
I'm pretty confused as to what you are really asking for. RARs and ZIPs are compression formats. They are not database systems. --98.217.8.46 (talk) 02:36, 28 July 2008 (UTC)[reply]
If you want to reduce file size, you should probably not rar or zip your video data, you should consider recompressing it with a video codec. FFmpeg is probably available for your platform and can perform this recompression. If you are just looking for a way to index your files, you might want to avoid placing large binary files into a database (it is possible, but it is usually easier to store a URI to the file). Nimur (talk) 15:27, 28 July 2008 (UTC)[reply]
Note that compressing it with a codec will probably significantly reduce the quality of the video itself. --98.217.8.46 (talk) 15:31, 28 July 2008 (UTC)[reply]

Help writing entry for my business website link to wikpedia

edit

Hi

is there anyone that can help me write my entry on wiki and assist me link my website www.altogether-mbs.co.uk I have had eye surgery and cant spend hours researching the best way to do this professionally thank you for your time Tim MARTIN —Preceding unsigned comment added by 86.134.124.205 (talk) 14:56, 27 July 2008 (UTC)[reply]

It's not appropriate to link to commercial web sites from Wikipedia, unless your site is notable in some way, which seems unlikely for the typical small business. StuRat (talk) 15:17, 27 July 2008 (UTC)[reply]
Please see WP:CORP for what we mean by 'notable' when it comes to businesses. — Matt Eason (Talk &#149; Contribs) 15:32, 27 July 2008 (UTC)[reply]

Scorched Earth game

edit

Where can I download a version of Scorched Earth (any version 1.0-1.5) that works with Windows XP with minimal fiddling? --The Fat Man Who Never Came Back (talk) 16:28, 27 July 2008 (UTC)[reply]

You can get it [Here http://www.dosgamesarchive.com/download/game/144]. I just tried it in XP. I needed to fiddle with the "mouse speed", and the sound was very quiet. But it was playable. Some of the animations go too fast on a modern PC, though. APL (talk) 17:20, 27 July 2008 (UTC)[reply]
Incidentally, if you're looking for a very good modern re-make, [Charred Dirt http://www.charreddirt.com/] captures a lot of the charm of the old original. APL (talk) 18:14, 27 July 2008 (UTC)[reply]
It actually looks great; the quiet sound was an issue, but the animations seem just fine. Thanks for finding it for me. I may check out the re-make as well.--The Fat Man Who Never Came Back (talk) 03:59, 28 July 2008 (UTC)[reply]
And, though you specifically asked for the old Scorched Earth, you might be interested in Scorched 3D. Though it's hardly the original version, it is my opinion that they have preserved the spirit of the game. Nimur (talk) 15:29, 28 July 2008 (UTC)[reply]

XP Lang.

edit

I have a Windows XP disc, which has a default language of Spanish, is there any way that i can make it appear English (with all the menu options and everything) after i install it on ma computer? pl. help..cheers —Preceding unsigned comment added by 123.252.224.65 (talk) 17:04, 27 July 2008 (UTC)[reply]

I don't think so. Admiral Norton (talk) 17:31, 27 July 2008 (UTC)[reply]
You can get a "MUI" disc for Windows XP. MUI stands for multi user environment and the original idea behind it is to allow users of different languages to use the same computer/Windows installation.
Sadly, MUI discs are only giving out by Microsoft to very big companies, because it's just not the standard feature people need. So unless you are working for such a company, the only way to get your hands on such a disc would be an illegal download, which I in no way recommend hereby. --Natanji (talk) 18:03, 27 July 2008 (UTC)[reply]

Pronunciation

edit

How do you pronounce API? A-P-I or A-Pie? Eklipse (talk) 17:43, 27 July 2008 (UTC)[reply]

A-P-I. Never heard anything different. After all it's not about eating ;) I find "A-Pie" very amusing, however. ;) --Natanji (talk) 18:24, 27 July 2008 (UTC)[reply]
or appy rhyming with happy. Graeme Bartlett (talk) 03:16, 28 July 2008 (UTC)[reply]

Linux distribution for offline use - recommendations

edit

Hi, a friend of mine wants to try Linux. All he will do is read some pdfs, listen to music, watch movies etc. The problem is with installing drivers and proprietary multimedia codecs offline. We can't get internet connection on that machine. So we are looking for an out of the box distro.

Mandriva has drivers installed by default but doesn't have the proprietary multimedia codecs. Linux Mint has codecs but you have to use Envy to install the driver. Envy requires internet connection.

Is there any distro that comes with all these things (drivers+codecs) preinstalled and is free, too? (I don't want to buy Fluendo codecs)

Thanks -Abhishek (talk) 17:52, 27 July 2008 (UTC)[reply]

Ubuntu Super Edition already includes codecs and all that stuff, but not more drivers than in ubuntu, since it is not possible to have them all installed.... you can also use APT on CD to get the packages you need (on a PC with internet), and then just copy the local repositories to the other PC that is offline... SF007 (talk) 04:40, 28 July 2008 (UTC)[reply]

Javascript works in Firefox but not IE

edit

This Javascript works 100% beautifully in Firefox and Safari but IE chokes on it. As is typical IE is somewhat cryptic in its complaint but it doesn't seem to like the line where I change the innerHTML of the SPAN element. Am I doing something wrong? (Other than trying to make sure my code is compatible with IE. But it's for work, and it's gotta be compatible with the major browsers.)

function tagloader() {
	for (i=0;i<document.getElementsByTagName("p").length;i++) {
		var s = document.getElementsByTagName("p").item(i);
		if(s.className=="tl") { 
			s.getElementsByTagName("span").length;
			for (x=0;x<s.getElementsByTagName("span").length;x++) {
				s.getElementsByTagName("span").item(x).innerHTML = " ";
			}
		}
	}
}

The code just goes through all of the P elements, and then if they are of the right class then it cycles through and modifies all of the SPAN elements. (It's part of a larger bit of code, if you're wondering why.)

Any clue? I assumed that it had something to do with getElementsByTagName but IE claims to be able to deal with it and in any case it only seems to choke on that particular line. Thoughts? --98.217.8.46 (talk) 20:27, 27 July 2008 (UTC)[reply]

It works fine for me in Windows XP/IE7 (more specifically 7.0.5730.11 ). What's the error message? BTW as a matter of good practice you should put var before i and x in the for statement, otherwise they will be treated as global variables, with potentially unpleasant and hard-to-debug consequences (it may even be the cause of the problem here, since you say this is partial code). AndrewWTaylor (talk) 12:36, 28 July 2008 (UTC)[reply]
The error message is just something like "object doesn't support this method" or something like that. Hmm. Well I'll play with it a little more. I was unable to get even just this snippet to run correctly outside of the rest of the code in IE7/XP. --98.217.8.46 (talk) 15:30, 28 July 2008 (UTC)[reply]
Unless you've got a JavaScript library, I don't think item() is a valid function for an array. You can do something like ps=document.getElementsByTagName('p'); and reference an item using ps[i] where i is an integer, rather than ps.item(i). Also, not sure what s.getElementsByTagName("span").length; is supposed to achieve. x42bn6 Talk Mess 19:29, 28 July 2008 (UTC)[reply]
Strictly speaking getElementsByTagName returns a NodeList rather than an array, so the item property is valid. AndrewWTaylor (talk) 08:41, 29 July 2008 (UTC)[reply]
OK, I played around a little more and I think it was due to those VARs being missing. I added them back in and now it works fine. Thanks! --98.217.8.46 (talk) 17:27, 29 July 2008 (UTC)[reply]

MSCE or A+ certification for helpdesk job?

edit

What is the current most common certification expected from somebody applying for a helpdesk job in a company? I was told that WSCE was replaced by something else? Or would it be A+? etc. --Sonjaaa (talk) 23:13, 27 July 2008 (UTC)[reply]

A+ Certification is pretty common. That's the one I hear most about. Useight (talk) 01:42, 28 July 2008 (UTC)[reply]