Wikipedia:Reference desk/Archives/Computing/2008 January 3

From Wikipedia, the free encyclopedia

Computing desk
< January 2 << Dec | January | Feb >> January 4 >
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.


Contents


[edit] January 3

[edit] php mysql not talking to each other

i've just been setting up a php/mysql/apache combo and been having some trouble getting php and mysql to talk, when i try to run a php page with mysql access i just get a blank page lodad up (ie creating a user login in page when clicking submit instead of displaying the confirmation page its just blank)at first i thought i had bad code but then i used this basic test code and that gave the saem result (blank page):

<? $mysqli = new mysqli("localhost", "user", "password", "database");

if(mysqli_connect_errno()) { printf("Connect fauiled: %s\n", mysqli_connect_error()); exit(); }else{ printf("host information: %s\n", mysqli_get_host_info($mysqli)); } ?>

(of course changing user/password/database to the relavent details)

i decommented the mysql extension in php.ini, was there anything else i need to do?--Colsmeghead (talk) 00:03, 3 January 2008 (UTC)

Well, changing your error reporting level will let you know what is going on (e.g. it will give an error message and not just a blank screen). Try adding error_reporting(E_ALL); at the top and see what it tells you. --24.147.86.187 (talk) 00:07, 3 January 2008 (UTC)
There are two mysql libraries for mySQL: mysql and mysqli you need to make sure that you've also uncommented the mysqli compilation option (you don't necessarily need the mysql option, although older code may be written to use it). Donald Hosek (talk) 00:34, 3 January 2008 (UTC)
Also check your apache error logs, anything that goes wrong in PHP will be there is well. --antilivedT | C | G 05:46, 3 January 2008 (UTC)
I'd second changing the error reporting level. I think PHP is bottling out with a fatal function not defined error before it can reach the printf. It's likely that the mysqli extension isn't even loaded, if calling any function fails. First try:
<?php print_r(get_loaded_extensions()); ?>
to check that it's loaded. • Anakin (contribscomplaints) 13:23, 3 January 2008 (UTC)

hmm i added extension=php_mysqli.dll (it wasnt present as a comment),loaded_extensions only displays mysql/mysqli if i dont include error_reporting in php.ini, when i do include error_reporting i get parse errors from apache about the line with error_reporting on, and the page to load the mysqli info, displays this: Fatal error: Class 'mysqli' not found in G:\Server\Apache Group\Apache2\htdocs\test.php on line 2 could this be maybe as i have error_reporting = E_ALL already in php.ini?--Colsmeghead (talk) 14:40, 3 January 2008 (UTC)

This is the infamous step in getting a WAMP set up (not as difficult in linux). Basically all I can tell you is just to "finagle it".. every time I try to set one up there's a totally different problem.. try putting the mysql bin directory in the PATH, try putting libmysql.dll in a directory that's in the PATH, copy mysqli.dll to every concievable place on your hard drive.. a brute force attack of fixes usually does the trick :) Also make sure that you installed mysql properly- the installer is tricksy and you can't just select what sounds good.. you actually have to know what you're doing --ffroth 16:15, 3 January 2008 (UTC)

well thanks for your help this could take awhile--Colsmeghead (talk) 13:24, 4 January 2008 (UTC)

[edit] I have trouble with a Web site. Please help.

I have trouble with picking a password with this site, http://forums.zonealarm.org/zonelabs/ . I wantr to register so I can get tech support from them. It too hard to make a password and to register. I enter my desired username and clicked "Register". I not sure my desired username is taken because the username is never use before and I clicked "Register" will take that name away from me. What should I do? Note: Asked by this asker at Yahoo! Answers here(deleted) however, no answers yet.

So are you the OP of the question? Do you want to know that if you have actually registered with your desired username? A simple log in using your desired username and password would suffice in checking that, and if it doesn't work you can always create another account, with a more obscure (or more trailing numbers) username. PS: I've removed the ref tags and put it as an ordinary link instead as I don't think it's the appropriate way to use ref tags. --antilivedT | C | G 05:45, 3 January 2008 (UTC)

[edit] Bad Sectors

Question inspired question: When the filesystem (well anything remotely good anyway) detects a bad sector on the hard drive it masks it and use somewhere else instead. I've never had so much bad sectors that it's noticeable so I'm wondering does this reduce the effective size of the partition? Or does it use some other factory-set reserved sectors? If it's the latter how much reserves are there, and is there any way you can use it in normal situations? --antilivedT | C | G 05:54, 3 January 2008 (UTC)

I'm not 100% on this, but my best educated guess is that the size of the partition would be reduced after the marking of bad sectors. It may only be a noticeable reduction if there is extensive damage though. Each sector usually only represents 512k of data, so if you have say 10 bad sectors, are you really gonna notice the 5 meg loss on your 100 or so gb hard drive? Equazcion /C 06:02, 3 Jan 2008 (UTC)
The usual definition of disk sector is 512 bytes, not 512 kilobytes. --tcsetattr (talk / contribs) 10:07, 3 January 2008 (UTC)
That's correct, ma' bad. Equazcion /C 10:26, 3 Jan 2008 (UTC)
In times of yore, when men were brave and drives were dumb, the drive just reported everything that happened to the OS. So when the OS detected a bad sector it just marked it as bad and worked around it (making the sector unusable, and thus the partition effectively smaller). These days drive controllers are very smart, and take care of things themselves. They do indeed keep a bunch of spare sectors free, in a list they don't advertise. When they detect a sector going bad they remap that sector invisibly, using one of the spare blocks. The most noticable effect of this is that, because the heads have to perform a seek when accessing the remapped sector, the disk gets slower (a formerly linear sequence of LBAs now has a seek and a return seek in it). Manufacturers don't advertise how big this set is, but it's probably about 1% of the surface. For any shop that's remotely mission-critical the policy is generally "if you see one error" (as reported by the SCSI diagnostics or SMART) chuck the drive ASAP". I know of no way to access those blocks normally; there aren't enough to make a difference for you, and using them obviates their purpose. -- Finlay McWalter | Talk 12:03, 3 January 2008 (UTC)
That's interesting info, Finlay, I didn't know this. Thanks :) Equazcion /C 12:17, 3 Jan 2008 (UTC)
In the even older days back when 10 meg HD was huge and expensive, bad sectors were directly reported to the user. No efforts were made to hide them at all. In those days, HD are expected to have bad sectors. All HD came with a sheet of paper from manufacturer which lists bad sectors found on the HD. Usually after formatting, some of those bad sectors is reported as good, you then had to manually mark those as bad. NYCDA (talk) 17:55, 3 January 2008 (UTC)
Ahhh... memories of using DEBUG (DOS Command). --— Gadget850 (Ed) talk - 22:12, 3 January 2008 (UTC)

Bad_sector indicates that in modern hardware, "A modern hard drive comes with many spare sectors. When a sector is found to be bad by the firmware of a disk controller, the disk controller remaps the logical sector to a different physical sector. In the normal operation of a hard drive, the detection and remapping of bad sectors should take place in a manner transparent to the rest of the system. When the operating system begins to detect bad sectors, in most cases, it means that the surface of the hard disk is failing and the drive has run out of spare sectors with which to remap the failed sector." —Random832 16:06, 4 January 2008 (UTC)

[edit] Website down

My websites went down. Host says "All websites were down because of a malicious attack on the nameservers that perform the look up on the domain names whenever anybody visits the website or sends an email." How is this possible? - CarbonLifeForm (talk) 12:07, 3 January 2008 (UTC)

They're talking about DNS servers. In short, all websites actually have numbers assigned to them, called IP addresses, rather than names. For example, in order to be able to type Wikipedia.com and see the Wikipedia website, your computer first has to look up which number corresponds to en.wikipedia.org (that number is right now 66.230.200.100). It looks this up on a DNS server, which is short for "Domain Name Server". If that server is attacked, it means that people's computers can't look up the names of your websites to find its corresponding number, so people generally wouldn't be able to access your website.
They could do it if they typed in that number directly instead of the name (try typing 66.230.200.100 into your browser to see Wikipedia) -- but most people aren't going to know how to do that or know what the number is, and that method wouldn't work for email. (If you want to try Equazcion /C 12:22, 3 Jan 2008 (UTC)
In many cases (including Wikipedia) typing the IP address won't work. Servers can be configured to support multiple sites on a single IP address, using the domain name (e.g. en.wikipedia.org) as passed in by one of the HTTP headers to determine which one is required. AndrewWTaylor (talk) 13:01, 3 January 2008 (UTC)
To make an analogy, imagine if nobody remembers any phone numbers whatsoever. People pick up the phone and say who they want to speak to, and then the operators connect you to a number. Now imagine if someone was ambushing the telephone operators. Even if there's nothing wrong with the telephones or the people you want to call, your calls might not go through... --Kjoonlee 03:40, 5 January 2008 (UTC)

[edit] Backup software

I just stumbled on Cobian, an open source program which seems to fit all my requirements - ie. to do lots of scheduled file copying between drives across a Windows network. Has anyone used it and able to comment on reliability/stability or is there a similarly featured alternative? —Moondyne 12:34, 3 January 2008 (UTC)

I wouldn't use it, primarily because it's written in Delphi which is Windows-only, and there's a lot less open source Delphi developers than say, C developers. Since the original developer is not willing to continue developing it, the future of that software looks quite bleak. I really like rdiff-backup, which is based on the proven rsync utility, and it stores incrementally so it doesn't take up as much space. --antilivedT | C | G 05:45, 4 January 2008 (UTC)

[edit] Shipping hardware internationally

Hi. Does anyone know what limitations exists on shipping computer hardware internationally, and more importantly, why they exist and can we hope for them to be removed in the forseeable future? Thanks. -- Meni Rosenfeld (talk) 17:11, 3 January 2008 (UTC)

There are restrictions on international transport of machinery that may be used for encryption/decryption. Computers normally fall outside of those restrictions - but there have been cases in the past of enforcement of such laws on the transport of computers. What you are really discussing is tariffs on computer hardware. A tariff is a tax on the import or export of an item with the sole purpose of increasing the cost of the item either inside or outside of the country. You tariff exports when you don't want them exported. You tariff imports when you don't want them imported. Tariffs are not going away anytime soon. They are used to protect the national economy from the international market. For example, assume you run a country. You have a good relationship with Japan and import video cards from them. The retail cost is $100 per card. You don't tariff the cards because you like them. Then, China comes up new cards that are the same quality, but only cost $20 per card. If you allow China to import to your country, Japan will lose the market and blame you (not China) for the problem. So, to even the market, you tariff each Chinese card with an extra $60, making the retail cost $80 when it hits the shelves. You explain to Japan that they have to cut their cost by $20 a card to compete. Everyone is happy and you are making a lot of money in tariffs. Woohoo! -- kainaw 17:47, 3 January 2008 (UTC)
Maybe. The problem I have is that retailers such as Amazon, Newegg or any others won't ship orders to my country. When asked, Amazon had this to say:
At this time, due to warranty restrictions and import/export laws, we can ship only books, music, videos, and DVDs to most destinations outside the U.S. We can also ship some software, electronics accessories, kitchen and housewares, and hand tools to addresses in France, Germany, Ireland, and the United Kingdom.
If the problem is tariffs, I don't understand why I shouldn't be able to order an item and pay the tariff to whoever is collecting it. -- Meni Rosenfeld (talk) 18:02, 3 January 2008 (UTC)
PS. <sarcasm> Yep, My country is happy, Japan is happy, everyone is happy except for actual people, who have to pay for a card four times its worth. Capitalism at its finest. </sarcasm> -- Meni Rosenfeld (talk) 18:08, 3 January 2008 (UTC)
Simple workaround: if you've got friends over there, ask them to purchase it for you and airmail it to you, reimburse them for their money and you've got your hardware. --Ouro (blah blah) 18:09, 3 January 2008 (UTC)
That's a big if. Anyway, are you sure that there aren't any laws, regulations, restrictions, or any such nonsense preventing those friends from airmailing this kind of items? -- Meni Rosenfeld (talk) 18:13, 3 January 2008 (UTC)
Foreign shipping involves declaring what you're shipping, so if your friends are honest about what's getting shipped, then your country will see what you got and charge you the tariff. If everyone's honest then no one would be breaking any law -- you'd just have to pay that tariff upon receipt. At least, to my knowledge. Equazcion /C 18:17, 3 Jan 2008 (UTC)
I believe the reason is that there is no reliable system in place to make sure the tariffs get paid. The only way you can do it is if you have someone purchase the item and bring it to you -- then you can declare the item and pay the tariff. But if you buy from the store directly, the only system in place is one that charges local taxes. A system for charging foreign tariffs (and then making sure those payments actually reach the country where the item was shipped) would be too complicated to implement, and too risky, as they would have to keep track of foreign laws and tariff amounts, etc -- so stores just don't do it. Equazcion /C 18:11, 3 Jan 2008 (UTC)
Yeah, I guess it'd work if everyone's honest and declares what they're shipping and all. Simpler than buying from the store directly, if they won't mail it then they won't - the e-mails you'd send them would be probably answered like this over and over again. BTW - I've sent a lot of stuff back and forth between Poland and continental Europe and never had to declare what I was shipping. --Ouro (blah blah) 18:21, 3 January 2008 (UTC)
It is also possible that Amazon is not telling the truth about import/export laws. I ship items internationally. There are some countries that I will not, under any circumstances, ship to because there is about a 99% chance that I will not get paid. It isn't just that the purchaser is dishonest. It could be that their country reverts the payments for whatever reason. It could be that their postal system confiscates anything that the postal workers decide that they want to have. It may be that there is an ongoing military conflict that causes all contracts (including payment and delivery contracts) to be easily voidable. Whatever the reason, there are some countries that practically guarantee that I won't get my money, so I won't ship there. -- kainaw 18:32, 3 January 2008 (UTC)
Say, don't places like this ask for money upfront? That they first deduct it from your credit card, account or what not, or let you make the transfer, and ship it only when the money had reached their account? That's how we usually do it over here. And, with friends, there is no such risk - if they are true friends that is :) --Ouro (blah blah) 18:47, 3 January 2008 (UTC)
I don't know if that's the problem. I've been happily shopping at Amazon for books, dvds etc. for many years, and they have never had any problems receiving my money (at least, they didn't say anything about it). I don't understand why computer hardware should be any different in that respect. -- Meni Rosenfeld (talk) 18:50, 3 January 2008 (UTC)
I'm stumped here. Mayhaps they're expecting you to buy locally so that the manufacturer or whoever gets their money properly? Use their distribution network, not think up your own ways. It's logical. I'm in the process now of procuring a DSLR from Japan at 2/3 the price I'd have to pay in Poland. --Ouro (blah blah) 18:53, 3 January 2008 (UTC)
I don't really know the answer, but if I'm allowed to speculate, I'd say the merchants probably feel that they are not equipped to deal with regulations that restrict the export of military and dual-use technologies. They may feel that they don't have the expertise to reliably tell whether a particular electronics product is subject to export control, and to get an export license if one is required, and they don't want to risk criminal consequences. --71.162.249.245 (talk) 03:20, 4 January 2008 (UTC)
In UK, you have to use O2 in order to use/buy/rent an Apple iPhone. But there is no reason not to buy one in USA, have it shipped to UK, put your Vodaphone sim card in it and ignore O2's restrictions which are merely a contractual deal between them and the phone manufacturers. What country do you want what shipped to? - CarbonLifeForm (talk) 17:26, 4 January 2008 (UTC)
Computer hardware, to Israel. But never mind, I figured by now the whole thing is a big mess and not worth the trouble. -- Meni Rosenfeld (talk) 17:33, 4 January 2008 (UTC)

[edit] Get rid of SELinux notifications?

The SELinux firewall on my Fedora 8 Linux system recently decided to give me about one notification every second about something called an "AVC denial". How can I get rid of this without disabling the firewall? JIP | Talk 19:28, 3 January 2008 (UTC)

SELinux is not the firewall. It is a separate security tool. You could see the SELinux FAQ for setting it to allow whatever it is denying. Or, you could disable it. Usually, you go to /etc/selinux/config and set it to permissive instead of enforcing and reboot. -- kainaw 01:08, 5 January 2008 (UTC)

[edit] Writing my own Linux filesystem?

How would I go about writing my own Linux filesystem? Is there, for example, some API I need to implement? JIP | Talk 19:29, 3 January 2008 (UTC)

The easiest thing to do is to implement one in userspace using FUSE; its API is quite simple. If you absolutely must have speed, and are willing to suffer the comparative difficulties of debugging kernelspace code, the Linux Virtual file system, which is documented here. -- Finlay McWalter | Talk 19:49, 3 January 2008 (UTC)

[edit] Can ordinary consumer wirleless routers be used to bridge two wired LANs?

Can ordinary, consumer wireless routers be used to bridge two wired LANs? Say you have a small office in which a wireless router provides wired and wireless internet access to several computers. Can a second wireless router be used to provide wired access to computers in another room without running cables? If that's possible, how should the routers be configured? --71.162.249.245 (talk) 20:12, 3 January 2008 (UTC)

This was asked awhile ago. Basically it comes down to no. It's technically possible with certain routers, but it's extraordinarily difficult to set up and networking is ridiculously complex even if you do get it set up. --ffroth 21:28, 3 January 2008 (UTC)
I can't see how it would be complex- it's just bridging, which is about the simplest thing you can do with a network. But, yeah, I doubt whether typical consumer gear would allow this. There certainly are devices which do, though. One of our networking guys has a setup much like this for his home internet connection- his radio is bridging to an access point on a tower a couple miles away. There are specialized directional radios like this available for this purpose. Friday (talk) 22:35, 3 January 2008 (UTC)
Because exactly like you said- consumer gear can't handle it. How are you going to reach a computer in the "outside" (still inside the internet gateway) network? --f f r o t h 01:51, 4 January 2008 (UTC)
Conceptually it's not that hard. You can have two subnets with different network IDs. At the media access layer level, the second router will be acting as a wireless client of the first router (which interfaces with the ISP on one side). At the IP layer level, the second router will be the gateway between the two subnets. You can add a static route to each of the two routers so that they know about the other subnet. The first router will be the default gateway for the second router for access to the outside world. I asked the original question because I wasn't sure whether consumer wireless routers are designed to support this configuration. --71.162.249.245 (talk) 03:05, 4 January 2008 (UTC)
If you are fortunate enough to have a WRT54G series router, for which Linksys released firmware source code to satisfy the GNU GPL license, I believe that there is an alternative firmware which makes setting up a network bridge rather simple. You could download a copy of the Alchemy/Sveasoft firmware or the DD-WRT firmware (see http://www.dd-wrt.com/wiki/index.php/Wireless_Bridge). Note that despite Sveasoft's claims, other sites distribute the Sveasoft binaries and source code legally, due to the terms of the GNU GPL license. I cannot personally recommend either method, as I have not implemented a network bridge. I also note that flashing your router with any alternative firmware is unsupported and may result in "bricking" your device. Best of luck, --Iamunknown 07:02, 4 January 2008 (UTC)
It certainly is possible, as one of my friends is doing exactly that, except it's a nested NAT instead of bridging (IIRC), with the WRT54G. If not, just buy one of those ethernet/WiFi adapters and plug it into your switch and you should be all set. --antilivedT | C | G 07:09, 4 January 2008 (UTC)
This worked for me, I think I was told it couldn't be done practically either, but managed to figure it out BTW I am using 2 WRT54G's I had laying around.(I was the one that had asked this question about 2 weeks prior.) -Dureo (talk) 15:55, 4 January 2008 (UTC)

[edit] Wii

Is it possible to connect two Wii consoles to have more than four players? -Wiki131wiki (talk) 22:19, 3 January 2008 (UTC)

I don't believe so. It's theoretically possible to do it with a Wifi lan, but the game would have to support it. I don't know of any games that would allow 8 players on two Wiis. Sorry. APL (talk) 23:52, 3 January 2008 (UTC)

[edit] gnuplot 4.2 step function plotting

Hi, does anyone know how to plot a step function in gnuplot without vertical segments to the steps? i.e. then it would be a true function?

This is possible with the "with steps" parameter:

This is what I want:

Thank you for your help. --Rajah (talk) 22:35, 3 January 2008 (UTC)

Not directly, but you can get the same effect by massaging the data a little and using "xerrorbars". If your data looks like:
Xn    Yn
Xn+1  Yn+1
Xn+2  Yn+2
just change it to:
Xn    Yn    Xn    Xn+1
Xn+1  Yn+1  Xn+1  Xn+2
Xn+2  Yn+2  Xn+2  Xn+2
For example:
1      2
3      5
5      6.1
6.5    7.4
10.0   11.0
becomes:
1    2     1    3
3    5     3    5
5    6.1   5    6.5
6.5  7.4   6.5  10
10   11.0  10   10
and use the following gnuplot commands:
unset bars                                    
plot [0:12][0:13] "steps.dat" with xerrorbars
That will give you the graph you specified. --Sean 16:15, 4 January 2008 (UTC)
Thanks! I'll try that. --Rajah (talk) 16:23, 4 January 2008 (UTC)
OK, great! FYI, the following bit of Perl golf will do the above-specified data processing:
perl -e 'print reverse map{split;$l=$_[0]if!$f++;$s=$l;$l=$_[0];"@_ $_[0] $s\n"}reverse<>' steps.dat
 :) --Sean 16:37, 4 January 2008 (UTC)