Wikipedia:Reference desk/Archives/Computing/2010 December 1

= December 1 =

Regular expression look arounds
I'm trying to write a perl regular expression in the following manner: I have a string with possible letters of abcd. The pattern will match the string if it's abd, abcd, or abd but nothing else. So far I have this: Obviously this is wrong, because it matches bcd. How to I write a lookaround for c to only be allowed if (a) doesn't evaluate to empty? Magog the Ogre (talk) 03:07, 1 December 2010 (UTC)
 * (a)?bc?d


 * First, since you're matching the whole string, you need to anchor the search with ^ and $. Next, since you put a ? after a, I suppose you meant "abd, abcd, or bcd" instead of repeating abd in the specification.  Then I'd just write the three alternatives explicitly:
 * or you can combine two of them:
 * This is simpler than anything you could do with lookaheads.
 * This is simpler than anything you could do with lookaheads.
 * This is simpler than anything you could do with lookaheads.


 * If a, b, and c really are long expressions themselves, then I wouldn't try to do it all in the regexp. Instead I'd do
 * and then test whether at least one of $1 and $2 was non-empty. --Anonymous, 03:30 UTC, December 1, 2010.
 * and then test whether at least one of $1 and $2 was non-empty. --Anonymous, 03:30 UTC, December 1, 2010.

Hmm, well the issue is I'm using a replace statement, so I'd rather not break it up if I don't have to. Also, after reinspecting, it looks like the code is as thus: where c being present is actually dependent on whether ac? (not just a) is present - however, although c is identical in structure on both occasions, it can represent two different pieces of text. And yes, b and c are long, but a and d are not. Magog the Ogre (talk) 05:32, 1 December 2010 (UTC)

Although now that you bring it up, I could (carefully) store b and c in variables and plug them in. That is a good solution, thanks; let me know if you come up with a better one (I know I've heard of look-arounds, but I don't have a clue how to use them tbh). Magog the Ogre (talk) 05:40, 1 December 2010 (UTC)


 * If I understand correctly (it's pretty confusing!), you want to match (b|ac?bc?)d but ideally without duplicating b or c. One (hacky?) way to do it is ((b)|a(c?)(?2)(?3))d. The (?n) pattern behaves like a repeat of the nth parenthesized regex (whereas \n only matches the same thing that regex matched before). -- BenRG (talk) 08:50, 1 December 2010 (UTC)

I wasn't aware of that; it is a bit "hackey" as you say, but I like it, thanks, I'll know for the future or any improvements on this code! Magog the Ogre (talk) 16:22, 1 December 2010 (UTC)
 * $c =~ s/abcd/abc?d/


 * I think that meets your original criteria. Shadowjams (talk) 10:41, 3 December 2010 (UTC)

A painfully Simple, Perplexing CSS question
Holy smokes, I am going nuts.

I am new to CSS and am trying to fuddle my way through. I have a simple requirement: I have a small table and an image, and I'd like them side by side, centered in the page. Ive spent 2 hours on this and I cant find a solution.

Ive put them both in a div, which I have to float to give it the smallest possible width, but then margin:auto wont work on the floated div.

Please help wiki-tizens, I am desperate.

Thank you kindly, --76.65.138.113 (talk) 05:47, 1 December 2010 (UTC)


 * Centred vertically, or horizontally?


 * Because you are using a table already for your layout, why not use a table for this... Make a table with width=100% and height=100%. Give it one cell with align=center.  Place all of that inside of it and it will show up as centered in the middle of the page. -- k a i n <font color='#3300cc'>a <font color='#0000ff'>w &trade; 14:35, 1 December 2010 (UTC)

This'll work with modern browsers, and IE8: ¦ Reisio (talk) 17:56, 1 December 2010 (UTC)

hacking
this is very urgent,someone has changed my password and i want to hack into my gmail account,the username is the same and i want to do so without using phisher please help, —Preceding unsigned comment added by 122.179.25.158 (talk) 11:34, 1 December 2010 (UTC)
 * We won't help you break into any account on any system, regardless if it is your own account or not. (If its your own system, then that's a slightly different matter). Anyway, Gmail, like most providers, offer a password recovery service. See the "Can't access your account? " link just below the login boxes. I trust you set an alternative email account, security questions, or a phone number for Google to verify you with? CS Miller (talk) 11:59, 1 December 2010 (UTC)

writing atom/rss feed to file?
Hey, I plan to do some statistics on the deletion ratio of new pages on enwiki. For that I need a table of new pages (including those speedy deleted within minutes) with article names, creators and creation time. I planned on getting that by importing the RSS/Atom feed from special:NewPages, but I can't figure out how to create a list which only adds new entries, instead of overwriting the entire table (and screwing up the formatting) everytime it updates. Is it possible? If not, are there alternative methods which would yield the same result? (I already thought about creating a log from the IRC recent changes channel, and then filtering that to include only the changes which involve article creation, but I dunno how I would do that either?). Any help would be greatly appreciated. Yoenit (talk) 14:41, 1 December 2010 (UTC)


 * Can you tell us what tools you're thinking of using for the job, such as which programming languages are available to you? (I'm getting the idea from what you're saying that you're trying to do it so far without writing any code, though I may well be mistaken.) Marnanel (talk) 15:11, 1 December 2010 (UTC)
 * Unfortunately I don't know any programming languages, I was just trying to import everything into excel. I was kinda hoping it would be possible without having to create custom scripts. Yoenit (talk) 15:24, 1 December 2010 (UTC)


 * I'm not sure exactly what you're trying to do because I have no experience with excel, but to just catch and save all the entries from an rss feed and update it every say 5 mins or so, you could use a feed reader program (Feedreader (Windows Application), RSSOwl, Google Reader, etc). Then, after leaving that running for however long you want to collect data for, you could export all the saved entries into your table or whatever. 82.44.55.25 (talk) 15:32, 1 December 2010 (UTC)
 * As a RSS feed is just a XML file served by http, you can use programs like wget or cURL to down load the file. You'll need to write a script to call wget/curl on a periodic basic, probably using the check-cache options. CS Miller (talk) 23:44, 2 December 2010 (UTC)

PC Problems with Wikipedia.
Recently, when browsing articles in Wikipedia, my PC has begun closing down without warning. When I go online again, I get a juddering shuddering screen that shakes violently before logging me off. This is only very recent. But I now know the solution. I have discovered that the shuddering juddering and shaking seems to be caused by Wiki opening up, or attempting to open up, multiple pages simultaneously and not being able to display just one. So now, when this happens, before it logs me off, I click on Window in the AOL Top Menu Bar, and click Close All Windows Except Front, and all the extraneous windows shut down, leaving me with a normal stable screen that doesn't shut me down. Is this me, or have I been attacked by some Wikibourne Bug, or are some pages I look at infected? This doesn't happen all the time, as like now. But there is definitely a pattern developing here. Thanks 92.30.192.125 (talk) 15:46, 1 December 2010 (UTC)


 * When you say your "PC has begun closing down without warning", do you mean it instantly shuts off and you have to press the power button to turn it back on again? Or does it bluescreen and then reboot by itself? (Sometimes the bluescreen can flash by so quickly so as not to be detected.) Or does it do something else entirely? -Amordea (talk) 17:07, 1 December 2010 (UTC)


 * Sorry, I must have misled you. What it soes is disconnects me from AOL with the usual insane woman's voice "Goodbye" leaving me staring at my bluescreen with all my icons on it. It does not shut down my PC such that I need to power it up again. But what it then does is put a text box on screen that says AOL has encountered a problem and we are re-connecting you, asking for an OK, Cancel or Details box to be clicked. And that's when the St.Vitus' Dance begins. Sorry for the confusion. But it never happens whenever I am browsing any other websites. Cheers. 92.30.192.125 (talk) 18:19, 1 December 2010 (UTC)


 * Possibly your browser or system has been infected with malware that sometimes redirects your browser to a site that attempts to pop up 1000 windows in your face. Have you tried downloading something like Malwarebytes to scan your system for malware infections?  Comet Tuttle (talk) 19:38, 1 December 2010 (UTC)


 * See you Comet - I think you are wonderful. I followed your advice, installed the free software, ran the scan, and found 19 malware infections which have now been quarantined, which I imagine means they are out of causing any harm. Buy yourself a large one and put it on my account with my many thanks. Cheers. 92.30.192.125 (talk) 22:39, 1 December 2010 (UTC)


 * Great! So glad to hear it.  As for those 19 malware infections not causing any further harm, you may want to follow a scorched-earth policy and follow the instructions at this Viruses FAQ, which basically tells you to erase everything on your hard disk and start from scratch, on the theory that you can never be sure that a malware scanner has eradicated every scrap of malware.  Whether you do the scorched-earth approach or not, I recommend you create a Windows account with no administrator rights (as mentioned in that FAQ) and use it for everything except installing software.  It makes it much harder for malware to screw up your system if the malware has to struggle within the constraints of an account with no admin rights.  Cheers!  Comet Tuttle (talk) 22:01, 2 December 2010 (UTC)


 * One other comment, the AOL browser is absolute bloatware, meaning it takes up way too many PC resources for what it delivers. I would advise you to never run AOL with anything else, and reboot after you stop AOL (if you can stop it, without it restarting on you), then start another browser, like Firefox, or, if you must, Internet Explorer. Of course, if you have dial-up, then you would actually need to keep AOL running any time you want internet access. Otherwise, any browser can be used to access Wikipedia, or any other web site. StuRat (talk) 01:16, 2 December 2010 (UTC)

Database Help
I am looking to start a small database (<10,000 entries) for a small business, but frankly I have no real experience with databases. I have tried OpenOffice's Base program so far, and it seems all right, but I was wondering if there is something out there which is better to use for my purposes.

I want it to keep client records and have the ability to make a wide variety of queries to it and also want it to be modular enough that I can easily modify it later to suit my needs. Base seems to do this inasfar as I can tell, except it seems to have the annoying limitation that I cannot change the order of the fields in the table view (possibly due to my inexperience in using the program) once I have created them. I fear this will later on lead to a very convoluted order of fields, making data entry an unintuitive chore of a process. And I have no idea what other problems I will run into later.

Does someone here who has some real database experience have any advice for me? Thanks in advance. -Amordea (talk) 16:39, 1 December 2010 (UTC)


 * I should also add that I would eventually like the ability to make queries to the database remotely as well. -Amordea (talk) 16:41, 1 December 2010 (UTC)


 * I personally like MySQL (the free version) combined with the PhPMySQL package. it's a little programmy - you have to learn how to use SQL syntax - but it will satisfy all of your business needs and is easily expanded to remote and web use.  -- Ludwigs 2  17:23, 1 December 2010 (UTC)


 * Base is kind of a buggy, open-source version of Microsoft Access. My feeling that is that Access is probably a better investment if you are a business and take the contents of the database seriously. In the future Base might be the kind of thing that would be a good alternative, but my general feeling (as a sometimes-database programmer) is that the community size and software maturity has not really gotten to the place it needs to be to be worth putting into mission-critical tasks. Note that Access is itself buggy and a pain in the neck in certain ways, but its bugs are pretty well known (and there are endless workarounds on the web), and one can find endless "learn Access in 7 days" sorts of books and tutorials that will get you quickly up to speed with it. I recommend using one of said books before starting — a good database starts with understanding databases better than the average person on the street, and you want to make sure you have it set up reasonably before you start the laborious process of entering in thousands of items of data. Access lets you deal with it as simply or complicatedly as you'd like, and there are solutions with making it accessible remotely as well. --Mr.98 (talk) 20:20, 1 December 2010 (UTC)


 * Thanks for the responses. I hadn't considered Access, so there is an idea. As is MySQL, which is interesting to me. I wonder how steep the learning curve is for that. Well, sounds like I have some more research ahead of me. Again, thanks for the ideas. -Amordea (talk) 14:41, 2 December 2010 (UTC)


 * Raw MySQL, like SQL in general, has a steep learning curve. It's usually used as a back-end database, not the front-end that you actually use to add or modify data. phpMyAdmin, which I imagine is what Ludwigs2 was meaning, is a PHP (web-based) front-end for a MySQL database that is pretty popular. Personally I've never considered using it for a database GUI — it's overkill, and its really there more for server admins to use in setting up databases, and it's perhaps too powerful (with a few wrong clicks you could delete the whole database, which a real GUI would make a little more difficult for the person entering the data to do). SQL in general is the universal language of querying databases, and for pretty simple things, it is pretty easy to pick up. But if what you want is to just set up a database to use, I doubt you need to know it, if you have something like Access which can generate SQL for you more or less automatically depending on what you want to do with it. --Mr.98 (talk) 17:25, 2 December 2010 (UTC)


 * Hmm, good to note. And I don't have a webserver to put it on anyway. Although developing one might be a fun project sometime, but that's getting way beyond the scope of the immediate issue here. The only problem I have with Access is that it costs money...which brings me back to Base.
 * Well, when the database becomes valuable enough that I find it worth investing money into, what would be the best program to start with in order to convert the database over to Access or some SQL-derived database program, without having to rewrite all the data entries from scratch? Is that even feasible or is that a pipe dream? -Amordea (talk) 18:28, 2 December 2010 (UTC)


 * I ended up giving MySQL via PHPMyAdmin a go. With XAMPP, setting up a local server turned out to be surprisingly trivial and it looks like I could easily make the server available to the internet once I figure out what I'm doing. I can't say I really know what I'm doing yet, but this program does seem really flexible so far. It also does seem, like Mr.98 has said, easy to mess up too. I accidentally deleted the MySQL root account within the first few minutes of starting the webserver, while trying to install a password no less. Instead of fooling with trying to figure out how to recreate the accounts, I simply reinstalled the program and eventually figured out how to correctly safeguard the accounts. The ease of deletion is pretty scary and I may yet scrounge up the money for something a little more user-friendly.
 * Well, thanks again to everyone who offered suggestions. Although if anyone else has any other advice, I'm still open to suggestions here. -Amordea (talk) 08:14, 3 December 2010 (UTC)
 * There is XHarbour, Harbour (software) and one or two others that are free clones of the Clipper (programming language) and Xbase database languages. 92.29.114.35 (talk) 10:05, 3 December 2010 (UTC)
 * I'd add FileMaker and SQL Server Express into the mix. FileMaker was good when I used to use it some time ago - reliable, easy to get online, and between Access and the bigger databases in power. I'm not sure of its current status, though, as these days I'm pretty much limited to MySQL, Oracle and SQL Server development. I've done some work with SQL Server Express, and that's not bad for applications of the size you're talking about, plus it is free. Paired with Visual Studio you can toss together some nice applications, and you can scale up well, if needed. - Bilby (talk) 10:19, 3 December 2010 (UTC)

AM/FM Radio receiver in iPhones?
Do any of the iPhone models have hardware inside to pick up radio? Thanks. 20.137.18.50 (talk) 18:29, 1 December 2010 (UTC)
 * The touch screen iPod nano has an FM receiver in it. None of the other iPod models support radio. 206.131.39.6 (talk) 19:38, 1 December 2010 (UTC)
 * I'm not so sure. According to http://www.theregister.co.uk/2010/11/24/apple_rejects_single_station_iphone_radio_apps/

Rumors have long suggested that Apple is building its own FM radio app for the iPhone, and later versions of the Jesus Phone [iPhone] include an FM transmitter and receiver hardware.
 * It's not clear if "Rumours" qualifies both clauses in that sentence or just the first one. CS Miller (talk) 20:21, 1 December 2010 (UTC)
 * Whatever they meant, I wouldn't consider it a rumour that it has a FM transceiver since you can find photos of the chip  . Note however the transceiver chips in the various models do other things and no one seems to know if it's even connected so it can be used as a transceiver. Nil Einne (talk) 09:00, 4 December 2010 (UTC)

ISPs and MAC Addresses
I have heard that some ISPs do not allow customers to change their MAC addresses. Why on Earth would they do this? What happens if the customer buys a new computer? What about home wi-fi networks with multiple computers, and visitors occasionally bringing their own, not to mention mobile phones and such? Sorry, this is a lot of questions. I suppose I would just like to know why this happens. -- <font face="Freestyle Script" color="blue">KägeTorä - (影虎) (TALK) 18:58, 1 December 2010 (UTC)
 * I can't see how an ISP could stop you from changing the mac address. Which ISP have you heard this about? In the case of wi-fi networks, all computers or phones or whatever connect to a wireless router which has its own mac address; the individual mac addresses of each device are not seen by the isp. 82.44.55.25 (talk) 19:37, 1 December 2010 (UTC)
 * Right - that makes perfect sense. Sorry, I heard this from someone I was having a discussion with - we were talking about MAC addresses and how they can be potentially changed, and he mentioned that ISPs sometimes set down rules against this happening. No specific ISPs were mentioned, though. Anyway, thanks. -- <font face="Freestyle Script" color="blue">KägeTorä - (影虎) (TALK) 19:53, 1 December 2010 (UTC)


 * Cable-modem providers don't like you to change the MAC on your cable modem, but they don't care about the MAC on your PC. APL (talk) 20:00, 1 December 2010 (UTC)
 * Telewest/Blueyonder, before their cable-modem had a NAT/firewall, used to use your PC's MAC address to identify you. They would let you register upto 5 MAC address via their website. CS Miller (talk) 20:09, 1 December 2010 (UTC)
 * I don't know about ISPs, but universities and other organizations often maintain access lists of MAC addresses that are permitted to use their networks. Looie496 (talk) 21:09, 1 December 2010 (UTC)


 * Here's an example of how an ISP might use a MAC address. Imagine a DSL internet service provider that uses DHCP to automatically assign IP addresses to their customers. Some customers might use DSL modems without built in routers. And sometimes they might plug a switch into their DSL modem. In this case, all the computers and devices connected to the switch would get their own public IP address, and the ISP might run out of IP addresses for that area.


 * To prevent this, the ISP's DHCP server will only allow one device per customer circuit to get a public IP address. It tells devices apart by the MAC address. Once it grants the first DHCP request, the DHCP server will ignore any requests from other MAC addresses until the granted IP address is released.


 * In today's times, DSL modems usually have built in routers, so it will be the modem-router that gets the public IP address and the modem-router's WAN MAC address that the ISP sees. The only time you might have a problem is if the modem-router is replaced, then you might have to call the ISP to get the old MAC released so the new modem-router can get an IP address.


 * In this example, the DSL ISP only cares about running out of public IP addresses. As long as you use a router, then the you can add or remove computers to the router's Ethernet or wireless LAN without a problem, the ISP only sees the router's WAN MAC address. But the ISP has to keep the MAC address check in place to prevent running out of public IP addresses in case someone connects a plain DSL modem to a switch with multiple devices. --Bavi H (talk) 04:34, 2 December 2010 (UTC)

keyboard
What's the difference between enter and return keys on keyboard? —Preceding unsigned comment added by 114.173.217.17 (talk) 21:07, 1 December 2010 (UTC)
 * See Enter key for an explanation. Looie496 (talk) 21:13, 1 December 2010 (UTC)

Re: en.wikipedia.org/wiki/List_of_social_networking_websites;
Question removed. This question is already on the Entertainment desk. Please do not crosspost the same question to more than one Reference Desk. Comet Tuttle (talk) 22:11, 1 December 2010 (UTC)