Jump to content

Wikipedia:Reference desk/Archives/Computing/2008 November 1

From Wikipedia, the free encyclopedia
Computing desk
< October 31 << Oct | November | Dec >> November 2 >
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.


November 1

[edit]

php - where do i start?

[edit]

I have read (lightly) the W3 tutorial for PHP; I know some basic code, but don't understand how to set it up. I am hosting my website using (site), if that makes any difference. I have a MySQL database already set up ( .../_1 ), I have something called "PHP MyAdmin," which I am assuming has something to do with PHP. Help? flaminglawyerc 05:36, 1 November 2008 (UTC)[reply]

The PHPMyAdmin is a control panel for your MySQL database, written in PHP. I don't know much about the language, but maybe if you read some more tutorials and examples, then that would work for you... And another thing - don't rush with a big project in PHP that you probably won't finish; start with some guestbooks and other simple codes, then proceed with the more difficult ones once you learn more about it. Blake Gripling (talk) 07:14, 1 November 2008 (UTC)[reply]
You probably don't need to do anything to set it up - your hosting providers have already done that for you. Just create a file in Notepad with your code in, save it with a .php extension, and upload it to your server. Try saving this:
<?php echo "Hello world!" ?>
as helloworld.php and uploading it. When you visit yourdomain/helloworld.php you should see the words "Hello world!" and nothing else. — Matt Eason (Talk &#149; Contribs) 11:58, 1 November 2008 (UTC)[reply]
Also, try:
<?php phpinfo(); ?>
Save that, upload it, and visit it. You'll see a lot of info about the php install on your server. -- kainaw 12:30, 1 November 2008 (UTC)[reply]
Another thing... on the W3 tutorial, it has stuff about dates and stuff. Do I have to do something to let mySQL know that the date is Fri, or does it come with dates/times already programmed? flaminglawyerc 17:29, 2 November 2008 (UTC)[reply]
MySQL is just a database. You just store data in it and manipulate data in it. If you have a date in the database, like 11-02-2008, stored as a string, then you can use PHP to figure out what day of the week this is. My recommendation with PHP is to download a copy of the manual to your hard drive and use the function lookups religiously. They usually give examples that are pretty clear.
My other recommendation is that if you are just wanting to play around and learn PHP/MySQL, don't do it with a remote server, as that can be a pain. Install it locally (see WAMP)—it'll save you a lot of time in just playing with things. --98.217.8.46 (talk) 18:48, 2 November 2008 (UTC)[reply]

How do I create-protect titles in my wiki?

[edit]

OK, so I run a wiki, and there are cases of spammers posting Viagra and porn crap in my site. They usually make their spam posts under the title wiki/index.php or index.php, and I want to lock them to prevent editing. The problem is that my MediaWiki install doesn't allow such an operation, even though I seem to have the proper plugins/extensions. Any suggestions? Blake Gripling (talk) 07:12, 1 November 2008 (UTC)[reply]

Don't run mediawiki, so can't give any first-hand information, but look at this guide on combatting spam on MediaWiki installation, including instructions for adding a captcha. 83.252.187.213 (talk) 12:41, 1 November 2008 (UTC)[reply]
MediaWiki is customisable in a bazillion ways - most of which Wikipedia doesn't use - but you can.
What I do is this:
  • On your server, look in the 'wiki' directory (or wherever you installed MediaWiki) - there are two files you care about:
    • LocalSettings.php -- where you set up how you want your Wiki to work.
    • includes/DefaultSettings.php -- where the defaults for all of those settings live.
  • Locate the following stuff in the defaults file:
   // Implicit group for all visitors
   $wgGroupPermissions['*']['createaccount'] = true;
   ...
   // Implicit group for all logged-in accounts
   ...
   // Implicit group for accounts that pass $wgAutoConfirmAge
   ...
   // Implicit group for accounts with confirmed email addresses
  • This lets you decide who can do what. Copy this section into your LocalSettings.php file and there you can alter them.
  • Each line that starts '$wgGroupPermissions' sets a permission on or off for one particular group of people.
  • The spammers mostly edit as IP users - so job #1 is definitely to remove page-create and edit facilities from "all visitors" and only turn them on for "all logged-in accounts".
  • However, you may find that some spammers do actually create accounts - they use them once and then forget about them so blocking them gets old, fast. So the next step in escalating your security is to turn off the page creation and editing privilage for "all logged-in accounts" too - and just enable it for "confirmed email address" users. (set '$wgEmailConfirmToEdit=true;') to make that work).
  • So far I have never seen a spammer who created an account AND confirmed their email address on my personal Wiki. So this seems to be adequate protection. For the utterly paranoid, disable the ability of IP users and even regular users to create accounts! Now, the only way for someone to edit is to have an account - and the only people who have accounts are the people for whom you create them using the WikiSysOp account! This certainly locks out spammers - but it also effectively locks out the good guys too.
SteveBaker (talk) 23:05, 1 November 2008 (UTC)[reply]
OK, resolved. Turns out that I have to upgrade my wiki... Blake Gripling (talk) 11:15, 2 November 2008 (UTC)[reply]

Google Phrase

[edit]

1. How can you look for an exact phrase on Google that has either, for example, "favourite" or "favorite" in it? I know you can use the command "x OR x", but I want to know what to do for exact phrases. Typing "that is my favorite OR favourite game" can confuse the search engine.124.180.143.48 (talk) 09:19, 1 November 2008 (UTC)[reply]

This is a guess, but you could try "that is my favorite game" OR "that is my favourite game". -- SGBailey (talk) 10:11, 1 November 2008 (UTC)[reply]
ORing the phrases definitely works, but I tried this on a hunch and it seems to work too: "that is my (favorite|favourite) game". The two methods don't seem to be equivalent - they give different numbers of results in a different ranking. — Matt Eason (Talk &#149; Contribs) 11:52, 1 November 2008 (UTC)[reply]

Ubuntu - slow DNS lookups

[edit]

I have slow DNS lookups - e.g. in Firefox, it takes a long time at "Lookup up x.com...". I tried to disable IPv6: I put all sorts of combinations into /etc/modprobe.d/aliases, bad_list and blacklist, but that didn't work. I've tried moving the ipv6 directory out of /lib/2.6.27-7-generic/kernel/net, but that didn't fix the slow DNS lookups. I've disabled avahi-daemon but that didn't do anything either. Any suggestions? --wj32 t/c 11:01, 1 November 2008 (UTC)[reply]

I run dnsmasq. It may take a long time to look something up the first time, but then it is locally cached and won't be looked up the next time you need it. -- kainaw 12:29, 1 November 2008 (UTC)[reply]
I have that already, but is there a real fix for the problem? --wj32 t/c 21:42, 1 November 2008 (UTC)[reply]
Get a faster nameserver. There is nothing you can do on your computer to make a remote nameserver respond faster. -- kainaw 02:15, 2 November 2008 (UTC)[reply]
I don't think its the nameserver - I think the problem has something to do with IPv6, but I don't know how to fix the problem. I've disabled IPv6, but lookups are still slow. And by slow I mean several seconds. --wj32 t/c 02:47, 2 November 2008 (UTC)[reply]
What makes you think it isn't the nameserver? What makes you think that IPv6 has anything to do with an IPv4 query to a nameserver? Have you tried a different nameserver? -- kainaw 03:30, 2 November 2008 (UTC)[reply]
Because on Windows and Mac (on the same network) the speed is normal and there is no DNS delay. My previous Ubuntu installation also had no delay. --wj32 t/c 04:34, 2 November 2008 (UTC)[reply]
There was a bind bug a while back that caused slow DNS resolution if had IPv6 enabled. The true fix is not disabling IPv6. It is updating bind. So, make sure you've applied all updates. As for disabling IPv6, I would do it by adding "alias net-pf-10 off" to /etc/modprobe.conf (you may already have an alias net-pf-10 line, change the value to off). There are other ways. -- kainaw 17:15, 2 November 2008 (UTC)[reply]

What can I make?

[edit]

I recently took apart my nearly obsolete (to me) 2001 macbook. It has a rather nice screen in it, which I would like to use in another project. Is there any way I can connect this screen to something other than the computer for which it was paired? It is a 13" LG/Philips LP121X1 (A2C2) LCD screen and has two connections. One has two wire conduits and I suppose is the power for the fluorescent lamp. The other is flat, about 1x.125", and appears to have 20 wires in its harness. Is there any way to connect this screen to a DVI (or other commonly used) source? I would optimally like to connect this screen to a cable television source. Is this possible? Will it cost significantly more than just buying a 13" tv? Tuckerekcut (talk) 19:49, 1 November 2008 (UTC)[reply]

Hmm, seems this is more involved than I thought, and I really don't have the soldering skills to mess with those tiny pins, maybe I should just scrap this now and save myself the trouble. Consider this question retracted.Tuckerekcut (talk) 20:04, 1 November 2008 (UTC)[reply]
You could probably sell it on eBay—replacement screens are pretty expensive to buy new. --98.217.8.46 (talk) 20:21, 1 November 2008 (UTC)[reply]

::A 2001 MacBook? Sell it to ME! (Although, to be fair, there are probably a thousand people out there who will outbid me ten to one). Was it a prototype? MacBooks did not exist until 2006. I have one of the oldest MacBooks and it is going strong. ... kind of. Did you mean an iBook? Please let us know. Kushal (talk) 21:44, 1 November 2008 (UTC)[reply]

I feel dumb. Kushal (talk) 22:25, 1 November 2008 (UTC)[reply]

FWIW, I did mean iBook.Tuckerekcut (talk) 13:53, 2 November 2008 (UTC)[reply]
I should have realized that 2001 is a LOT before 2006. Kushal (talk) 18:26, 2 November 2008 (UTC)[reply]