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

Computing desk
< September 25 << Aug | September | Oct >> September 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.


September 26

edit

GNU Octave: Sum of Iterations in for Loop

edit

  I'm trying to calculate the sum of the iterations in a for loop. Upon entering endfor, the list of answers is displayed. However, when I try to calculate the sum of all answers by entering sum(ans), only the last answer of the last iteration is output, instead of the sum of of all iterations. How do I perform this calculation? And enclosing the entire for loop in sum results in an error. Vickreman.Chettiar 01:04, 26 September 2011 (UTC)[reply]

The MATLAB programming language, which GNU Octave implements, does not have support for an increment operator; so you have to explicitly state the intent. Consider this simple example:
m = 0;            %  -- initialize this value to zero - it will store the sum
for i = [1:10]
   i * 3*sqrt(i); %  -- compute some crazy function
   m = m + ans;   %  -- increment the running sum by adding the value of our function 
end
Even if you're using the function sum() internally in the loop, for some algorithm purpose, you still want to increment a cumulative sum, m. Initialize your sum before the loop; increment it each time you compute a result.
The sum() function is intended to operate on a vector - so sum([1 2 3 4]) is 1 + 2 + 3 + 4... it's not the same as a cumulatively incremented variable. These are conceptually different "sums." You can (sometimes) reformulate your math so that your for-loop can be replaced by a vector-assignment-operation; and then run "sum" on that result. (In other words, populate a vector with the answers from each loop-iteration; and then sum that vector). In MATLAB, this "algorithm trick" will significantly reduce code execution time, because MATLAB contains intelligent technology that exploits vector parallelism on many types of computers (including most modern Intel computers); but GNU Octave lacks such vectorizing capability, so vector-operations are usually serialized as loops anyway. In other words, you gain nothing in Octave when you use sum() instead of an explicit for loop.
Some advanced discussion from the official MathWorks MATLAB blog on in-place data operations, discussing the subtleties of making += work. C programmers who switch to MATLAB find the lack of += very frustrating; suffice to say, there is a very good reason why += does not make sense in the MATLAB programming language (because data types are not primitive, unlike C). Nimur (talk) 17:37, 26 September 2011 (UTC)[reply]

How many UPC bar codes are there?

edit

Does anyone have a reasonably accurate estimate of how many UPC codes (either just UPC-A or EAN-13 or both) in total currently exist? Or is there a website out there that has a count? Is this even possible to find out?

Also, does GS1 US (formerly UCC) keep any such statistics public? Such as how many company identifiers are assigned each year? -- œ 00:30, 26 September 2011 (UTC)[reply]

My wild guess is that we're in to the billions now. Interchangeable|talk to me 20:24, 26 September 2011 (UTC)[reply]

Swreg Problem Please help me

edit

I am using swreg the problem is that Additional backup service price is added on payment page with the price also currency is displaying in usd i want it in GBP. — Preceding unsigned comment added by 125.209.127.86 (talk) 05:14, 26 September 2011 (UTC)[reply]

network connetion sends packets / receives no packets on hp pavillon windows xp

edit

Hi, I'm not expecting anyone to solve this actually because its such a strange problem... 1) The ethernet cable is known good because another computer does connect to the internet. 2) The problem is an HP pavillon a643n computer whose ethernet connection sends packets but receives zero packets. 3) Tried an ethernet card, which installed correctly, network connection shows up in system tray OK, but has the same problem. A few packets are sent, none received. Presumably the packets sent are for establishing a dynamic ip address.

4) Reinstalled Windows XP - same problem. Packets sent, none received. Service PK 2 doesn't help either. 5) turned off firewall. Doesn't help. 6) tried to reinstall ethernet drivers (nvidia something or other) not helping.

Poked around a little using ipconfig / other utilities. Don't really know what I'm doing.

Any ideas? Are there any services I could try to disable on startup?

Thanks — Preceding unsigned comment added by 98.225.77.201 (talk) 06:18, 26 September 2011 (UTC)[reply]

So, internet works on one computer but when you switch the ethernet cable to another computer it doesn't work? I think I know what the problem is. Is the ethernet cable from your computer connected directly to a cable modem? If so, it's possible that the cable modem has locked onto the mac address of the first computers network card and is ignoring any requests coming from a different mac address (the HP pavillon). So, assuming this is the problem, the solution is to power down / unplug the cable modem and wait a while, then when you turn it back on make sure it is connected to the computer you want the internet to work on. It will lock onto the new mac address and accept connections from it. You will need to do this every time you switch the cable from one computer to another, as it will ignore requests from any mac address other than the one it is locked onto. The other solution is to change the mac address of the second computers network card to match the first, so that the cable modem doesn't know you've switched it to a different computer. This is not recommended if your computers share a network as it will cause problems. This program can do this AvrillirvA (talk) 12:20, 26 September 2011 (UTC)[reply]

Hey your right. It IS a cable modem. I didn't know this behavior. Thanks for the tip. I'll try it out. Question though, could I plug in a ethernet hub? Thanks! — Preceding unsigned comment added by 98.225.77.201 (talk) 13:39, 26 September 2011 (UTC)[reply]

An ethernet hub wouldn't help the problem because a hub just retransmits whatever it receives back onto all ports; the cable modem would still lock onto one mac address and only work for that computer. What you need is an ethernet router. A router will have its own mac address which the cable modem can lock onto, so when you put a router between the cable modem and the computer the modem only sees the routers mac address, which won't change when you switch computers. It should also allow both computers to use the internet at the same time. AvrillirvA (talk) 18:47, 26 September 2011 (UTC)[reply]

C programming error trouble

edit

I decided recently to learn the C computer programming language, for some reason, and chose to study the pages on that language at the Wikiversity site. However, I am having trouble now and I have no idea what with. I reached this page: http://en.wikiversity.org/wiki/Data_Types_and_Keywords and copied out the example at the bottom, which worked, then I made a few changes of my own, they worked, but when I went to copy out the original program again, it didn't work the second time. Having given up and then come back to it, it is still doing the same thing, every time I copy it out, it comes up saying 'main must return int' which it did not do originally, but yet the program itself has not changed, so what has gone wrong?

148.197.81.179 (talk) 09:49, 26 September 2011 (UTC)[reply]

According to the C standard, main() must indeed return an int. Some compilers may allow it to be void depending on options that you specify, so you may have compiled it with stricter options the second time. What compiler are you using? (BTW, I'm by no means a C expert, but even I can see that the page you refer to and its neighbours are full of inaccuracies, of which void main() and the misspelling of 'compiler' in the strange comment //keyword is reserved word of c complier// are only two). AndrewWTaylor (talk) 10:55, 26 September 2011 (UTC)[reply]
As to why void main() is a bad thing, we have to look at the calling convention. On x86 the "usual" calling convention is cdecl (but very similar things operate on different architectures). cdecl expects the called function to place its return value in the EAX register. When you compile a C program, the linker wraps it with a little piece of static code (sometimes called the prefix or prelude) that is what's actually executed when the OS creates the process; this prefix sets up a few things in stdlib and then calls main(). Crucially that prefix code essentially reads extern int main(int,char**); result=main(argc,argv); So that causes the compiler to expect a return value from main, so it will generate code that (essentially) populates result from EAX regardless of whether main() ever wrote to that register. If this was C++ the function names would be mangled so the type was explicit in the linker name of main, but being C it isn't, and the compiler and linker will blithely generate the code anyway. So what value will result, above, get, if it's not getting a return value from main()? It gets whatever is in EAX; generally the compiler will produce code that leaves EAX alone for anything but return values (or or will at least save it on the stack and restore it, if it does use that register for intermediate calculations). So consider the following program:
#include <stdio.h>
void main(){
  printf("hello\n");
}
That should compile fine (with warnings and optimisations turned off). When you examine the returns status of the application (which is set by the return value of main() you get whatever EAX was when main() ended; in this case (as in most others) you get whatever the last value returned by any non void function was, in this case printf, which will return 6. Given the convention (at least on unix/posix) that programs that worked okay report a result code of 0 (EXIT_SUCCESS), you'd think that the little program had failed, when in fact it worked fine. -- 2.122.75.122 (talk) 15:32, 26 September 2011 (UTC) (Finlay McWalter, out of the office)[reply]

Note that Wikiversity articles are just some stuff that some person decided to write. They are even less controlled than Wikipedia articles. Looie496 (talk) 15:22, 26 September 2011 (UTC)[reply]

I agree. The quality of Wikiversity content on C programming is far below both the Wikipedia article, C programming language, and the C programming Wikibook. If you're looking for free resources, both of these links will provide better content than Wikiversity. Nonetheless, there's no substitute for a high-quality C programming textbook. Nimur (talk) 16:14, 26 September 2011 (UTC)[reply]
Well, I took out the mysterious "//keyword is reserved word of c complier//" because it didn't make any sense to me. I left in the void main() because it appears to work at least under some architectures. You might be better off replacing that line with int main() and adding a return(0); before the closing "}". Astronaut (talk) 17:38, 26 September 2011 (UTC)[reply]
The main function has to have the return type int, but you don't have to put return 0; at the end. It is added for you if it's not there. (WG14/N1124 section 5.1.2.2.3: "reaching the } that terminates the main function returns a value of 0.") So there's no excuse to use the void return type, even if your compiler supports it. It doesn't even save you a line of code. (This implicit "return 0" rule only applies to main, not to any other function.) -- BenRG (talk) 07:30, 27 September 2011 (UTC)[reply]

Ah yes, Wikibooks, that might well be the one I was trying to work from last time, I wondered why it all seemed to have changed a bit since then. I'll see if that is any better then, shall I, or maybe try our local bookshop, though last I remember, their books cost rather a lot. 148.197.81.179 (talk) 07:25, 27 September 2011 (UTC)[reply]


That seems to work better now. However, there was one other odd thing I am wondering. With that program, it supposedly gives the average of any two numbers, but even though it presents that followed by a decimal point and a string of 0s, it still always rounds the numbers up, anyone know why, and how to stop it? 148.197.81.179 (talk) 12:27, 28 September 2011 (UTC)[reply]

Windows 7 image deployment

edit

I'm trying to work out how to use the Windows 7 equivalent of XP's OEM folder when deploying a system image from a WDS server. It's something to do with an answer file, that much I know, but I've not been able to find any sort of guide or sample structure. Has anyone used an answer file before? Jackacon (talk) 12:04, 26 September 2011 (UTC)[reply]

http://webchat.freenode.net/?nick=Jackacon&channels=##windows ¦ Reisio (talk) 19:34, 26 September 2011 (UTC)[reply]

Excel

edit

I have a table with 1950 lines. Most of the lines doesn't contain any data. I would like to like to print this document but it would be more than a 100 pages long so can I somehow print only the lines that do contain data?

I tried highlighting rows and only print them but that prints everything between two highlighted rows. I tried an option that skips marked cells while printing but it turned out that the marked rows still get printed only blank.

Here is the ODT:

http://www.2shared.com/file/6Mbf0v7C/thing.html — Preceding unsigned comment added by 109.74.50.52 (talk) 14:06, 26 September 2011 (UTC)[reply]

You can sort (under Data ribbon) but you probably don't want to change the order of the lines. I don't know what version of Excel you are using but you can also click "Remove Duplicates" under Data, or even use Filter, Advanced and choose "unique records only". There are probably many other ways of fixing this problem. Sandman30s (talk) 14:12, 26 September 2011 (UTC)[reply]
Hmm and besides this is not optimal if you don't want to remove duplicates. You can select your column, F5, click special, click Blanks, then right click and Delete entire row. Sandman30s (talk) 14:37, 26 September 2011 (UTC)[reply]

I was wrong, I'm using LibreOffice Calc 3.3.2. — Preceding unsigned comment added by 109.74.50.52 (talk) 14:36, 26 September 2011 (UTC)[reply]

Here's one cludgey but workable method:
1. Copy and paste the data into a new table (one that you aren't afraid to modify).
2. Add a new column at the beginning (column A).
3. Make cell A1 equal to "1". Make cell A2 equal to "=A1+1". Copy A2, highlight the rest of the cells below it in column A, and paste. It should now have put in row numbers for all.
4. Select all of column A, then click "copy." Then Paste Special > Values (or whatever the equivalent is in your program — you want to paste just the numeric values, not the equations). This makes it so that if you sort them, they will retain their original values.
5. Now select the column that has the data you want to print. Use the "sort" command to sort them in order of the content, descending. Delete all of the blank rows that are on the top before your content.
6. Select column A again, and sort ascending. You should now have a table that consists only of records that are not blank, in the original order. You can now delete column A, and print.
Just one way to do it. --Mr.98 (talk) 17:14, 26 September 2011 (UTC)[reply]
The easiest way is to use the column filters. Select the row with your column headers and under the Sort and filter button (in Excel 2007/2010) click the filter option. That will add little drop down arrows at the top of each column, which you can use to hide the rows containing blanks. You then switch to the page layout tab and select all that remains in your spreadsheet. In the page setup section on the ribbon, there is the print area button with which you can set the print area to be the selected data (but without the hidden rows). You then print as normal, selecting your margins etc to make it look OK on paper. The same features were all available on older versions of Excel, but are just buried somewhere in the menus and I can't remember exactly where. Astronaut (talk) 17:26, 26 September 2011 (UTC)[reply]
Pretty much the same trick is also possible in LibreOffice Calc: select a column, select the menu entry Data->Filter->Autofilter, then click the 'not empty' option in the drop-down menu that appeared at the top of the column. The rows with an empty cell in the selected column are now hidden, and they will not appear when you print the file. (I tested this on LibreOffice 3.3.3, YMMV on older versions.) 188.117.30.209 (talk) 15:37, 27 September 2011 (UTC)[reply]
Oops, just spotted that you said you were using Libre Office. Astronaut (talk) 17:27, 26 September 2011 (UTC)[reply]

Telephone call from "Microsoft support" - Scam or real?

edit

Hi, I'm a refdesk regular using a throwaway-account for (paranoid?) reasons that will be apparent when I explain the problem. I just received a phone call from a person (English-speaking, Indian accent) who claimed to be from Microsoft Support, and claimed that my PC may be uploading or downloading malware or other unwanted content, and that he would guide me through the steps to identify and solve the problem, and that I was completely innocent, it was (might be? - he was vague) doing so, and I wouldn't be aware of it.

He told me to type ASSOC from the command prompt, and correctly identified the string "CLSID\{888DCA60-FC0A-11CF-8F0F-00C04FD7D062}". I denied having found the string he quoted, and told him (correctly) that we have about eight PCs in the house, the owners of which are not home, and I wanted a number to call back when I had had the opportunity to check the other PCs. He didn't give me a number, but identified himself as "David Johnson", Microsoft ID MS400922 (no relevant ghits), and promised to call me back in two hours. The CLSID corresponds to something called .ZFSendToTarget. So what is this - Scam or real. Sorry for the sockpuppetry, I didn't want to publish my IP or my username if this were a scammer. --Throwaway-account-001 (talk) 14:34, 26 September 2011 (UTC)[reply]

Straight forward and well-known scam. Just hang up in future. --Cameron Scott (talk) 14:36, 26 September 2011 (UTC)[reply]

Thanks, found that one myself too, after having posted the above. Phoned the police, who asked me play dumb if the scammer calls back, to see what he was up to, and to contact them again. --Throwaway-account-001 (talk) 14:55, 26 September 2011 (UTC)[reply]
If it makes you feel any better, CLSID\{888DCA60-FC0A-11CF-8F0F-00C04FD7D062} is perfectly benign, a normal part of Windows. It is related to the "menu shortcut" that lets you zip a file by right-clicking on it. It should be present on any Windows computer; it is described in more detail in this Microsoft Support knowledge-base article. Nimur (talk) 16:40, 26 September 2011 (UTC)[reply]
Thanks! The scammer actually called back, and we had some 20 minutes of family entertainment. I pretended the PC was one flight of stairs up from the phone, and acted really dense. I had my daughter speaking with the scammer, and yelling the instructions to me. I was instructed to open Eventvwr in the Run dialog and look for red signs and warnings. I translated all items on the screen (which already were in my native language) into ridiculous synonyms in my native language, and yelled to my daughter if that was what the scammer meant. I said there were no colored icons, and revealed after a while that I had a black-and-white monitor because I have migraine (neither of which I don't). Amazingly, the person didn't understand that we were wasting his time. When I revealed that there were a couple of darkish icons with a white cross, with recent time stamps, we were told that whatever we did, we mustn't click on these, because someone was about to take over the computer. We were instructed to enter a url (www-dot-support-dot-me) in the Run dialog, to get to Microsoft's support page. I entered the url in google instead, and found lots of references to scams. Since I didn't feel like visiting the site, I took the phone, told him what I had found, and said I was certain that he was not who he claimed to be, and was trying to cheat us. He vigourosly denied this, but hung up while in the middle of a sentence. --Throwaway-account-001 (talk) 17:24, 26 September 2011 (UTC)[reply]
Fascinating. Was the number traceable? Will there be any follow-up by the authorities? I can imagine the damage someone like that would do if they called my grandmother... *shudders* The Masked Booby (talk) 02:32, 27 September 2011 (UTC)[reply]
No, the number was not tracable, and the police made it clear that they had no possibility of following it up. They were, however, very interested in the details of the call, like the name the person was using, the commands they asked me to enter, and the website I was asked to visit. Presumably as background when they are contacted by future victims who fall for the scam. --Throwaway-account-001 (talk) 20:25, 27 September 2011 (UTC)[reply]
I got this call too: https://plus.google.com/118210384829172301796/posts/jjWqV2wZvYr 69.196.185.243 (talk) 03:06, 27 September 2011 (UTC)[reply]
Microsoft will never, ever call you. (How would they know your number?) I get these sorts of calls all the time. Unless the caller can ask for me by name, I just hang up.--Shantavira|feed me 07:53, 27 September 2011 (UTC)[reply]
Asking for the callee by name isn't any indication of legitimacy; I have had at least half a dozen of these types of calls (in Australia) over the last year or so, usually asking for me by name. Presumably they were getting my name and number from the phone book or similar. Depending on my mood and what I'm doing at the time, I'll either hang up on them or string them along. The longest I've had one call going was about 30 minutes before he realised that he was wasting his time. Mitch Ames (talk) 10:48, 27 September 2011 (UTC)[reply]
I have had a few calls like this and have always hung up. Yesterday, for some reason, having waited for someone from checkmypconline to say why he had rung, I told him he was trying to defraud me, he was very wicked, wasn't he ashamed and so on. I demanded his name and home address so the police could investigate. I didn't lose my temper or swear at him but I must have been barking down the phone. The weird thing was he kept going, trying to persuade me to go to my computer as if nothing was unfavourable about my response. He was always polite, the lowest ebb was when he asked if he could terminate my Microsoft licence. Eventually after 5 or 10 minutes I put the phone down. He hasn't rung back (yet). I have never in my life spoken to anyone like this before and decided afterwards I had rather enjoyed the experience! Thincat (talk) 12:20, 27 September 2011 (UTC)[reply]
This caller was very polite too. The second call started by the caller asking me to sit in front of the computer screen. I said OK, went upstairs and finished my pizza, picked up the phone and said I had been looking at the screen for a while, but nothing had happened. The only sigh of frustration ("Oh Jesus"), came when I said the computer was upstairs, the phone was downstairs, and I had no portable handset. --Throwaway-account-001 (talk) 20:25, 27 September 2011 (UTC)[reply]

Font Wanted

edit

I'm looking for a font that has a circular a and a curved g (not with an oval at the bottom). I don't care too much about the weight, but I want it to be legible on my computer screen (this one doesn't work for some reason). I also write in French frequently, so I need some good diacritics, and support for Esperanto would be nice but is not mandatory. The closest I've found is this font; it's just about what I want but it doesn't support Esperanto and its c with a cedilla stinks. (I prefer something like the standard 5 shape, not a comma.) Can anyone help me in my search? Interchangeable|talk to me 20:23, 26 September 2011 (UTC)[reply]

ITC Avant Garde? I don't know if it supports Esperanto but it is a pretty developed font family. It's almost surely 90% of the original inspiration behind those two other fonts you linked to. --Mr.98 (talk) 20:54, 26 September 2011 (UTC)[reply]
No, that doesn't really work. I forgot one other criterion: the font has to be free. (I don't have much money to waste on things like that!) Century Gothic fits all of my criteria, but there's something about its general look that I don't like. Interchangeable|talk to me 21:14, 26 September 2011 (UTC)[reply]
You're going to have a very hard time finding truly free fonts that can both look good to your specific requirements AND have great diacritic, other language coverage. Usually to get both you have to buy a font; most free fonts either will look exactly like the expensive fonts but have a lot less features, or will have lots of features but look nothing like any other fonts. There a lots of free knockoffs of these fonts (owing to a quirk of US copyright law that says that only the exact digital files, not the forms of the fonts themselves, are copyrighted), so finding a "legitimate" font might be a good start, and then looking for knockoffs with the support you want from that.
Other fonts similar to Avant Garde and Century Gothic are Futura and Twentieth Century ([1]). --Mr.98 (talk) 01:16, 27 September 2011 (UTC)[reply]
I like both of those, but where can I get them free? Interchangeable|talk to me 22:48, 27 September 2011 (UTC)[reply]
Never mind - I just found one I love, and it's absolutely free! (Well, not from its designers, anyway...) It's called "Geometric Slab Serif Medium BT". Here's a [link removed, see one below] in case anyone's interested. Interchangeable|talk to me 23:05, 27 September 2011 (UTC)[reply]
Which is a knock-off of Lubalin but if it works for you, it works for you. --Mr.98 (talk) 01:27, 28 September 2011 (UTC)[reply]
Here's an updated link. The previous one works on-screen, but it won't actually print in that font; it will print as poorly-kerned Times New Roman (that's what happened on my computer anyway). Interchangeable|talk to me 14:39, 28 September 2011 (UTC)[reply]

WD 31600

edit

WD31600 put in usb adaptor and plugged into computer. Computer does not show drive in My computer although it apears in device manager. What could be wrong?--78.148.142.217 (talk) 20:41, 26 September 2011 (UTC)[reply]

You might need to install a driver. You might need to remove confused drivers and let them automatically reinstall. Also it's possible the drive is kaputt. ¦ Reisio (talk) 19:02, 27 September 2011 (UTC)[reply]
Are you referring to a 1.6GB hard drive? If so I'd recommend you try plugging this in to the native PATA ports of a computer or a PCI/PCI-express card. From my limited experience, USB adapters often don't like such old drives, it may be something to do with the lack of UDMA but I'm not sure. I presume you remembered to attach power to the drive. Edit: Forgot to mention, for such an old drive do check the jumpers. Unlike with more modern drives, you may not be able to get the drive to work properly by itself when it is set as master or slave but it may need to be set as single. Nil Einne (talk) 09:58, 29 September 2011 (UTC)[reply]

How do I get Dell Webcam's console to show the special effects again, please?

edit

Hello, after the last system reinstall on my Dell Inspiron 1720, I managed to get webcam functionality again but the tab is missing that lets me show special effects.

The special effects were "Werewolf," where a werewolf face superimposes over mine. Then there were others that give lighting effects, water, mud effects, that of a napping kitty on the bottom of the screen (that wakes if I "pet" it), a ufo spaceship, a superhero flying in a cape that shows my face where his face would be, a ram helmet, and etc.

I would love to have those features back on my "Dell Webcam Console." How do I restore that? Thanks. --70.179.163.168 (talk) 21:35, 26 September 2011 (UTC)[reply]

It sounds to me as if you have reinstalled the webcam using generic drivers supplied by the operating system, and need to find Dell's installation CD (or whatever the laptop or webcam came with) to install the drivers that give you a fancy control panel and special effects. You could perhaps search Dell's site for your laptop or webcam's drivers, or perhaps somebody nice will do this for you. (I am too busy to be nice right now, sorry.) 81.131.53.43 (talk) 18:38, 27 September 2011 (UTC)[reply]
edit

I know this will be extremely easy to answer for some people who know Excel 2010 very well. Thing is, I'm good with PowerPoint 2010, and Word 2010 , but terrible with Excel. Question is, When I click a Hyperlink in Excel (2010), it brings this message "This operation has been cancelled due to restrictions in effect on this computer. Please contact your system administrator" Problem is, The current account I'm using is the ONLY account on this computer. Does anyone know what's going on here? CHRISTIANgamer97 (talk) 22:27, 26 September 2011 (UTC)[reply]

I think you need to find out what operation is called by the hyperlink, then give your account permission co carry out this operation (assuming that you have admin rights). The file called may be read-only, or your account may have only read permission. Dbfirs 23:06, 26 September 2011 (UTC)[reply]