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

= April 22 =

Pentax sensor cleaning and battery
My Pentax K-x DSLR has a menu option for sensor cleaning, where it raises the shutter so you can clean the sensor. But it will refuse to do this if there is "not enough battery", which it seems to generally define as about 2/3 or less. I'm curious, why does it take so much battery to open the mirror and keep it there when it can open and close it 1000 times (plus process the images captured) on the remaining battery life? -mattbuck (Talk) 02:55, 22 April 2013 (UTC)


 * It rather sounds like a spring holds it closed, and it must constantly use energy to hold it open, against the spring. Not a problem when it's only open a fraction of a second, but holding it open for several minutes might drain the battery. StuRat (talk) 04:47, 22 April 2013 (UTC)


 * I worked whit the kx once (or the kr)… and don’t remember ever had this problem
 * Is your battery retaining the charge normally?
 * Other thing… don’t remember very well, but I think it not only opens the mirror, it has to shake the sensor too
 * Iskánder Vigoa Pérez (talk) 17:27, 22 April 2013 (UTC)

FORTRAN read statement
I wrote a program where you navigate a maze. I use the numeric keypad for movements. Unfortunately, after hitting a direction key, you must also hit  to pass that input to the program and actually move. So:

1) Is there a way to get FORTRAN to work without requiring the  key for each read statement ? (Any version of Fortran will do.)

2) Is there a way to redefine the keystrokes so that, for example, Numeric Keypad 8 = 8 +  ? (This is at the Command Prompt for Windows 7.) StuRat (talk) 04:58, 22 April 2013 (UTC)


 * to 1) Compaq Visual Fortran (you did say "any version of Fortran") had GETCHARQQ. See (or google the command). Not fluent in Fortran, but if you want to avoid waiting for an Enter key, watching some kind of input queue would be the most logical approach. Also this thread  contains some useful hints. GermanJoe (talk) 11:49, 22 April 2013 (UTC)


 * Thanks, but your first link is in German. Let me also ask about a 3rd alternative:

3) Is there some type of keylogger program which will add each keystroke to a file, and then close the file, as it's pressed, so my program could read it from the file ? Or, how about adding it to an environment variable ? StuRat (talk) 16:58, 22 April 2013 (UTC)


 * I would perhaps try to call 'getc' from the standard C library. Calling non-native functions could certainly be done under VMS, but I'm unsure about other environments.  Failing that, you are perhaps looking at directly interacting with your hardware.  Astronaut (talk) 19:29, 22 April 2013 (UTC)


 * Well, I do have a C compiler (gcc). So you're saying I should write a C program which will call getc and return a single character to the calling program (which will be my FORTRAN program, in this case) ? StuRat (talk) 21:19, 22 April 2013 (UTC)


 * I just tried this in C, and the program I wrote also waited for me to hit enter there. Does someone want to provide me a bit of C which doesn't wait for the enter key ? (I figured this part out.) StuRat (talk) 21:44, 22 April 2013 (UTC)

on Linux, you can do stty -icanon which will turn off "canonical mode" for the terminal which will make it return single chars without waiting for a newline (getchar will return upon pressing any key, not just Enter). in Windows, I think you could call SetConsoleMode to reset the ENABLE_LINE_INPUT flag (probably from a C wrapper program.) If it's in Windows I think the language's runtime ultimately calls ReadFile or ReadConsole, which are the functions the console mode affects. If however it's the runtime, not the OS, that waits for a new line (kind of like calling fgets instead of getchar in C), then I don't know. Regards Asmrulz (talk) 21:52, 22 April 2013 (UTC)

Are you using Cygwin? Cygwin does emulate a UNIX-like API, so may be it has the terminal i/o stuff as well. I found this: this (second answer from top) (or you can just do system("/usr/bin/stty -icanon"); and then exec your program (all in Cygwin's shell)) Asmrulz (talk) 22:14, 22 April 2013 (UTC)


 * Another approach in Windows might possibly be to use the GetAsyncKeyState function, and check the relevant keys explicitly. The snag with that is that the key presses would still register as input, and eventually fill the buffer. AndyTheGrump (talk) 22:13, 22 April 2013 (UTC)
 * and you can't easily pass the keypresses so read to the child process. the idea was to just set the console mode and call the other program Asmrulz (talk) 22:29, 22 April 2013 (UTC)

I have my solution. I followed the suggestion to use C. Here's the C code, named "getch.c":


 * 1) include 

int main {     char keystroke; FILE *file; file = fopen("keystroke.txt","w"); keystroke = getch; fprintf(file,"%c\n",keystroke); fclose(file); return (0); }

And here are the relevant bits from my FORTRAN program which calls it: character*1 KEYSTROKE .             .              .      call SYSTEM("getch.exe"  ) open (unit=10,file="keystroke.txt",action='READ') read (10,*) KEYSTROKE close (10)

Thanks, everyone ! StuRat (talk) 23:10, 22 April 2013 (UTC)

Can't you eliminate the file altogether though?

"getch.c":

int main {     return (int) getch; } FORTRAN:
 * 1) include 

INT KEYSTROKE .             .              .      KEYSTROKE = SYSTEM("getch.exe"  )

(I've not programmed in FORTRAN, I'm not sure of the syntax of the last bit). AndyTheGrump (talk) 02:21, 23 April 2013 (UTC)


 * I doubt if it's that simple. FORTRAN and C have a number of incompatibilities, as I recall, such as passing addresses, versus pointers, versus values.  Using a file insulates them from having to communicate directly.  StuRat (talk) 02:35, 23 April 2013 (UTC)


 * AndyTheGrump's solution should work. He is creating a C program that returns the character as an Exit status. When executing the file from FORTRAN, he checks the exit status. The C code is still being executed as a stand-alone executable, this solution just eliminates a bunch of file reading and writing.


 * However, most compilers allow you to specify a calling convention at a per-function or per-file level. You have a solution that works for you, but it could be an interesting learning experience to figure out how to make the two languages speak to each other. You should be able to build an object file from your FORTRAN source and one from your C source, and then use the linker to create your final executable. 38.111.64.107 (talk) 12:50, 23 April 2013 (UTC)

Help with Mozilla Thunderbird
For the past week or two, the calendar function of my Mozilla Thunderbird (running under Windows 7) hasn't been working. Every time I open Thunderbird I get the error message: "An error was encountered preparing the calendar located at moz-storage-calendar:// for use. It will not be available." The error code it provides is 0x80570015. Any ideas how I can fix this? I've considered simply reinstalling Thunderbird, but I'm worried if I do that I'll lose all the e-mails currently in my inbox. Can anyone plausibly reassure me that that won't happen if I reinstall? Thanks. Angr (talk) 07:36, 22 April 2013 (UTC)


 * If you want to avoid the risk of your emails being destroyed (by a reinstall or anything else) you should regularly be backing up the Thunderbird profile folder. The location of that varies between Windows versions - it's explained at here. Your error sounds like there's a corruption in one of the SQLite database files used to store the calendar info. Deleting the specific calendar file will probably force Lightning to rebuilt it - but obviously that will wipe your calendar out too. You'd probably be better describing this error on the specific support forum, as listed at the Mozilla Calendar FAQ, where people will be familiar with the specifics and hopefully will have a less nuclear solution for you. -- Finlay McWalterჷTalk 14:58, 22 April 2013 (UTC)
 * Thanks for your help! I wound up simply uninstalling the Lightning add-on and then reinstalling it, and now it works again. It even remembered my old appointments. I did also back up my profile too, just to be on the safe side. Angr (talk) 20:44, 22 April 2013 (UTC)

Difference between two LCD panels
What exactly is the difference between the LG IPS277L and the LG 27EA73LM-P? One difference is that the latter has integrated speakers. Is that the only difference? Is it the same panel, or is there any difference in image quality? --Andreas Rejbrand (talk) 11:20, 22 April 2013 (UTC)


 * It seems that the s277l has an IPS panel an dthe 27ea73 has a VA one. Both have a very high price for just a 1080p monitor
 * and this Dell is beautiful http://www.amazon.com/Dell-927M9-IPS-LED-27-Inch-LED-lit-Monitor/dp/B009H0XQPA/ref=sr_1_1?ie=UTF8&qid=1362155424&sr=8-1&keywords=Dell+S2740L+927M9-IPS-LED+27-Inch+Screen
 * Iskánder Vigoa Pérez (talk) 17:38, 22 April 2013 (UTC)


 * Thank you for your input. Is there any information, or qualified guess, as to which panel has the highest image quality? As for resolution, I certainly do not need more than 1080p in this case. Maybe high price simply means high quality? --Andreas Rejbrand (talk) 19:31, 22 April 2013 (UTC)


 * Since the links you provided are to a Swedish site, I presume you live in and intend to buy the monitors in Sweden. That being the case, links to US prices are likely fairly useless for price comparisons purposes. Nil Einne (talk) 01:01, 24 April 2013 (UTC)


 * You are very correct, Nil Einne. Still, I don't really care about the price; I'm more interested in image quality and other aspects of the quality of the products. --Andreas Rejbrand (talk) 10:37, 24 April 2013 (UTC)
 * Understood. But another part of my point is more that the that I'm not sure if the LG monitors you mention are really more expensive then the Dell one. In other words, there's no reason to think they're particularly expensive compared to the Dell one. Perhaps they are where Iskánder Vigoa Pérez lives which I don't think is the US or perhaps they are in the US, but there's no guarantee they are elsewhere as local price depends on a lot of factors so not every monitor has the same relative price. This is one of the reasons you can't really say much about the LG's perhaps being better because of the possibly higher price. Another somewhat related reason is that while there is some correlation between price and quality, there are a whole host of other factors including some which I presume you don't care about like brand name and others which you may not care about like connection options, scaling options, webcam, speakers etc which affect the price.
 * BTW, while I don't think you're likely to get much help here as direct product comparisons and recommendations isn't something the RD tends to be good at, but you'll likely need more info if you want decent recommendations. For example you say you definitely don't need more than 1080p. Does this mean you only want to use the monitor to watch movies, TV, videos etc? Or are you planning to use the monitor at a distance? These sort of use cases may affect the recommendations. I ask because many people consider 1080p a fairly low resolution (low pixel density) for a 27" monitor, 2560x1440 is considered a better resolution, particularly for productivity work and browsing. For gaming, it's a bit more iffy, 2560 would be ideal but may require a good graphics card or quite low settings. But then again, if you can't normally even achieve 1080p, then 2560x1440 isn't generally going to be worse (unless perhaps you always run at 960x540) and could be better in some cases. Of course if you just don't want above 1080p because you don't have dual link DVI or DisplayPort or a suitable HDMI port then that's a different consideration. (Another issue would be price, but you seem to suggest price wasn't a big factor. Of course in that case you could take a risk on one of those South Korean LCD monitors everyone is talking about like Catleap etc.)
 * Unfortunately I don't know how much luck you'll have with comparisons. In my recent searches for 23"-24" monitors, I didn't find much. Many of the reviews aren't direct comparisons making it difficult to draw useful data. For example they say this monitor is about average or isn't as good as some other reviewed product but it's often quite unclear what they're comparing them to. On the other hand, I was looking at the lower end of the IPS market, so perhaps you'll have more luck (although I think the 1080p is somewhat the lower end of the 27" market).
 * BTW, VA, particularly AMVA will often have better (real, not dynamic) contrast ratios and better blacks, than an IPS. But IPS will win out in side to side viewing angles, and possibly in response times (but this depends greatly on the panel and how over-driven it is). VA panels I believe were somewhat dead for a year or two, they seem to have come back partially because of their usage in TVs (again the contrast ratios are probably a big factor here). There are more difference and you can find more comparisons online, and it depends greatly on the panel. For starters, IPS is a loose term as there are a few types of IPS in common use (I'm including S-PLS). With VA I'm not sure if SMVA or PMVA or whatever are common in monitors anymore, all I've seen is AMVA and that seems fairly rare compared to IPS and TN. (There's also the various PVAs but while these are still common in large TVs I don't know if they're found much at all in present model smaller monitors, well excluding extremely high end professional ones like say the Eizo.) But anyway I don't think there's much point elaborating further since I don't believe the panel is VA, e.g. [http://pcmonitors.info/lg/lg-27ea73lm-1920-x-1080-ips-monitor says it's AH-IPS).
 * Presuming you can't get much of reviews, you may want to produce a narrow list of what seems most suitable for you, check out the brands and individual monitor warranty and dead pixel (if that matters to you) policies for your country, look at the official specs with an eye to the often misleading data, and then ask for opinions in more suitable forums. If you can find VA you like, you may want to consider it, particularly if watching videos etc is a big part of what you are planning.
 * Nil Einne (talk) 16:52, 25 April 2013 (UTC)


 * Thank you for you reply. In fact, I intend to purchase a unit as a gift to a (younger) relative, and it will mainly be used to watch movies (probably mostly standard-definition DVB-T television) from a distance of slightly less than two metres. Hence, there is really no need for more than 1920×1080. My understanding, too, is that both panels are AH-IPS (at least that's stated in my original two links). I believe any of them will do just fine, but I don't know how to choose. Maybe I'll just flip a coin. --Andreas Rejbrand (talk) 19:25, 25 April 2013 (UTC)

programming using qbasic
what is the effect of the following when using the print statement(give an example of a code to support your answer) 1. if you type PRINT without any variable,or text after it? 2.if text you wnt is to be printed 3.if you want values of the variable to be printed accompanied by text . — Preceding unsigned comment added by 41.223.142.34 (talk) 15:45, 22 April 2013 (UTC)


 * The example program in our QBasic article will help you answer two of these questions, and the resources linked from that article will probably answer the third question. Gandalf61 (talk) 15:53, 22 April 2013 (UTC)


 * StuRat (talk) 16:50, 22 April 2013 (UTC)

How do I get rid of this political spam in my e-mail inbox?
I have no idea how long this has been going on or when did this begin occurring, but I do know that the Democratic Party somehow knows my e-mail address and has been sending me spam about Barack Obama and stuff like that. I tried to e-mail them during the re-election campaign about the problem. They never replied, and they never stopped. So, I created a filter in my Outlook Web App inbox. That only raised one problem. All the messages go to my junk folder. I want to know how can I create a filter to automatically delete these messages. They are annoying and also a reason why I am apolitical. Plus, my Outlook Web App inbox is really my academic e-mail inbox for academic/professional purposes. If they had sent me spam through my AOL account, then I wouldn't mind, because I rarely check it. Sneazy (talk) 18:12, 22 April 2013 (UTC)


 * I'm not sure what options Outlook has for blocking spam, but here are some common ones:


 * 1) A blacklist. This blocks any mail coming from a particular address.  If they always come from the same set of addresses, then this is ideal, as it shouldn't block anything you want.


 * 2) A whitelist. This only allows emails in from a list of addresses you provide.  This is far more likely to block good emails, as it's difficult to list every address from which you may ever receive a legit email.


 * 3) Searching for keywords in the title or content, and blocking emails which have those. For example, you could have "Democratic" or "Obama".  This might also block legit emails, though, since those terms might occasionally show up in them: "I can't finish my report right now, since I have to fill out some Obamacare health insurance forms." StuRat (talk) 19:12, 22 April 2013 (UTC)


 * Double-check that there isn't some sort of unsubscribe link or instructions at the end of the message. Most legitimate mailing lists will make it easy to unsubscribe, but simply replying to the email and asking to be removed might not be the right procedure. 38.111.64.107 (talk) 12:40, 23 April 2013 (UTC)

silly computer science question
is there something like "lambda assembly"? I mean, lambda calculus is "but" a model of computation as are the register machine and the stack machine, and compilers produce code for the latter two. If there were a computer that ran LISP or something, natively, the way a PC runs x86 assembly, what would its machine language look like and could one make a C compiler that compiled to it and what would its output look like (as opposed to "ordinary" assembly)?

C : register machine : x86 assembly

Java : stack machine(?) : JVM assembly

LISP: lambda machine(?) : ?

Sorry if the question's confused:) Asmrulz (talk) 21:01, 22 April 2013 (UTC)


 * Graph reduction machine, for which the "assembly language" is a combinator graph. Lisp machines were actually sold commercially, but I'm not sure that's quite what you're looking for since most dialects of LISP are thoroughly imperative. -- BenRG 21:42, 22 April 2013 (UTC)
 * Thanks! It's a bit clearer now. An article linked from that article's page was interesting, too Asmrulz (talk) 23:48, 22 April 2013 (UTC)

Academic research document papers contains mistakes
I thought Academic research documented paper is the most reliable sources. There is four authors who published the abstract research documents are they all reliable predictions or each one have error bars in there. There are four main authors who presented the calculations of death of the solar system  Rasio et al. (1996) and. is this possible some of their works to calculate the inner planet's fate can contain lots of mistakes. Do some of these guys likely to make alot of mistakes in their calculation or the best answer is all of everybody including Schroder and Smith's calculations contains some mistake lines. I thought they use computer simulations and solar model to make the calculations. Is this possible computer simulations can produce alot of mistakes or more mistakes than accuracies. Basically what do astronomers put in the computer simulations? After primary sources publish out do people criticise the authors may make some mistakes in their calculations and when editors creates the website, they tend to correct the authors who wrote the primary sources? Is secondary sources mostly summarizes the primary source?--69.226.42.116 (talk) 23:48, 22 April 2013 (UTC)


 * Yes, many research papers contain mistakes. If they make a dramatic claim, like the existence of cold fusion, you can bet others will check their work.  On the other hand, if they make a claim nobody cares about, then it may very well go unchecked. StuRat (talk) 01:09, 23 April 2013 (UTC)


 * If you have a group of papers that make predictions and they arrive at different results, the likely explanation is that the predictions are based on different assumptions. There is almost never enough information available to make perfect predictions, so the only way to do it is to make guesses about the information that is missing.  Different people make different guesses.  As long as the authors are careful to explain the assumptions they have made, there is nothing wrong about that approach.  This is how science works. Looie496 (talk) 02:02, 23 April 2013 (UTC)


 * So, basically research paper documents and computer documents basically involves speculations and alot of uncertainty. Is this the same things happening for years. Editors and websites will just check their work and correct what their work according to what they think is right. Do computer simulations involve alot of mistakes? I thought computer simulations looks accurate that is why I thought they don't have that much error bar.--69.233.255.83 (talk) 02:09, 23 April 2013 (UTC)


 * Ever heard the phrase "garbage in, garbage out" ? That means the results of the simulation are based on whatever data and assumptions they supplied to the program.  For example, if you use a calculator to do some math, you can still make mistakes by entering the wrong numbers, forgetting the decimal point, hitting the wrong buttons, or using it improperly (say taking the hyperbolic cosine when you wanted the regular cosine or log e when you wanted log 10).  In most cases, the calculator won't tell you you made a mistake (with a few exceptions, like if you try to divide by zero).  StuRat (talk) 02:45, 23 April 2013 (UTC)


 * Let me try to give a clearer answer. "Mistake" is the wrong word.  Think about weather prediction.  If the weather report predicts a 90% chance of rain tomorrow, and it doesn't rain, do you say that it made a mistake?  No -- weather reports are made using imperfect models, and the data that goes into them is imperfect.  Therefore the predictions are imperfect.  The same thing happens in every type of science.  The requirement for a scientific paper is to accurately report on how the results were obtained.  There cannot be a requirement that the results be perfect, or nobody would be able to do any science at all. Looie496 (talk) 04:29, 23 April 2013 (UTC)


 * Maybe mistake was a wrong word of choice, but "error" sounds better. So every scientific papers have some threads of errors, could be they neglect an important variables. So every scientific paper will only tell me some accuracies, some speculation guesses will contain some errors.--69.233.255.83 (talk) 05:17, 23 April 2013 (UTC)


 * Sure, but this shouldn't be surprising. **Every** detailed and complex document likely contains threads of errors.  No one suggests that the scientific method always reaches the right conclusions, but it's been dramatically helpful to learn more things about our universe, and much better than our other methods of learning things. Chris M. (talk) 12:57, 23 April 2013 (UTC)


 * This still doesn't quite hit the mark. Think again about weather prediction.  When I try to predict the weather, I use a computer simulation of the atmosphere, and feed it data from measuring stations.  But my simulation is only a crude approximation of the real atmosphere, and I only have data from a few places, so my predictions are often wrong.  That doesn't mean I made a mistake or an error, it only means that my prediction method is imperfect.  It is certainly possible for me to make mistakes, for example if I make a programming error in writing my simulation program.  But incorrect predictions are usually not the result of mistakes, they are usually the result of imperfect models and limited data. Looie496 (talk) 16:18, 23 April 2013 (UTC)


 * Each prediction will have an interval of confidence. A weather report won't be right in more that 95% of all the time. If your model fails to deliver (that means, you predict 90% of rain, but are wrong most of the time), you'll need to find a better model. That's not a mistake, you just keep improving your imperfect model, basically forever. Are the mistakes that you found in the study in this direction? Are they a restriction of possibilities towards the right answer? Or are they cherry picking, typos, excel error or the like? OsmanRF34 (talk) 15:21, 23 April 2013 (UTC)


 * Looie496, you used the weak analogy, I live in Los Angeles, I sometimes look up weather forecast when I hear threats of rain, when the weather forecast on TV said 80-90% of showers, it always rains, the weather forecast never bullshits, every-time when I get 70-80% of showers it always rains in Los Angeles.


 * You are lucky that LA lies in a region with predictable weather. Where I live, the weather forecast is often wrong, but when it is wrong here, it can be correct for a place just a few miles away.  Weather here just isn't predictable with more than 60% accuracy.  (To be fair, they did get it right for today, except that the showers are hail, not rain.)    D b f i r s   09:14, 26 April 2013 (UTC)


 * Note in addition in the cases our anon IP mentioned, the weather forecast appears to be wrong. If they are giving predictions of 70-80% chance of showers but there every time there is rain, then this is also wrong. They should be giving 100% chance of showers. Nil Einne (talk) 06:06, 7 May 2013 (UTC)


 * I try to predict when will City of Irvine remodel the traffic light bulb by just see what happened in the history. I try to go according to what the City Department e-mailed me. But 92612 remodeled the three-colored traffic bulbs 5 month earlier than what the City Department e-mailed me. Now I try to predict 92604 and 92606, they will do it July 2013 I guess because 92618 done it in May 2012, 92612 done it in December 2012, that is based on what the data we had. Can I try to guess by using the computer simulation to figure out 92614 and 92620 if I want to. I know for sure 92618 will have a repeat of TL vehicle relamping in 2016-2017 fiscal year. I try to predict Central Orange County like Westminster, Garden Grove, Tustin, all of these sister cities when will they remodel yellow lights according to the history of yellow traffic light relamping in South Orange County's history. All I can tell myself if nobody knows, I can just write on paper 2016(????)2017(????)2018(????)2019(????) maybe one these cities, or some of these cities, maybe all of it or none of these cities. Can I myself use computer simulation to do it. I thought only scientist can use computer simulation to predict futures. I don't think any ordinary person can use computer simulation, since traffic lights fascinates me alot, I don't think I can use computer simulation to predict the changes of traffic lights.--69.233.255.83 (talk) 01:11, 24 April 2013 (UTC)
 * Anyone can make such simulations provided they have the necessary training and knowledge of the subject, and enough programming skill to create the computer model. That's the hard part: for example, if you aren't trained in weather science, you're unlikely to make a good weather simulation. You'd also need one hell of a fast computer. Other systems are much easier to understand and program for and don't require nearly as much computing power.
 * Traffic lights are actually a good example. Most urban traffic lights are actually computer controlled to change based on models of traffic patterns. For example, if the city planners know that westbound traffic on 4th Avenue always increases at 5 pm (people going home from work), they can set the lights on that route to prefer traffic going westbound; eastbound traffic and cross-street traffic would get longer red lights, because you want to get the high-volume traffic going west out of the way first. They can also make the system account for other things, such as a sudden closure of a street (due to an accident), and it will adjust the "best" pattern for the lights.
 * Of course, if they lose connection to the central system that monitors these things (or are just plain old street lights), they can just revert to their default settings (which may vary at different intersections, again, based on city planning and known traffic patterns). If you know these patterns, and how the city planned to respond to them, you could make a pretty good predictive model for the traffic lights. There are also systems which have pressure sensors under the asphalt, which can detect the weight of a car stopped at the intersection, and trigger the light based on that. That's getting off-subject, though...
 * I really recommend you read a book called The Signal and the Noise. The author created a model that accurately predicted both the 2008 and 2012 US Presidential and Congressional elections. Not perfectly, I think one or two Congressional seats were wrong each, but that's a damn impressive accuracy rate. He does a great job of clearly explaining how this kind of system works, and the challenges involved in making it work reliably (but never perfectly). &mdash;  The Hand That Feeds You :Bite 22:23, 24 April 2013 (UTC)