Wikipedia:Reference desk/Archives/Computing/2012 July 16

From Wikipedia, the free encyclopedia
Computing desk
< July 15 << Jun | July | Aug >> July 17 >
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 16[edit]

Ruby File Reading Confusion[edit]

Hi, I open a file in Ruby and, then do:

size = 0
file.each_byte do |byte|

size += 1

end
puts size

For some reason the final result turns out to be far smaller than the size of the file. I have a file that is 1 gig that tells me it read only 4000 some bytes. Any idea what is going on? Originally I was trying to operate on each byte of a file and save the result (which should be the same size), I always ended up with something smaller, hence the reason I'm running the above test in the first place. If it helps, I'm using ruby 1.9 on 64bit windows 7. Also, if it helps: the final output varies file to file, but is always the same when run on the same file. Thanks:-)71.195.84.120 (talk) 01:41, 16 July 2012 (UTC)[reply]

Apparently, the file needs to be opened using rb not just r...so problem resolved71.195.84.120 (talk) 02:16, 16 July 2012 (UTC)[reply]
Good, I will mark it resolved. StuRat (talk) 03:20, 16 July 2012 (UTC)[reply]
Resolved

MS IntelliType on MacOS[edit]

Resolved

Until recently I used an old Microsoft Natural keyboard, until it suddenly lost three letters (zxb) from its repertoire. I bought a new MS Natural with "IntelliType" software, which has some pleasant features, but the F# keys no longer do their standard MacOS functions. With IntelliType active, they do things like Save and Print; with IntelliType disabled, they do nothing. The "Microsoft Keyboard" control panel (in System Preferences) says of the F# keys only – falsely – that they are "Handled by Mac OS".

I can't be the only one to have faced this mess! The next thing I try will be to uninstall IntelliType entirely. —Tamfang (talk) 01:52, 16 July 2012 (UTC)[reply]

Hmm. This blog is written by someone facing pretty much the opposite mess - that the F-keys only do the standard functions and not the extended options. However, he seems to have narrowed it down to issues between the driver software and Mac OS, so removing IntelliType may be the best option. - Cucumber Mike (talk) 06:38, 16 July 2012 (UTC)[reply]
That blog page indirectly gave me the simplest answer to my problem: toggle "F Lock" (a key beside F12). Now the F# keys behave as expected. —Tamfang (talk) 19:13, 16 July 2012 (UTC)[reply]

image number appearing while saving[edit]

Whenever i save some picture from a website, a number is automatically assigned to its name.What is that number? — Preceding unsigned comment added by Amrahs (talkcontribs) 14:47, 16 July 2012 (UTC)[reply]

Without knowing the site there isn't really an accurate way to answer this. Could you give an example filename? Websites generate filenames based on all sorts of different things, for example the date (such as a unix timestamp), how many previous files are on the server, or a random number. Your browser or an extension could also be generating these numerical filenames. AvrillirvA (talk) 15:22, 16 July 2012 (UTC)[reply]
I think that is the file name that the website uses. Try downloading one from wikipedia or commons and see if any strange numbers are added?--Canoe1967 (talk) 15:25, 16 July 2012 (UTC)[reply]
What is that website?--Shantavira|feed me 16:18, 16 July 2012 (UTC)[reply]

If the filename is the same as another file already in the directory you're downloading to, many browsers will add a number (and continue to add an incremented number as many times as you do it) instead of replacing the existing file. ¦ Reisio (talk) 02:21, 17 July 2012 (UTC)[reply]

Webdesign[edit]

I am looking for an idea for the header part of a website. Don't need any actual code, but just an inspiration. Basically I have two blocks of links that I want to arrange:

Block A: Home (could perhaps also go to block B), Part 1, Part 2 Block B: About us, contact, etc.

By blocks, I mean links that belong logically together and links in one block should have the same style but be distinguished graphically from those of the other block. Any website I was looking at only had a single row of links which all have the same style. Any suggestions on an example website or any other ideas would be appreciated. bamse (talk) 15:50, 16 July 2012 (UTC)[reply]

What's the question? I happened to have this page [1] open in another tab, which has three rows of links - one for sections of the BBC site, one for categories of news, and one local areas. This sounds like what you've described, but surely you wanted something more than a link to the first website I saw?  Card Zero  (talk) 16:54, 16 July 2012 (UTC)[reply]
Thanks, in fact something like that could work. Ideally the design would emphasize the fact that there are two main parts (Part 1 and Part 2) to the site, but will think about the bbc design. bamse (talk) 19:35, 16 July 2012 (UTC)[reply]
It would help to know what the subject matter is, as some subjects may lend themselves to graphics. For example if "Part 1" is "mammals" and "Part 2" is "birds", you could have a pic of each family be the link to those items. An icon of a house is frequently used to represent the home page. StuRat (talk) 20:04, 16 July 2012 (UTC)[reply]
Unfortunately more boring than that. It is an auction/marketplace site and part 1 would be all the auctions and part 2 would be a listing of marketplace items (i.e. items for which user can make offers which are then accepted/rejected by the seller). bamse (talk) 20:38, 16 July 2012 (UTC)[reply]
An auctioneer's gavel sounds good as an icon for the first one. The 2nd one is a bit trickier. Maybe one person handing money to another while that person hands a box to the first ? StuRat (talk) 03:46, 17 July 2012 (UTC)[reply]

Milk spill on laptop keyboard[edit]

Hey all; I'm typing this message from my desktop PC because I've managed to spill a quantity (maybe 1/5 cup?) of semi-skimmed milk onto my laptop computer. Immediately afterwards, I did the obvious things - clean up the residue, turn the laptop over - but despite these efforts the keyboard does not function properly. At first, it was just that some keys fired for multiple letters (so both i and o would trigger the sequence "io", for example) but now I've noticed that a couple of the keys plain aren't working. We're about 24 hours on now. Should I continue to wait - and if so, how long? - or get someone to open it up properly and take a look? (The computer functions fine otherwise, it's just the keyboard that's botched.) I opened up the bit you're "supposed" to open up but I can't get close to the keyboard like that. Regards, - Jarry1250 [Deliberation needed] 18:07, 16 July 2012 (UTC)[reply]

Try compressed air (that comes in cans) + removing the keys. the keys of my laptop can be removed. you can just pop them off. Verify that yours can be removed too (probably yes). Clean the removed keys with soap, let them dry. Clean the laptop with the air can OsmanRF34 (talk) 19:31, 16 July 2012 (UTC)[reply]
My keys can be removed, but they reveal a plastic surface with holes through which the actual plastic press-sensors project; which bit do you think is worth cleaning? - Jarry1250 [Deliberation needed] 21:31, 16 July 2012 (UTC)[reply]
Another option is an external keyboard. As long as you have a free connector which matches the keyboard (presumably USB), that should work. It does make the laptop less portable, but promises to completely fix the problem at a minimal cost (or even free, if you have an extra keyboard or can borrow the one off your desktop PC when you use the laptop). You might even prefer it, as typing on the mini-keyboard on a typical laptop can be painful. StuRat (talk) 19:53, 16 July 2012 (UTC)[reply]
I've already ordered a PS2-to-USB converter to get my spare keyboard attached, which is a good suggestion -- but I take my laptop everywhere, so I'll need to get it fixed at some point I think.
A third option is to use an on-screen keyboard operated by the mouse, but I'd only suggest that if your typing needs are quite minimal. StuRat (talk) 19:58, 16 July 2012 (UTC)[reply]
Oh, I do too much typing for that :P But I did try it, useful for getting my files off. - Jarry1250 [Deliberation needed] 21:31, 16 July 2012 (UTC)[reply]
(edit conflict × 2) I take it the entire keyboard cannot be easily removed (for cleaning or replacement) from the laptop? (some can). I would suggest getting it looked at ASAP. Skim milk might not be too acidic on it's own, but any residue as it goes 'off' possibly could be and cause corrosion and permanent damage, or just as you are experiencing cause key malfunction. If you have any cleaning agent like freon that would be good to use on the keyboard only, if possible. Googling "milk in laptop keyboard" returned "How to Thoroughly Clean Your Keyboard (Without Breaking Anything)" which covers general external KB cleaning, and "Laptop troubleshooting forum: Milk spilled over laptop keyboard", "milk in keyboard" got "So I spilled milk over my laptop..." and "Getting-milk-out-of-computer-keyboard", with suggestions that might help. (A rather common misfortune it seems!:-( ) Hope these lks help. - 220 of Borg 20:02, 16 July 2012 (UTC) Edited my comments 220 of Borg 20:11, 16 July 2012 (UTC)[reply]
Thanks for the links, I'll have a look. - Jarry1250 [Deliberation needed] 21:31, 16 July 2012 (UTC)[reply]
I don't know how long you might need to wait, but I once dropped a phone in water and it took over 72 hours before it dried out enough to be used. I had tried it at 60-ish hours and it still wasn't working. So I'd say give it a while yet. If the keyboard is completely borked it is possible to replace the keyboard - it's fairly easily done since people sometimes want to change from one locale to another (e.g. moving from Britain to France and changing their keyboard to suit). It's also cheaper than a new laptop at around $50 (based on my 2-year old Dell machine). If you're reasonably handy with a screwdriver you should have no issues, and you'll probably find instructions at http://www.insidemylaptop.com/ or by Googling '[your laptop manufacturer & model] replace keyboard'. Of course, that assumes that no lasting damage has been done to the circuit boards underneath your keyboard. Not sure how you'd know if that was the case. - Cucumber Mike (talk) 20:05, 16 July 2012 (UTC)[reply]
Oooh, I'll have to have a look, thanks. - Jarry1250 [Deliberation needed] 21:31, 16 July 2012 (UTC)[reply]

Okay, thanks all. It looks like it's not difficult to change the keyboard, so I'm going to wait for it to dry out a little more, and if it's still broken I'll buy a replacement keyboard (£24.99). Cheers, - Jarry1250 [Deliberation needed] 21:59, 16 July 2012 (UTC)[reply]

Many laptop manufacturers have a service manual downloadable from their website, though it can be tricky to find. This contains detailed instructions about taking your laptop apart and putting it back together again. Whatever you do, keep track of which screw came out of which hole - they sometimes vary in length to avoid touching internal components - and take your time and don't force anything. The keyboard is usually one of the easier components to replace. You could wash your keyboard (with water) to remove any milk residue, then dry it thoroughly before putting it back in your laptop. Astronaut (talk) 11:21, 17 July 2012 (UTC)[reply]
Okay, so in the end I found a replacement keyboard for £17 online inc. P&P, so I just went ahead and bought it - over time, the old one had stopped its grouping keys, but some keys just plain weren't working, which didn't seem fixable (to me at least). This morning, I fitted it - took 2 minutes and works like a charm. Thanks all for your help! - Jarry1250 [Deliberation needed] 10:16, 21 July 2012 (UTC)[reply]

Computer scientist and subject matter in real life[edit]

In a real life career setting, how much is knowledge is normally required from Computer Scientist about a subject matter different from CS? For example, programs normally for processing language, layout, pictures, movies would need knowledge from language, layout, pictures, movies, AND cs knowledge, how well can you divide the CS work from the subject matter (language, layout, pictures, movies) and still produce good results? OsmanRF34 (talk) 19:25, 16 July 2012 (UTC)[reply]

It is most efficient to have a single person who knows it all. Slightly less efficient is to have a team, where one knows computer science, and the other knows the subject matter, that work together simultaneously. They have to work together closely though, or you can get some rather poor results. Another even less efficient method is to do it by iteration. That is, someone who knows the subject matter comes up with the specs, then the CS people make a program, then they show it to the first group, who then suggests changes, and back and forth several times. StuRat (talk) 19:43, 16 July 2012 (UTC)[reply]
It sounds like you should read about software engineering - the discipline of designing and creating software products, which is a very different discipline from computer science. Nimur (talk) 19:47, 16 July 2012 (UTC)[reply]
OK, software engineering, not CS. My business logic keep being the same. OsmanRF34 (talk) 22:47, 16 July 2012 (UTC)[reply]
When I used to write accounting systems, the fact that I know what A=L+P meant and what Debits and credits were, enabled me to understand exactly what the accountants for whom I was writing the software, really wanted. --TrogWoolley (talk) 19:51, 16 July 2012 (UTC)[reply]

Osman, what you refer to as knowledge about different subject matter is commonly called business logic by those in the software industry. The degree to which you can separate the technical work from the work requiring knowledge of the business logic varies depending on the size and scope of the project. In a sports game like those produced by 2K Sports, there is a team of 10-30 people involved in the day-to-day technical development of the software, whereas there only needs to be roughly three to five people (depending on how you count them) who possess and apply a knowledge of the sport on a regular basis. The rest of the team is able to perform their duties with only a tangential knowledge of the subject matter of the software. In smaller settings, e.g. a database programmer working amongst accountants, that programmer will need to have a thorough knowledge of the business logic. BigNate37(T) 19:59, 16 July 2012 (UTC)[reply]

Sometimes software does not model business procedures. Do you still call it business logic then? It sounds a little bit forced when talking about image processing or computer games, for example. OsmanRF34 (talk) 22:48, 16 July 2012 (UTC)[reply]
Terms like user friendly and ergonomic still apply. That's not as industry specific, though. For example, in pretty much any application users would prefer to use a pull-down list with a small number of items, rather than type in the name of one. This is true whether it's a pull-down for shipping options or to select a weapon for a game. But there could be game-specific knowledge, like wanting access to your healing potions from the panel where you view your health status, or, in the previous example, also having hot keys available to swap weapons, drink potions, etc. Similarly, in image processing software, you might want hot keys to change brightness, etc. StuRat (talk) 03:50, 17 July 2012 (UTC)[reply]
It's still business logic, formally speaking. Although in common parlance we didn't call it as much when I was working in a games studio. It was more like I would say something to the effect of "that's not how baseball works" and then if my uninitiated co-worker decided to question me, we would walk over to the resident expert and ask him a baseball question. But it's still business logic. Of course in that example, business logic also includes things like how to score a multiplayer game when one user disconnects during an online league game, which doesn't involve baseball rules per se. Granted, I'm only going on my personal experiences here, I can't provide you any links to verify that. The article on business logic seems to define it rather narrowly. BigNate37(T) 04:47, 17 July 2012 (UTC)[reply]
Whenever I'm working on any application I've generally considered the information about how a user should experience the application (game or otherwise) to be the "business logic" and the implementation to be system logic. For example, a game needing to allow the player to swing something to hit another player is the business logic, but the way the collision is detected is system logic. Depending on the freedom granted to the developers and the vision of the designers this line can swing very far in either direction. Regarding the actual question, it depends on the project, sometimes you don't need to know a lot, but it often helps. For example I helped develop a calculator used by nuclear reactor operators. I can assure you I don't know what the Xenon Concentration level means :). Chris M. (talk) 19:57, 17 July 2012 (UTC)[reply]
If you mean a career as a software developer (or "software architect", which imho is exactly the same) you would need hardly any in-depth knowledge. The examples you give (pictures, languages) are the extreme exception. My guess is that at most 0.1% of development time in an average software company actually deals with non-computer knowledge like that. An average developer works 99.9% thinking about memory leaks, performance, hackers, database design, version problems, difficult third parties, and making sure buttons move down if you make a form bigger. Let's take a stock exchange as an example. My guess is that there are tens of thousands of programmers in this field, all thinking about messages going around between systems, databases, performance and other computer stuff, and only 100 or so actually designed or wrote the code that would determine if a deal could be closed. Even they wouldn't need to know the implications of a lower interest rate for the value of Google. The other side is that while you don't need to know what the client knows, you do need to know what the client does with his computer. If he is getting used to look at a product, then hitting F3, F8, Enter, Enter, typing the number of product, Enter, just to see the price of it, doing that 40 times per day, not knowing that it would cost half an hour for the developer to show the price immediately, then you do have valuable knowledge and can implement something to make his life easier. Joepnl (talk) 01:18, 20 July 2012 (UTC)[reply]