Wikipedia:Reference desk/Archives/Computing/2013 September 30

Computing desk
< September 29 << Aug | September | Oct >> October 1 >
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.


September 30

edit

php regex replace

edit

Hi, need some advice about preg replace.

Where can I find out the best way to have php replace /n in a file with "< BR>", but only if the /n is found NOT within an html tag? Thanks Duomillia (talk) 01:17, 30 September 2013 (UTC)[reply]

Maybe this would work. You'll run into problems if the html is invalid, like when it has text containing "<" characters instead of &lt; Ssscienccce (talk) 15:20, 30 September 2013 (UTC)[reply]

searches

edit

I type what I am looking for, hit search,when the results come up,i am asked "did you mean so and so". for example I type in u.s.s.cairo and get "did you mean Uss. cairo, or usS. cairo". what is going on. — Preceding unsigned comment added by Rmh1066 (talkcontribs) 05:11, 30 September 2013 (UTC)[reply]

That is a message from MediaWiki, the software Wikipedia runs on. It is displayed, when there is no article title matching your search term. I don't know the details of the exact algorithm MediaWiki uses to determine the term displayed after Did you mean: If there are matches within the body of an article, those results will be displayed below the Did you mean message. -- Toshio Yamaguchi 12:17, 30 September 2013 (UTC)[reply]
Also see WP:Redirect for more information. Google does the same thing to get you to the right place. Thanks Jenova20 (email) 13:00, 30 September 2013 (UTC)[reply]
If you're referring to Google, sometimes they even autocorrect your search instead of simply saying "did you mean...". If this happens then you can just click "search instead for <what you searched>" which can usually be found under "showing results for <whatever they autocorrected your search to>". --.Yellow1996.(ЬMИED¡) 23:15, 30 September 2013 (UTC)[reply]

Number Chooser Question

edit

What is the term for this technique to keep the viewers in suspense about which number was chosen? I have seen it in both TV and programs.

var chosen = Math.ceil(Math.random() * 10);
var shown = document.getElementById("display");
var keepguessing = window.setInterval("keepguessing()", 200);
function guess()
{
 var try = Math.ceil(Math.random() * 10);
 shown.innerHTML = try;
 if (try == chosen)
 {
  window.clearInterval(keepguessing);
 }
}

— Preceding unsigned comment added by 219.74.249.39 (talkcontribs)

Shortened question title. -- 140.202.10.134 (talk) 15:46, 30 September 2013 (UTC)[reply]
Can you tell us more about what you mean?
I'll offer a guess: sometimes a movie has e.g. a ticking bomb, with a 10-digit randomly flashing code, and our hero has a device that guesses the digits one by one to disarm the device. Or what WOPR did in WarGames. I don't think it is a widely used term, but tvtropes.org calls it "Password Slot Machine". 88.112.41.6 (talk) 17:04, 1 October 2013 (UTC)[reply]

Who made a 1980s single-dot impact printer?

edit

I've searched WP and Google for this but found nothing. I'm pretty sure that I owned an unusual type of printer for use with my BBC Micro. It was similar to a dot matrix printer but printed only one dot at a time. It had a fluted, spinning drum instead of a smooth platen behind the paper and a spinning toothed wheel in front of the paper, with a ribbon in between. When the ridges on the drum and the wheel intersected at the right place, a solenoid would bang the wheel against the ribbon and paper, marking a single dot. The result was similar to the output of a single-character dot matrix printer but much noisier and slower. The advantage was its low cost, because there were few moving parts. Does anyone remember who made this and what the technology was called? --Heron (talk) 15:14, 30 September 2013 (UTC)[reply]

According to [1] found from a search for '"single pin" impact printer' or something similar, the LP VII and DMP 100 only had one pin but I didn't look into other details of design or even if the single pin part is correct, partially because I have doubts either of them were really designed to be used with a BBC Micro considering who sold them [2] [3]. But perhaps it was a related design and in any case I appreciate in those days presuming it used a compatible port, you could likely use it since addressing printers was simple. Nil Einne (talk) 16:01, 30 September 2013 (UTC)[reply]
Does BT100 answer your question? Astronaut (talk) 18:15, 30 September 2013 (UTC)[reply]
I once had a printer that used this exact (or very similar) rather strange mechanism. It had a Commodore Business Machines badge on it and was sold in Australia for use with my Commodore 64! (Ah... memories!  ). Did not print "on carbon copy paper." as on BT100 page, it used standard tractor feed paper.
  • Heron, Are you sure it had "a spinning toothed wheel in front of the paper."? IIRC it was 'fixed' and as noted belted out each line a single dot at a time very noisily and slowly, against a "fluted, spinning drum" behind the paper.
  • Figure 10 on page 14 of the DMP-100 printer Manual Nil Einne provided the link to gives interesting details of the print method & mechanism that may help identify the manufacturer.
  • Apparently the C-64 printer I had in mind was the VIC-1525 (manual, dated 1982, HERE). Some of the diagrams(2.6, p.10) are exactly the same as the DMP-100 manuals' (Figure. 6, p.8). - 220 of Borg 20:06, 30 September 2013 (UTC)[reply]
The manufacturer may have been Seikosha. This info. comes form the 'Denial Wiki' at VIC-1525 Graphic Printer. The statement is unsourced. It also says "Non-Commodore printers using this hardware were the nearly identical ... "Tandy DMP 100".220 of Borg 20:20, 30 September 2013 (UTC)[reply]
Thanks for your generous help, folks. 220 of Borg jogged my memory with the name Seikosha - that was definitely the brand. Armed with that fact, Googling brought up a patent for a 'cross hammer dot printer', which makes sense. (Why do patents always talk about a plurality of everything?) Now I know the generic name for the mechanism so I can refer to it in the WP article. I was wrong about the spinning wheel - that was just my memory over-engineering the thing. It was indeed a fixed hammer, hence the low cost and the noise. This Watford Printer Monitor ROM Review refers to a Seikosha GP100, so it was probably that: behold the photo. --Heron (talk) 18:23, 1 October 2013 (UTC)[reply]
  Resolved
....and among those pages Google found there is a Wikipedia article Dot matrix printing, which describes the solution principle in the one but last paragraph of the Design section. --CiaPan (talk) 08:15, 3 October 2013 (UTC)[reply]
That's because the OP (Heron) updated the page with the information they found through posting their query here. See here. 220 of Borg 13:35, 3 October 2013 (UTC)[reply]