Jump to content

Wikipedia:Reference desk/Archives/Computing/2013 April 15

From Wikipedia, the free encyclopedia
Computing desk
< April 14 << Mar | April | May >> April 16 >
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.


April 15

[edit]

message notification

[edit]

when someone leaves a message on my talk page, and i get a notification when i go to any page, does the server know it's me from my ip, or cookies? if ip, given that my router uses nat, would anyone in my house get my notification when they go to this site? if so, how can i fix that? thank you, 70.114.248.114 (talk) 05:26, 15 April 2013 (UTC)[reply]

Wikipedia recognises you via your user name, which is made (semi-)persistent via cookies. You'll get the same orange bar if you go to an internet cafe and log in from there, and you won't get the orange bar if you log out but stay connected from your home computer. Other users of the same subnet connecting via the same NATed router won't get the message bar. If someone uses your account on your machine, then they likely will. --Stephan Schulz (talk) 05:39, 15 April 2013 (UTC)[reply]
Since the OP is an IP, the question may refer to messages on the IP's talk page. My understanding is that those are associated with the IP address, not with cookies. To avoid having other people with the same IP address see them, the simplest solution is to register an account. Looie496 (talk) 06:53, 15 April 2013 (UTC)[reply]
(ec) I don't think they have a user name. Yes it is based on your IP. So if someone from your house or anywhere ends up using the same IP they will see the orange bar. To avoid that you would need to register an account. CambridgeBayWeather (talk) 06:55, 15 April 2013 (UTC)[reply]
(edit conflict) ... but if you edit as an anonymous IP then anyone reading Wikipedia from the same IP address will get your messages, even if they are using a computer hundreds of miles away, and you might get messages intended for another editor. This is why creating a user name is recommended (and is the fix you need). If you are the only editor with the IP address 70.114.248.114 then there will be no problem, but if you have a changing IP address (even from the same computer at the same physical address), then you will miss messages intended for you, and other people will get your messages. Dbfirs 06:56, 15 April 2013 (UTC)[reply]

thank you all. 70.114.248.114 (talk) 21:11, 15 April 2013 (UTC)[reply]

What causes viewDidLayoutSubviews to fire?

[edit]

Hi all, I'm doing an ios app, and can't work out exactly when the viewDidLayoutSubviews method is meant to execute. I can log it (using NSLog) but I can't figure out exactly when it is supposed to go off. I know some things that always make it fire, and some things that never do, but other than that, it seems to have a logic all of its own. When I update a display about 100 times, it fires once, just for good measure. If I try to deliberately update 1000 times, it does nothing. I've read the docs, but I've only found this, and it doesn't say anything much. IBE (talk) 13:19, 15 April 2013 (UTC)[reply]

Well, that says "When a view’s bounds change, the view adjusts the position of its subviews.". So, when exactly does a view's bounds change ? StuRat (talk) 22:28, 15 April 2013 (UTC)[reply]
Yes, but that's the 64-thousand bit question: what exactly causes that? It seems to all happen rather haphazardly. I think if you are drawing something, and it gets a bit out of kilter, it thinks something has gone wrong, eg. if it rounds a floating point number wrongly, or something like that, but I don't know exactly what. At any rate, the practical problem is more or less solved by simply not using the viewDidLayoutSubviews except at startup. Still curious if anyone knows, but when googling through stackoverflow doesn't help, usually it means the technical knowledge isn't easily accessible on the web. Not to knock the expertise here, but it's a boffin's question IBE (talk) 08:16, 17 April 2013 (UTC)[reply]
I think you have the right idea. It's based on variables we don't know. Even if you read the code, you might not be able to predict it. So, just treat it as random. StuRat (talk) 18:10, 20 April 2013 (UTC)[reply]

Regular expression help

[edit]

I'm looking for the RegEx pattern that can parse out years from bibliographic references in HTML.

Basically, I have a bunch of HTML that looks sort of like this:

<BR><BR><DT>Lastname, Firstname.<I> Title.</I> Publisher, etc., 1998.
<DD>Summary here.

Repeat for many instances on any given page.

What I want is to extract the year and nothing else. There may be years in the summary that I don't want; just the years after the DT tag and before the DD tag.

Extra bonus: some of these have been added in through dumb OCR so instead of starting with a 1, they start with a lower-case L. So ideally it should also grab l998 as well in the above example. But otherwise I think it is pretty reliably in that format.

Sometimes there are more than one date in the citation. Is it possible to have one query that pulls out just the first date, but another that grabs all of the dates?

Easy way to do it with a RegEx, or not? It's OK if it is multiple queries if that is easier; there are no real performance issues, I just suck at RegEx. Thanks. --Mr.98 (talk) 14:54, 15 April 2013 (UTC)[reply]

RegEx's don't extract things, they simply match or don't match. It's not too hard to come up with a RegEx that will match entries that have a year in them, but if you want to extract the year, you need to specify what system you are using. Looie496 (talk) 15:19, 15 April 2013 (UTC)[reply]
I'm doing this in PHP. --Mr.98 (talk) 15:43, 15 April 2013 (UTC)[reply]
Well, there are various ways to make this more sophisticated, but I think you should be able to use something like
 <DT>[.]*(19[0-9][0-9]|l9[0-9][0-9]|20[0-1][0-9])[.]*<DD>
which will allow you to extract the year alone as $1. Warning: it usually takes me a dozen tries when I try to do something like this. Looie496 (talk) 17:50, 15 April 2013 (UTC)[reply]
How about skipping dates in title?
<DT>Doe, John.<I> European economy in 1945 – 1980.</I> Publisher, etc., 1998. <DD>Summary here.
CiaPan (talk) 08:23, 16 April 2013 (UTC)[reply]
And what about other OCR errors such as uppercase-O for zero, lowercase-g for 9, uppercase-B for 8, and so on? You might be better off on some massive editing session, using an editor capable of block select mode, Reg-ex searching (and replacing), creating short keyboard macro sequences, and handling however many lines there are in the file. You can use these features to delete as much of the HTML as possible, leaving you with a single column of publisher and year information - and just one line for each reference. Astronaut (talk) 16:55, 16 April 2013 (UTC)[reply]

Registration

[edit]

I am trying to register a new product I have just purchased.

Unfortunately I am unable to overtype serial no. on the

one you have already printed on slip, how can I register.

Donald Mathieson — Preceding unsigned comment added by 86.112.78.164 (talk) 15:26, 15 April 2013 (UTC)[reply]

I'm afraid you are in the wrong place. You were probably trying to contact some corporation, but this is Wikipedia, an online encyclopedia. Looie496 (talk) 15:42, 15 April 2013 (UTC)[reply]

Transferring a large file to an external drive

[edit]

I'm trying to copy a file that is over 6GB in size to an external drive, and Windows XP keeps saying there's not enough free space. Both the main hard drive and the external hard drive have enough free space, so my best guess is because the file size exceeds the size of the RAM. Otherwise, I'm completely at a loss. Is there anyway around this? Could Linux transfer the file? 166.193.101.13 (talk) 17:15, 15 April 2013 (UTC)[reply]

Reformat the external drive to a modern format like ext3 (after switching to Linux of course), and the problem will go away. Hcobb (talk) 17:25, 15 April 2013 (UTC)[reply]
I'm guessing the drive is formatted as FAT32, which has a file size limit of 4GB. XP ships with a utility creatively named "convert" which converts FAT32 volumes to NTFS. From a command prompt run convert q: /fs:ntfs where q: should be replaced by the appropriate drive letter. This will preserve all your data. There's no way to convert back, and you may have problems accessing the drive from OSes other than Windows or Linux. -- BenRG 18:29, 15 April 2013 (UTC)
Alternatively, split the file into two or more parts (under Linux, with split, and reassemble them with cat - this should work under CygWin, too). --Stephan Schulz (talk) 18:54, 15 April 2013 (UTC)[reply]
The simplest route for you would probably be to use an archive manager such as 7-Zip to split the file into 4GB volumes. You could also in the same process compress (with 7-Zip’s “ultra” 7z/LZMA2 compression), which can under certain situations make 8GB of data into 4 or less (although merely storing the data in 4GB volumes will take less time than storing and compressing).
The more worthwhile long term action would probably be to switch the drive FS to NTFS (as already mentioned), but it depends on how much data you already have on the drive / what capacity the drive is. ¦ Reisio (talk) 20:02, 15 April 2013 (UTC)[reply]
The trouble with the first two suggestions is they require reformatting the OP's external drive, which would destroy whatever is currently stored on it. And converting it to ext3 would then make it unreadable from Windows XP. Astronaut (talk) 16:40, 16 April 2013 (UTC)[reply]
Windows XP supports NTFS. One of the suggestions is to use the convert to make it NTFS. The BenRG says that this will preserve the data. To be safe, copy the contents of the external drive to another drive before doing the conversion. That sounds like the best thing to me. Bubba73 You talkin' to me? 17:11, 16 April 2013 (UTC)[reply]
This is about the process. Bubba73 You talkin' to me? 17:44, 16 April 2013 (UTC)[reply]
[edit]

On a router (mips R3000 big endian) running Linux as its OS (the rootfs is in ext2).I want to block all requests that lead to an add so their are no advertisement on web pages for all devices connected to the router. I don't want to blacklist sites, just advertising content.

I have blacklists that can be converted in any format.

Which program I may use. How I can do this.2A02:8422:1191:6E00:56E6:FCFF:FEDB:2BBA (talk) 20:33, 15 April 2013 (UTC)[reply]

i don't know to much about router blacklists, but if you can have the router drop requests for files with keywords in the title, like "ad" or "buy", that would get rid of some ads. 70.114.248.114 (talk) 21:20, 15 April 2013 (UTC)[reply]
You don't need a router for this; you need a proxy server - which you can often run on the same hardware as the router. squid is the most widely-used free software implementation. Here is the Squid FAQ on implementing an ACL blacklist. You can find numerous other tutorials on the web, including many that provide pre-fabricated content- and domain- blacklists. Nimur (talk) 21:24, 15 April 2013 (UTC)[reply]

You didn't answer to the questions.But I'll explain.


In France free as blocked all google's adverts (including AdWords) during some days. As most websites use google services it was nearly meaning blocking all adds.

They used a firmware update and all user's who dowloaded saw all adds gone (for the devices connected to the freebox).They were connected to internet as usual and as they do outside home.

One of the main advantage is blocking adds on totally locked embedded devices (where you can't install anything and you don't have even the right to specify a proxy).You could load pages that couldn't load (because of the ram used by adds).


I want to block all adverts free blocked + non google's ones. I want also that the pages get the same rendering free give to face the lost of the adds.


Now I don't use free as internet provider I don't have a freebox, I don't how they did, and theirs boxes probably run a custom OS.

But I have a router running linux 2.6.30 that you use like a PC (you can do things like installing a web server). It is like a PC except there is no screen and only 1.2 MB of ram is free when the system is running

I log into using ssh or telnet. Routing is configured with an init script and the firewall is done using the iptables command.


The lists are similar to the Easy-list you can find with addblock except they contains lots of more adds. But if there is an alternative solution I am ready to use it, blacklisting was just a suggestion.2A02:8422:1191:6E00:56E6:FCFF:FEDB:2BBA (talk) 23:37, 15 April 2013 (UTC)[reply]

Configure your router to route through your proxy server, and use your proxy server to block, black-list, or replace undesired advertisement content - either per-URL or per-HTML-element. Squid can do both. Then, any devices whose connection is routed through the router will have all their traffic proxied (and therefore, scrubbed of undesired content). Nimur (talk) 00:57, 16 April 2013 (UTC)[reply]

You are right, but some computer needs direct access to internet due to some special services. This is the reason I don't have any proxy.

But it may be possible to exclude the machine by mac address, in this case there is not the expected result. In the meant time I don't think the router is enough powerful for squid optimizations.2A02:8422:1191:6E00:56E6:FCFF:FEDB:2BBA (talk) — Preceding unsigned comment added by 62.39.140.158 (talk) 06:59, 16 April 2013 (UTC)[reply]

The following was hatted by the originator as 'Rant unrelated to helping answer the question'. They stuck a reply on my talk page at User talk:Dmcq#reference desk I can't see that there is an excuse on the basis of need in France. Dmcq (talk) 17:45, 17 April 2013 (UTC)[reply]
Why not simply stop using the internet? People have provided you with stuff at the very low cost of letting them try and show you an ad and you want to, well the only real word I have for that is you want to screw them even for that. Perhaps in the future we can have a system whereby you can pay a collection authority for accessing the web without ads rather like the collection agency for money for playing music and then we can have a way of catering for people who will pay otherwise rather than allowing ads to be shown. Would you prefer that? Dmcq (talk) 22:54, 16 April 2013 (UTC)[reply]

Google Chrome - is there away to stop websites overriding keyboard shortcuts

[edit]

I'm used to using certain kayboard shortcuts in Google Chrome - for instance Alt-D to get to the address-bar. Some websites (incl YouTube and Google Drive) take over this shortcut for something else, so it no longer takes me to the address-bar. Is there a way to prevent them doing this (preferably I'd like to be able to select it at individual shortcut level, as it's mainly Alt-D that annoys me)? Thanks, davidprior t/c 07:28, 16 April 2013 (UTC)[reply]

It is probably some scripting (such as Javascript) which is intercepting your keyboard input. You could turn off Javascript, but I doubt that would leave YouTube useable.
That said, I just tried YouTube in Chrome (with Javascript still on) and Alt-D took me to the address bar. Are you using some special page in YouTube other then just playing a video? Or perhaps you have some plugin at work here. Astronaut (talk) 16:32, 16 April 2013 (UTC)[reply]
Note there is also an HTML attribute accesskey that can add an access key (often a single letter) to any HTML tag, no JavaScript required. The browser decides how to give the user access to the access key. (Internet Explorer decides to use Alt+letter and override any shortcut previously in use. In Opera you press Shift+Esc, letter. You can see how other browsers work in Wikipedia's access key instructions.) However, I don't see any access keys defined on YouTube, and don't want to set up a Google Drive account to test. --Bavi H (talk) 00:46, 17 April 2013 (UTC)[reply]
Davidprior: Can you describe the unwanted action that happens on YouTube or Google Drive when you press Alt+D? This might help us tell how the shortcut is being overridden and help look for a way to prevent it. --Bavi H (talk) 00:46, 17 April 2013 (UTC)[reply]
In a Google Drive spreadsheet it takes me in to the Data menu
I can't now reproduce it on youtube, so it may only affect certain pages
Thanks, davidprior t/c 19:35, 17 April 2013 (UTC)[reply]

Most resilient data compression?

[edit]

At their default compression settings, which common data compression format has the most error correction: ZIP, 7Z, RAR, TAR + GZ, TAR + BZ2? --108.84.189.25 (talk) 21:53, 15 April 2013 (UTC)[reply]

None of them has error correction. For some resilience, you want a format (or an option) that disables Solid compression. tar.gz and tar.bz are solid. ZIP is not. 7z is optionally solid. If you care about future proofing, don't use RAR, because RAR is secret proprietary undocumented phooey, and who knows what will support it in 10 or 20 years. But if you really care about resilience, don't use compression at all. Resilience is redundancy, and redundancy and compression are antonyms. 90.212.6.90 (talk) 22:16, 15 April 2013 (UTC)[reply]
The above is correct, however RAR does have the option to create "recovery records" which can correct some data errors. This is not enabled in the default compression settings though. 77.101.52.130 (talk) 23:00, 15 April 2013 (UTC)[reply]
So, in general, if one bit is flipped in the compressed file, the whole thing is lost/unrecoverwable, right? Bubba73 You talkin' to me? 23:30, 15 April 2013 (UTC)[reply]
You should examine parity files, and the par2 format. Shadowjams (talk) 01:30, 16 April 2013 (UTC)[reply]
Disks and CDs have some error correction anyway. The real way to deal with problems if they fail is to have backups kept somewhere else. Dmcq (talk) 09:53, 16 April 2013 (UTC)[reply]
A file could be corrupted during transmission. Bubba73 You talkin' to me? 17:12, 16 April 2013 (UTC)[reply]
Anything can happen to a file. Error-correction-codes are pretty elaborate, and there is a ton of communication theory that mathematically proves one thing or another about bit-recovery-rate. But every instance of these theories are always predicated on a particular model of data-corruption. If you protect against the wrong type of data-loss, all your work is in vain.
For example, one can design a data storage medium that is impervious to bit-flip-error for the foreseeable lifetime of the universe, by implementing error-correcting checksums, adding seven-fold redundancy, adding a battery-backup, coating the entire device in thermoplastic resin, and putting it inside a lead box. But, the device containing the file can be dropped out of an airplane and end up at the bottom of the Atlantic Ocean. When this happened to Air France Flight 447's data recorder, all the data-redundancy in the world was insufficient to recover much of the resident data.
The initial attempt to recover the data was not aided at all by any error-correction checksum, because the device was at the bottom of an ocean. First, a fleet of sonar-equipped ships were required to locate the data. Then, a specialized deep-ocean robot-submarine was required to retrieve the data. Then, the storage medium was scrubbed of salt-water residue; protective layers were cleaned and removed under controlled laboratory conditions... the computer board was baked to remove any remnant moisture; and as soon as it was connected up, the recovered data was flawless - no checksum errors or flipped bits! But, other data on the recovered storage-media (such as the flight's "eQAR" and FCDC computer systems) was lost - and not due to bit-flip errors! In fact, when analyzed under a surface-scanning microscope, the bits were still present. They just were not in any usable form! (There was no non-destructive way to connect the salt-encrusted hard-disk platter to a computer with the right type of software to read the platter - the investigation experiment was terminated).
Regarding redundancy - the BEA's recommended action for transmitting the data to a remote location for additional redundancy is plagued by practical difficulties: aircraft over the middle of the ocean have poor radio-link, usually over low-bandwidth HF radio, so transmission of data is non-trivial.
On the other hand, most users of digital data can just "burn a back-up DVD" - which provides enough redundancy to protect the data against "all foreseeable types" of data loss and corruption.
The point is, it's impossible to describe a suitable "redundancy protocol" unless you have a suitable model of how the data can possibly be lost. All the error-correction-checksums might have been completely unnecessary on Flight 447's data-recorder if every bit of data was stored in an emergency-locator that floated. For this instance, a different model of data-loss (catastrophic data loss due to falling into the ocean) was more probable than random bit flips - and was not sufficiently protected against. Nimur (talk) 18:52, 16 April 2013 (UTC)[reply]