Wikipedia:Reference desk/Archives/Computing/2012 January 11

Computing desk
< January 10 << Dec | January | Feb >> January 12 >
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.


January 11

edit

regex problem

edit

I'm cleaning up a very large text file which contains heaps of entries like

[123] 

ie. a number between 1 and 999 inside a pair of square brackets and followed by a space. I just want to remove (not replace with anything). Can someone advise some regex code for this? Moondyne (talk) 07:22, 11 January 2012 (UTC)[reply]

What form of regex/what language/application? For Perl, something like
s/\[[0-9]{1,3}\] //g
should work. --Colapeninsula (talk) 10:49, 11 January 2012 (UTC)[reply]
No joy. The text is here if you want to do it for me ;) Moondyne (talk) 11:21, 11 January 2012 (UTC)[reply]
Done using \[[0-9]*\]\s* in Kate (text editor). -- kainaw 14:02, 11 January 2012 (UTC)[reply]
Thanks guys. Moondyne (talk) 14:12, 11 January 2012 (UTC)[reply]

report of censoring by Wikipedia Chinese web site

edit

Dear Sir or Madam,

I wrote the Legal History of Chinese Americans in Chinese and tried to upload it onto Wikipeida Chinese web site. My content keeps getting deleted. There was a vague statement that I some how violated some one else's copyrights on "China American History" just a day before my posting, and when I clicked on that link, there was nothing.

Since this is a free web site,I hope the Chinese pages have no censorship. Please let me know what to do. Thanks.

Chang C. Chen — Preceding unsigned comment added by 220.136.184.232 (talk) 10:16, 11 January 2012 (UTC)[reply]

You were trying to post on Chinese Wikipedia at http://zh.wikipedia.org/wiki/ rather than the English Wikipedia? Each Wikipedia has its own administration, help desk, etc, so you will have to ask there, not on English Wikipedia. All versions of Wikipedia take copyright violations very seriously and will remove all content that appears to infringe anyone's copyright. Occasionally mistakes are made and it may be that your work did not infringe copyright, but you will have to take it up with the administrators on Chinese Wikipedia.
Chinese Wikipedia is run by Wikimedia foundation in the USA just like other Wikipedias, and does not censor discussion of controversial topics. The only censorship is the same rules as other Wikimedia sites, which prohibit libellous content, copyright violation, and a few other equally illegal things. For this reason it has frequently been blocked by the Chinese government. --Colapeninsula (talk) 11:01, 11 January 2012 (UTC)[reply]
If your content appears to have disappeared, click the "View history" tab at the top of the page of interest and look through the entries (or the Chinese equivalent if you are using the Chinese Wikipedia). You should find your contributions, and if they have been removed, you should be able to see where, and hopefully a supporting edit summary stating why. If there's nothing in the history about your additions, then you probably forgot to save the page when you added your content. If you cannot actually access the page at all, then it's probably being blocked by the Chinese Govt censors (who do block many Wikipedia pages, even when not blocking the whole site). --jjron (talk) 15:12, 11 January 2012 (UTC)[reply]

How do I use phpMyAdmin

edit

Ive installed php mysql and phpmyadmin by following instructions I found on the web but now i don't know how to start it. --212.120.242.42 (talk) 10:25, 11 January 2012 (UTC)[reply]

phpMyAdmin is just a PHP script that uses MySQL, so you don't need to start it if PHP and MySQL are already running correctly. You just need to put it into whatever directory your server recognizes are a "web" directory that it should be parsing for PHP, and it should work. --Mr.98 (talk) 12:18, 11 January 2012 (UTC)[reply]
You don't start PHPMyAdmin. It is a web page. You go to the web page (which is completely dependent on exactly where you installed the scripts). -- kainaw 15:17, 11 January 2012 (UTC)[reply]

pagefile

edit

Would installing an internal hard drive into a computer and setting the pagefile in Windows 7 to something absurd like 750GB greatly improve system performance? The new hard drive would have nothing on it except the pagefile 82.45.62.107 (talk) 12:38, 11 January 2012 (UTC)[reply]

No, almost certainly not. If you're paging, you've exhausted your memory and you're in the hell of swapping. A faster drive to swap to just makes that hell slightly less, um, hellish. But it still sucks, and you want to do whatever you can to not be paging in the first place. If you're in danger of swapping, buy more RAM. -- Finlay McWalterTalk 12:47, 11 January 2012 (UTC)[reply]
While it's true you want to avoid relying on a page file and a 750GB page file would serve no purpose, it questionable if you want to do whatever you can to do not be paging in the first place. As was discussed recently, Windows will commonly put stuff to the page file even if you have a lot of RAM since it considers it better to use the RAM for cache (and possibly other things like Windows Vista I/O technologies#SuperFetch) which may be used, rather then use it keeping stuff in RAM which hasn't been used for a while. As I remarked, you get little ability to control this (other then something stupid like disabling the pagefile) in Windows, I believe more in some of the *nix OSe,s but I don't think you can say it's clearly a bad strategy for everyone. There is a reason why Microsoft (and actually I believe many *nix distros by default [1]) chose it.
Except in extreme cases there's a good chance you're going to have less RAM then data that may be required sometime soon (and caching generally means you need a lot of stuff that isn't used to ensure the stuff that is used is available). Particularly if you're the sort of person who opens programs which you then don't use for a while, it may very well give you a better overall experience to move that program data out of RAM even if you have to take a speed hit when you go back to it. (Of course there's also a question of psychology, some people may feel annoyed when they have to wait 10 seconds for a program to become available while the program data is reloaded, even if they haven't used it in 10 hours and in that time have saved 2 minutes of waiting from cache that was only there because of the RAM freed up from that program. This isn't completely surprising since when you're waiting for an open program to become responsive, it's fairly obvious but it's not obvious that you didn't have to wait so long because something was already in RAM.)
BTW not that relevant here but [2] and [3] appear to confirms what I speculated in December 29th which is that Windows will always try to keep a copy of everything in RAM on disk if possible (obviously stuff like cache already has a copy) so that can easily free up RAM when necessary.
Nil Einne (talk) 13:36, 11 January 2012 (UTC)[reply]
Regarding your last paragraph: the top-voted commenter in the first thread you linked seems kind of confused. He says "windows likes to keep a backing store in the page (swap) file for everything in your physical memory. [...] The downside is slower load times [...] as the item must be both read from disk to RAM, and then the RAM written back to disk". That's wrong. All paged physical RAM is backed by some disk file, which may be the page file or some other file. When it's backed by the page file it's called "virtual memory" and when it's backed by some other file it's called "disk caching" or "memory-mapped file access", but it's basically the same thing internally. When a page in RAM is dirty (meaning that it's been modified since it was last loaded from disk), and the page hasn't been modified for a while, and the disk is idle, it makes sense to write the new contents out to the backing file, after which the in-memory copy can be marked as clean. All modern operating systems do this. Writable data segments of executable files are a special case: they're mapped copy-on-write, meaning that if they get modified they morph into new pages backed by the page file. But until they're modified they remain backed by the executable file. No operating system will waste time writing an unmodified page to disk when there's already a copy on disk in a known location. -- BenRG (talk) 03:03, 12 January 2012 (UTC)[reply]
I found a cute cooking illustration of the huge increase of latency that going to disk entails. If cache is the refrigerator, and memory is your neighbor's house, then fetching something from disk involves driving around the world. It's good argument for getting a larger neighbor's house. I believe that, in general, having a larger swap file never makes your computer faster, it just allows it to thrash longer before the OOM killer goes on a rampage. Paul (Stansifer) 16:40, 11 January 2012 (UTC)[reply]
From this illustration:
Typical CPU is 120 million times faster than typical memory
Two minutes to access main memory Go to the neighbor's house to get an item.
Surely they mean 120 times, not 120 million times? JIP | Talk 20:41, 11 January 2012 (UTC)[reply]
Hm. I don't think it's either of those. There are 1 million nanoseconds in a millisecond. If you have a HDD seek time of around 10 milliseconds and a memory read time of 100 nanoseconds, random reads should be 100,000 more expensive for disk than for memory. So that should be the difference between 2 minutes and 4.5 months. Paul (Stansifer) 21:17, 11 January 2012 (UTC)[reply]
The text I quoted was about CPU vs. memory, not about memory vs. hard disk. JIP | Talk 21:22, 11 January 2012 (UTC)[reply]
Apparently, I can't read. You are correct. Paul (Stansifer) 21:36, 11 January 2012 (UTC)[reply]

Columns in EPUB

edit

Hello,

I am presented with the task of converting a novel from InDesign to EPUB. All is straightforward apart from one section which has non-standard typography. For a start the left hand page and right hand page need to be read concurrently - the section is presented as two people experiencing the same events, but the person on the left hand page has gone mad and the text jumps about the page, while the right-hand page continues normally.

On an ereader, is there a way to present: a) text in fixed columns so that they remain together and b) non standard typography - changes in size, orientation, font, opacity etc?

Any help appreciated 195.60.20.81 (talk) 16:49, 11 January 2012 (UTC)[reply]

This video tutorial (which I confess I've not watched) claims to cover text positioning in EPUBs created in InDesign. I believe this kind of thing is actually done in CSS. -- Finlay McWalterTalk 17:17, 11 January 2012 (UTC)[reply]

Skype on smartphones: 3G or wifi

edit

Which way does Skype use on smartphones: 3G, wifi or both? 88.9.214.197 (talk) 20:28, 11 January 2012 (UTC)[reply]

On my Android phone it will work over either. -- Finlay McWalterTalk 20:36, 11 January 2012 (UTC)[reply]

How can a web crawler see what we can't?

edit

A month ago a message board web site announced it would be closing and referred its members to Facebook and Twitter. Some of us wanted to still be able to read what was on those boards, but three days after new posts were disabled on most parts of the site and one day after the last section had new posts disabled, using any URL on that site resulted in being forwarded to the list of Facebook and Twitter links. Members of a site where some of us went after the shutdown were informed we could see cached versions of the pages in search engine results. But I discovered something amazing when I tried this: there was a date when the closed site was last crawled. It was a date on which we could not access the old site because we got forwarded. I even tried the Wayback Machine. It had not done much, but when a related message board shut down, and was visible for three months, a lot of new stuff got archived and I didn't know it until months after I could no longer access the old site.Vchimpanzee · talk · contributions · 21:35, 11 January 2012 (UTC)[reply]

A lot of forum systems distinguish between "real" users and search engine bots (typically by user agent string). The idea, I presume, is to help search engines index a forum and entice in visitors to become new members, etc.. Frequently "private" or "disabled" forums are only so for "real" users, most likely because typically the forum admin isn't aware of this search engine UA exception. ¦ Reisio (talk) 21:43, 11 January 2012 (UTC)[reply]
It's actually quite easy to spoof your user agent. You would basically be masquerading as the search engine crawler. If you're using Mozilla Firefox, I recommend [4]; for other browsers, Google is your friend. --NYKevin @286, i.e. 05:51, 13 January 2012 (UTC)[reply]

Best program for a text-based shooter game

edit

Hey, I've never coded before, but I am willing to learn any language. I want to know what language would be best for a game like this:

It would be text-based, and involve the player choosing from a selection of classes. The classes would have different hp counts, weaponry, and clearance levels. They would also choose a race, which would only affect the types of armor they can wear (it's sci-fi themed.)

The player would advance through rooms by fighting randomly-generated opponents and occasionally gaining randomly-generated allies. (randomly-generated = they'd choose from preset NPC classes and races). Fighting would involve range, initiative, and at one point fighting an invisible boss.

I'd also like it if the player could choose their name/gender at the beginning, and could nickname allies as they join the party.

This seems like a pretty simple game to make, but what coding language would be the best choice to learn? I tried Inform 7 but it didn't seem to be advanced enough to allow for some of these aspects. 128.111.81.41 (talk) 22:02, 11 January 2012 (UTC)[reply]

I suggest you read Text-based game, and decide on which of the genres described there best match your vision. The programming language you use will be different for a roguelike game or a text adventure game. If you intend it to be multi-user or in real-time, that will also make a difference. If you are simply thinking about a single-user text adventure, with some random monsters and perhaps some computer-based companion characters, I suggest one of the Z-machine interpreters would be best.-gadfium 22:59, 11 January 2012 (UTC)[reply]
We had a similar question a while ago. One suggestion was one of the programmable MUD engines, in particular LPMUD with LPC for programming. It has the added benefit of free support for multi-player network play. --Stephan Schulz (talk) 23:13, 11 January 2012 (UTC)[reply]
One thing to bear in mind is that getting comfortable with a programming language takes quite a while - you might want to choose a language that you think you might find useful for other projects in the future (in particular, Inform makes it very easy to write text adventure games, but isn't really much use for anything else) - although many of the skills you learn will be transferable to other languages anyway. Whatever you choose, you will probably want to find a good book or online tutorial and spend a little time getting used to the basics before you start coding your game, and it would be a good idea to choose a bare-bones subset of the game and get that working before you start adding all of these features. 130.88.99.231 (talk) 19:27, 12 January 2012 (UTC)[reply]
I would also suggest that you look for an open-source game similar to the one you want to write and try tweaking the code or adding a new feature. This is a great way to learn.-gadfium 22:56, 12 January 2012 (UTC)[reply]