Jump to content

Wikipedia:Reference desk/Archives/Computing/2010 September 15

From Wikipedia, the free encyclopedia
Computing desk
< September 14 << Aug | September | Oct >> September 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.


September 15

[edit]

pine

[edit]

When I'm in pine and try to save an attachment, it saves it to the home directory rather than to the current working directory. That strikes me as disrespectful to the user.

Can I alter the .pinerc file to change this? And why was it set up that way in the first place? Unix has such a thing as a current working directory. Michael Hardy (talk) 01:56, 15 September 2010 (UTC)[reply]

http://www.washington.edu/pine/tech-notes/config.html#use-current-dir --Sean 14:50, 15 September 2010 (UTC)[reply]

Thank you. I'm not sure how this is used in the .pinerc file (if that's where it should be). Apparently just inserting

use-current-dir

as a line in the .pinerc file doesn't do it. Michael Hardy (talk) 19:58, 15 September 2010 (UTC)[reply]

Try:
use-current-dir=yes
or maybe:
use-current-dir="yes"
I haven't used Pine since Bush the Elder was in office. :) --Sean 21:34, 15 September 2010 (UTC)[reply]
Well, then you should know that most new "pine" is actually Alpine (e-mail client). There was a some kind of a of a trademark or license-fight with University of Washington; an entirely new project was started by the original developers to create brand new source-code under the Apache License [1]. (Officially, "Alternatively Licensed Program for Internet News and Email", but commonly "Apache-licensed..."). Many users now incorrectly refer to "alpine" as "pine" because the user-interface is essentially identical, but there are a few differences, in addition to this backstory. Nimur (talk) 08:27, 16 September 2010 (UTC)[reply]
WP:LAME has always been with us, apparently. This story explains why typing "pine" at an Ubuntu shell didn't prompt me to install it; I see that typing "alpine" does. I'm a Claws Mail man now, anyway. --Sean 17:11, 16 September 2010 (UTC)[reply]

blogspot/blogger visual verification (captcha) unreadable

[edit]

I wonder how I can possibly post a comment on a blogspot blog when I cannot see the visual verification image. I can see the text "Comment moderation has been enabled. All comments must be approved by the blog author. Visual verification Word Verification" followed by a box to enter the word, plus a little image of a person in a wheelchair followed by the text "Type the characters you see in the picture above." There never is an image with words. The words "visual verification" I can right click and select "view image"; but that loads a new page with "Not Found Error 404". The little wheelchair image is clickable too but nothing, no sound. I normally use Firefox, but the exact same problems in Chrome and IE when I tried them. I have Windosw Vista. Anything else I can try? I know this must be possible because other people are posting comments all the time. 70.31.56.23 (talk) 08:51, 15 September 2010 (UTC)[reply]

It may be a temporary server error. If you've seen comments that seem to have been posted while you're still having problems, it could be a problem with your ISP. It would be helpful if you post this blog address Nil Einne (talk) 18:10, 15 September 2010 (UTC)[reply]
It happens with any blogspot blog. For example http://frogandtoadarestillfriends.blogspot.com/ or http://www.nagonthelake.blogspot.com/ or http://autisminnb.blogspot.com/. And it's been happening for weeks so I don't think it could be a temporary error. If is is an ISP what do I need to do? Thanks. 70.31.56.23 (talk) 23:35, 15 September 2010 (UTC)[reply]
Are you using an extension in your browser like AdBlock? —Preceding unsigned comment added by JV Smithy (talkcontribs) 23:37, 15 September 2010 (UTC)[reply]
I don't know - how would I find out? (I looked in all the menus but did not see "extension" (currently in firefox, but I can't see the captcha in chrome or IE either). 70.31.56.23 (talk) 00:03, 16 September 2010 (UTC)[reply]

Translation request

[edit]

Hi guys! Can you please convert the code in this page [2] to visual basic? It's only about 7 or 8 lines. I'm using VBA in Excel 2003. Thanks very much! --Mudupie (talk) 11:13, 15 September 2010 (UTC)[reply]

My VB is long out of date, so this is approximate, but it's something like
Begin Function PoissonRandomNumber(double lambda) As Integer
  Dim k As Integer
  Dim p As Double,el As Double,sum As Double
  p=Rnd
  el=Exp(-lambda)
  sum=el
  If sum<p Then
    For k=1 To 1000
      el=el*lambda/k
      sum=sum+el
      If sum>=p Then Exit For
    Next
  End If
  PoissonRandomNumber=k
End Function
Hope that helps. --Tardis (talk) 14:06, 15 September 2010 (UTC)[reply]
Note: the original code uses two variables with the name p, one upper case, one lower case. Tardis has changed the upper case p to "el". (The difference between the two p's is hard to see in some fonts, so I decided to add this note.) 93.95.251.162 (talk) 14:15, 15 September 2010 (UTC) Martin.[reply]
Thanks guys! --Mudupie (talk) 17:19, 15 September 2010 (UTC)[reply]
You might also consider using the algorithm described in Poisson distribution#Generating Poisson-distributed random variables instead.—Emil J. 14:27, 15 September 2010 (UTC)[reply]
I am currently using that algorithm but it doesn't work when lambda is large (around 750) for some reason. It works fine for smaller values but the computer just hangs for large values. --Mudupie (talk) 17:19, 15 September 2010 (UTC)[reply]
That is because e-750 is very small. So, it will take a very long time to repeatedly reduce P until it is less than L, assuming that you aren't getting a rounding error that is setting e-750=0. -- kainaw 19:22, 15 September 2010 (UTC)[reply]
Actually I tried it and it works for 740 and 745 - for those two it runs quite smoothly. But when I try 749, Excel just hangs until I hit ctrl+break. So that rounding error might be what this is. I declared the variable as a "double" in VB. Is there a workaround for this? Thanks. --Mudupie (talk) 20:17, 15 September 2010 (UTC)[reply]
It's not exactly rounding error; it's just that is outside the range of double precision arithmetic. You could fix that here (at some cost in speed) by doing your multiplication in log space: initialize el=1 instead and write sum=sum+Exp(Log(el)-lambda). --Tardis (talk) 21:12, 15 September 2010 (UTC)[reply]
To be more specific, the smallest positive IEEE double-precision floating-point number is 2−1074, and e–745 ≈ 0.57 × 2−1074, which rounds up to 2−1074, but e–746 ≈ 0.21 × 2−1074, which rounds down to 0. -- BenRG (talk) 01:54, 16 September 2010 (UTC)[reply]


Thanks everyone! I'm using Tardis's "log-space" idea (but I had to manually adjust for the case where Rnd() returns zero). Here is my code and it seems to be working:
Public Function RandomPoisson(lambda As Double) As Long

' Generate and return a random Poisson variable with mean lambda
' Generates smallest n s.t. x1*x2*...*xn < exp(-lambda)

' Uses log-scale to avoid exp(-746) rounding to zero
' Manually handles instance where Rnd() returns zero

Dim Value As Double
Dim Prod As Double
Dim myRand As Double

Value = (-lambda)               ' -lambda = log(exp(-lambda))
Prod = 0                        ' 0 = log1
RandomPoisson = 0

Do Until (Prod < Value)
    RandomPoisson = RandomPoisson + 1
    myRand = Rnd()
    If myRand = 0 Then
        GoTo Line1:
    Else:
        Prod = Prod + Log(myRand)
    End If
Loop
Line1:
RandomPoisson = RandomPoisson - 1
End Function
It does take quite long to run though. --Mudupie (talk) 12:03, 16 September 2010 (UTC)[reply]
You can use Exit Do to avoid the goto, and write the whole conditional as one line: If myRand=0 Then Exit Do. If it's too slow, see the references in the article (or at least use the one from Everything2, since it involves drawing only one random number). I think it's interesting, though, how clearly this version expresses the concept that you're counting the occurrences of an exponential process: each -Log(myRand) is exponentially distributed. --Tardis (talk) 15:01, 16 September 2010 (UTC)[reply]

'E' for signal on iPhone

[edit]

When in normal use, I see 3G in the upper left hand corner, and when I'm at home, I see the WiFi symbol since my phone has the pass phrase to my wireless network. But when I go into settings and turn on call forwarding, I see the little icon of a phone handle with an arrow on it and also where the 3G or WiFi symbol used to appear, I see 'E.' What does the 'E' stand for? Thanks. 20.137.18.50 (talk) 12:45, 15 September 2010 (UTC)[reply]

Is it a phone handset with a little arrow inside it? See the call forward icon info here.
If it is in the network connection area, you are probably seeing the little blue E that means you are connected to the Edge network. -- kainaw 13:02, 15 September 2010 (UTC)[reply]
I can confirm, kainaw is exactly right. It's the At&T Edge network. It probably means you're outside of a major metropolitan area. Shadowjams (talk) 06:12, 17 September 2010 (UTC)[reply]

os installation

[edit]

i would like to install win 7 , xp , vista and ubundu in my system,,then tell me which order i had do this? and how to create a multi-bootable os disc , which shoud have an menu which help to choose the oss which i wand to install? —Preceding unsigned comment added by 117.204.95.8 (talk) 13:35, 15 September 2010 (UTC)[reply]

I'd either:
  • install Windows 7, with XP in a virtual machine, and Ubuntu in another virtual machine
  • install Windows 7 on one disk, with XP in a virtual machine, and Ubuntu on another, physically distinct disk
That's because a) I don't see the point of installing Vista (unless you're a developer and you need to be absolutely sure that things will work okay on Vista, in which case a virtual machine inside Windows 7 is easier than yet another boot option); and b) I think dual-booting, and particularly dual-partitioning, is very rarely a wise idea (and this desk gets lots of people querying how to get themselves out of problems they've created by complex multi-boot scenarios). -- Finlay McWalterTalk 14:51, 15 September 2010 (UTC)[reply]
Dug this up. Worked like a charm for me back then. I especially stress the partitioning beforehand part. HTH a bit. --Ouro (blah blah) 20:17, 15 September 2010 (UTC)[reply]
I second the virtual machine solution. I use VMware player which is free. Once you realize how easy it is, you'll never go back to dual boot. Unless you are short on resources I suppose or there's some other very specific reason why a VM doesn't cut it, but I've never come across such a reason. Vespine (talk) 00:02, 16 September 2010 (UTC)[reply]
By now you should have received enough warnings that this is an easy way to shoot yourself in the foot, so I won't add another warning.
What I would suggest, if you really want to go the multi-boot route, is that you create several partitions as described above and after each install, hide the peartition of the installed OS (by setting the partition type from 07 = NTFS to 17 = hidden NTFS), until you're done with all the Windows installs and are ready to install Linux - at that point, un-hide all the partitions and install Linux. When Linux installs its boot manager, it should pick up the windows installations and add boot entries for it.
For increased safety, you can add the hide/unhide options to the appropriate entries in the boot manager's configuration file (this is assuming that your boot manager is GRUB). -- 78.43.71.155 (talk) 19:07, 16 September 2010 (UTC)[reply]
PS: If you're doing this for web design reasons, Microsoft provides free downloads of virtual machines with Internet Explorer installed - just enter "Internet Explorer Application Compatibility VPC Image" into your favorite search engine.

Display or download

[edit]

If I visit a link like example.com/123.jpg the image is usually displayed in the browser. But on some sites a jpg url will prompt the browser download window instead of displaying. There's nothing wrong with the jpg, as if I download it will display fine. So why do some links display, and others want to be downloaded? Is there a way to control this on the server side? 82.44.55.25 (talk) 16:39, 15 September 2010 (UTC)[reply]

Sometimes this can happen if a server has its MIME types set incorrectly. APL (talk) 17:32, 15 September 2010 (UTC)[reply]
This is almost certainly the problem. --Sean 21:38, 15 September 2010 (UTC)[reply]
Most commonly, the server is either not sending an HTTP content-type line, or its sending it as application/octet-stream. Some browsers respond to this by performing content sniffing, which mostly explains why the owner of the server isn't aware (in his own tests) that the JPGs don't necessarily work for everyone (as content sniffing is sometimes a dicey, non-standard, heuristic process). If this is the case (we can't know for sure unless you tell us the specific page and JPG in question) then the server admin should fix the server configuration. A particularly common error is for the server config to be case sensitive, and it's set to send image/jpeg when sending a .jpg file, but it's encountered a .JPG file, which it doesn't know about, so it falls back to the mostly meaningless application/octet-stream. -- Finlay McWalterTalk 22:04, 15 September 2010 (UTC)[reply]
Servers can send a Content-Disposition: attachment header to instruct the browser to treat a document as an attachment (the default is Content-Disposition: inline). (Most?) modern browsers respond to this by prompting to save the file to disk, as though it had an unsupported MIME type. But most of the time when this happens it's because the MIME type is wrong, as already mentioned. -- BenRG (talk) 01:27, 16 September 2010 (UTC)[reply]