Wikipedia:Reference desk/Archives/Computing/2012 August 24

From Wikipedia, the free encyclopedia
Computing desk
< August 23 << Jul | August | Sep >> August 25 >
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.


August 24[edit]

Use Android 802.11x EAP settings on Windows[edit]

So, my school has a semi-hidden network that is secured with some form of 802.11x EAP authentication. I was able to access it on my phone using my school login credentials. However, Windows 7's wireless settings are much more complicated than Android's, and my attempts to find a similar set of settings failed. Could anyone give me any assistance in converting the settings? The settings in Android are:

  • EAP method: PEAP
  • Phase 2 authentication: None
  • CA certificate: Unspecified
  • User certificate: Unspecified
  • Anonymous identity: <blank>

--Hmmwhatsthisdo (talk) 02:49, 24 August 2012 (UTC)[reply]

web based 2D CAD[edit]

I am looking for a free web based 2D CAD

can someone help me? --78.48.225.165 (talk) 03:20, 24 August 2012 (UTC)[reply]

Can you describe what you mean by web based ? For example, do you need to collaboratively edit the CAD files with others ? Do you need to access the files from multiple computers ? If you don't need either of these abilities, why does it need to be web based ? StuRat (talk) 03:29, 24 August 2012 (UTC)[reply]
no collaboration functionality needed, on some computers you can't or don't want to install software on the local HDD, I am looking for a 2D CAD that runs out of the browser --78.48.225.165 (talk) 05:27, 24 August 2012 (UTC)[reply]
An alternative might be to put the software on a flash drive and take it with you, along with your CAD files. StuRat (talk) 05:51, 24 August 2012 (UTC)[reply]
I am looking for web based right here --78.48.225.165 (talk) 06:46, 24 August 2012 (UTC)[reply]

Moving parts[edit]

This feels like a stupid question before I even ask, but are there moving parts in modern smartphones or tablets? Mingmingla (talk) 05:23, 24 August 2012 (UTC)[reply]

This smart phone appears to have some real buttons, which do move, at least a bit: [1]. (You can make buttons that detect touch, but they are rather unsatisfying, as you want to feel it click.) Also, speakers/microphones must move a tiny bit (either to cause the air to move with sound vibrations, or as a result of those sound vibrations). StuRat (talk) 05:46, 24 August 2012 (UTC)[reply]
Also the motor that provides the vibrate functionality. --Phil Holmes (talk) 08:15, 24 August 2012 (UTC)[reply]
The iPhone also has an accelerometer and a compass, both of which presumably involve moving parts. AndrewWTaylor (talk) 08:27, 24 August 2012 (UTC)[reply]
Hmm, the "compass" is probably a magnetometer, as used in GPS systems. (It would be interesting to know for sure.)--Shantavira|feed me 08:56, 24 August 2012 (UTC)[reply]
Ah, according to this the compass uses the Hall effect, so doesn't no moving parts. AndrewWTaylor (talk) 11:08, 24 August 2012 (UTC)[reply]
A Google search quickly reveals [2] The accelerometer and compass don't have moving parts. It looks like the only things that could count are the motor, the on-off switch and debatably the microphones/speakers. --Phil Holmes (talk) 11:20, 24 August 2012 (UTC)[reply]
The accelerometer does have a moving part, although it's an utterly tiny part and it moves tiny distances. As the accelerometer article notes, a modern MEMS accelerometer is one (or several) little cantilevered bars (built with the same deposition-and-erosion technology as the chip from which they're fabricated). When the device is accelerated (either by moving it, or just by gravity) the little beam flexes (that is, it moves, a tiny amount, in the free space left around it). Measuring this torsion in MEMS accelerometers is implemented either using piezoresistance (the resistance of the bar changes slightly as it's deformed) or capacitively (the moving bar forms one plate of a capacitor, the fixed substrate beneath it the other - tiny movements of the bar change the distance between them, and thus the capacitance of the circuit they form). All of this is quite invisible, as the MEMS device is sealed in the usual plastic or ceramic package for integrated circuits - it just looks like a little chip on your circuit board. But it does rely on that one little thing moving, just a bit. -- Finlay McWalterTalk 13:21, 24 August 2012 (UTC)[reply]
Don't forget all those moving electrons, too! :-) --Phil Holmes (talk) 15:39, 24 August 2012 (UTC)[reply]
And as it is a semiconductor device, you could consider the holes as moving as well :-)) Astronaut (talk) 17:35, 24 August 2012 (UTC)[reply]
Note that the iPhone 4, and some other phones and tablets have both a MEMS accelerometer [3] and a MEMS gyroscope [4]. It sounds like most Apple portable devices [5] and so I would guess other manufacturers use MEMS microphones as well, so I wonder if it makes sense to consider the microphone moving but not the gyroscope or accelerometer (although I don't know the relatie movement difference). Nil Einne (talk) 19:16, 24 August 2012 (UTC)[reply]

Displaying bitmaps[edit]

I'd like to be able to dynamically create bitmaps, then display them, with a program (Fortran on Win XP). My program currently does so by creating a GIF and then starting up Internet Explorer to display it. This works, but is rather slow, and, if I want to update the displayed bitmap, this involves stopping IE and restarting it with the new bitmap. I'd like to avoid this overhead by being able to update the displayed bitmap just by entering a command at the command prompt. Can this be done with IE or some other application ?

Alternatively, I'd be fine with changing the contents of the bitmap file that IE or some other app is currently displaying, but it seems likely that the bitmap file will either be locked, or the application will have made a copy for display purposes and therefore won't update to reflect the changed bitmap file. StuRat (talk) 10:25, 24 August 2012 (UTC)[reply]

Don't use IE to display images like that — you'll run into caching issues. What you want is a dedicated but lightweight image viewer, something like IrfanView. A more rigorous approach would be to use something like ImageMagick, which can let you edit the image and display it using only command line tooks, and anything else you'd want to do. But I presume you know about this already and are avoiding it for one reason or another. --Mr.98 (talk) 11:53, 24 August 2012 (UTC)[reply]
ImageMagick's display program expects an X server, so while it does work on Windows, it's not commonly useful there. -- Finlay McWalterTalk 12:09, 24 August 2012 (UTC)[reply]
Surely there's a way to adapt it for Windows, though? It seems worth investigating for the kind of thing that StuRat's doing — command-line image editing, updating, etc. --Mr.98 (talk) 13:09, 24 August 2012 (UTC)[reply]
display is written direct to the xlib API, so it needs an X server; adapting it to GDI+ or DirectX is essentially rewriting it. -- Finlay McWalterTalk 13:34, 24 August 2012 (UTC)[reply]
The reason I used IE is that everyone already has it. I put a timestamp in the bitmap file name to avoid having it display a cached image. StuRat (talk) 20:01, 24 August 2012 (UTC)[reply]
I presume you're referring to Windows, but you're mistaken. See Removal of Internet Explorer, [6] and [7], removing IE has been officially supported by Microsoft since Windows 7. This only really removes the .exe but that is enough to affect any program presuming it will be present. Nil Einne (talk) 17:34, 26 August 2012 (UTC)[reply]
Well, OK, nearly everybody on Windows, then. Far more than any other browser, at least. StuRat (talk) 02:06, 27 August 2012 (UTC)[reply]
I'm already using ImageMagick to convert the bitmap files, so it would be great if it could also display them, but it doesn't sound easy in Windows. StuRat (talk) 20:01, 24 August 2012 (UTC)[reply]
Can I issue a command at the command line to have IrfanViewer change the image displayed ? If so, what's the syntax ? StuRat (talk) 20:01, 24 August 2012 (UTC)[reply]
Isn't there a simple GUI library for your Fortran runtime? With a decent high-level GUI api, simply opening a window and drawing a bitmap in it is a few lines of code. At most it's a dozen or two in GDI in C, mostly because the C api is rather verbose (not because the task is hard). That may turn out to be preferable to having to popen/exec to an external program. -- Finlay McWalterTalk 13:34, 24 August 2012 (UTC)[reply]
I haven't found a GUI library (I had asked a previous Q about that here). I use GFortran, incidentally. StuRat (talk) 20:10, 24 August 2012 (UTC)[reply]
gtk-fortran, which works with gfortran on windows. I can give you the trivial gtk-python program to display an image; converting it to fortran should be simple. -- Finlay McWalterTalk 20:48, 24 August 2012 (UTC)[reply]
That link says it works in Windows 7, not Windows XP. StuRat (talk) 21:01, 24 August 2012 (UTC)[reply]
https://github.com/jerryd/gtk-fortran/wiki/Status suggests it works, for the most part, on XP. -- Finlay McWalterTalk 21:06, 24 August 2012 (UTC)[reply]
That's not my reading. They tried two tests, neither of which worked, and only one of which they were able to diagnose and fix. StuRat (talk) 22:07, 24 August 2012 (UTC)[reply]
My reading is that they ran their test suite and had two problems. One is a trivial fix that isn't related to graphics code. The other one is a crash that they didn't look further into. The crash was in a Cairo test, and you shouldn't need to use any of Cairo to implement this. 209.131.76.183 (talk) 18:48, 29 August 2012 (UTC)[reply]
It would be trivial in any .Net language - c# for instance. However, on my system (Vista), Windows Photo Gallery automatically detects changed image files and reloads them. The same is true of Windows Picture and Fax viewer on XP. FWIW these are the default programs to view PNG files.--Phil Holmes (talk) 16:33, 24 August 2012 (UTC)[reply]
I tried Windows Picture and Fax Viewer on XP. It doesn't quite do what I need. If I change the bitmap file, it doesn't update the displayed image immediately, but only if I hit the forward and then backward buttons. StuRat (talk) 20:25, 24 August 2012 (UTC)[reply]
I can vouch for doing it with .Net. I have (long ago now) written a program in c# that does exactly what you describe - dynamically create a bitmap and redisplay it on each change. Without a suitable library/framework, you are left doing all the hard work getting your program to interact with Windows. One aside, when I last worked with Fortran even longer ago, it was a pretty trivial matter to call functions written in another language so long as you understood the differences between the various calling standards (or at least it was simple on OpenVMS using their Open Fortran compiler extensions). You could write the math and bitmap creator in Fortran and then write your own API to interact with another language and framework more suited to the task of interacting with Windows. Alternativly, maybe you could write a quick and dirty bitmap viewer in something like c# and maybe have it reload the bitmap from a file when the file changes. Astronaut (talk) 17:31, 24 August 2012 (UTC)[reply]
I've coded in C and similar languages, and hate them with a passion, so would like to avoid doing any of that. StuRat (talk) 20:12, 24 August 2012 (UTC)[reply]
You could try a different way, as you're already timestamping the images apparently: use a bit of javascript to install an interval that checks whether a new file has appeared 10 times a second. the Scripting.FileSystemObject, which is available through an ActiveXObject in javascript, allows you to access the filesystem. You could set it up as a HTML Application to the permission issues you'll encounter. Unilynx (talk) 11:52, 25 August 2012 (UTC)[reply]
But once I detect that the bitmap file has changed, how do I update the display to show it ? StuRat (talk) 04:46, 26 August 2012 (UTC)[reply]
Well, you'd not have IE open the image directly, but open a HTML page with an IMG tag pointer to the image. Then it's a matter of updating the 'SRC' attribute of the image to point to the new version. Unilynx (talk) 11:27, 26 August 2012 (UTC)[reply]
I think I've just found demo code for writing a GDI program in Gfortran [8]. I found it on page five of this thread [9] (presumably a usenet thread). Careful reading of the thread may reveal useful information about compiler settings.  Card Zero  (talk) 14:46, 25 August 2012 (UTC)[reply]
OK, I was able to compile that code and get it to run, and it creates a white window with black text centered in it. I can change the text or window title. However, that's a long way from displaying a bitmap. How do I do that ? StuRat (talk) 20:39, 25 August 2012 (UTC)[reply]
You need to replace the "DrawText(hdc, message, -1, rect, 37)" with something like "SetDIBitsToDevice(hdc, 0, 0, rect.right, rect.bottom, 0, 0, 0, bitmap_height, bitmap_data, bitmap_info, DIB_RGB_COLORS)". You will probably have to add declarations for SetDIBitsToDevice and BITMAPINFO and various constants like DIB_RGB_COLORS. It would be much easier to do this in C. Those 500 lines of Fortran would be about 30 lines of C. -- BenRG (talk) 05:28, 26 August 2012 (UTC)[reply]

UPDATE: I downloaded IrfanView and got it to work by issuing the following commands at the command line (the "/one" flag tells it to only allow one instance, so it immediately closes any previous instances, and the /hide=15 option hides the menus, etc.):

i_view32 pane1.bmp /one /hide=15
i_view32 pane2.bmp /one /hide=15

This sequence displays the first bitmap, then replaces it with the second bitmap. It's not bad, but you do see a flicker when it changes images, because it redraws the entire window, not just the bitmap. Still, if we can't come up with a better solution, which will only update the image in the viewer, and not redisplay the entire viewer, this is the solution I will go with.

Also, there is the File + Reopen (Shift R) IrfanView menu option, which will reload an image interactively, but I haven't found a batch command to do so. StuRat (talk) 06:33, 26 August 2012 (UTC)[reply]

UPDATE2: I found a way to eliminate the flicker, using IrfanView, by putting the pics in the desktop wallpaper instead of a window (the /wall=0 flag centers the image on the desktop wallpaper, while the /killmesoftly flag is needed to prevent it from displaying in a window, too):

i_view32 pane1.bmp /wall=0 /killmesoftly
i_view32 pane2.bmp /wall=0 /killmesoftly

However, I'd still like a solution for displaying in a window, and updating, without flicker, if anyone can think of one. StuRat (talk) 07:52, 26 August 2012 (UTC)[reply]

UPDATE3: I tried coding both of the above approaches. The UPDATE2 approach worked fine, but the UPDATE1 case did not, as the Fortran program waited until the 1st IrfanView window was closed to continue. How do I fix this ? StuRat (talk) 02:09, 27 August 2012 (UTC)[reply]

Simple javascript[edit]

Hello everyone. I'm looking for help with Javascript. I'd like to do the following:

1) A person clicks on a button.

2) A list with different options contained in a file (let's say, example.txt) is loaded and appears on-screen.

3) The user is allowed to add his name at the end of one of the options.

4) The file example.txt is automatically updated without the user having to access example.txt directly.

Could you please show me what the best and simplest way to do this with Javascript is? Thanks a lot. Leptictidium (mt) 12:10, 24 August 2012 (UTC)[reply]

That's not as trivial as might be imagined. I guess you mean javascript in a webpage? Firstly the "file" would have to be a resource on the web server from which the web page itself - because of the javascript/browsers's "same origin policy" you can't easily open files on the client machine. So part 2 requires storing the list in some server-side system, and part 4 requires storing that again. So in essence you need a server side program (in PHP, Python, Java, node.js) to do this; javascript on the web browser can make it appear nicer, but it's fundamentally a server-side problem. -- Finlay McWalterTalk 12:23, 24 August 2012 (UTC)[reply]
What Finlay says is correct: this is rooted in a misunderstanding about what Javascript is for. Javascript is run in the browser of the user's local machine — it is "client-side" scripting — and generally prohibited from reading or writing external files for security reasons. (There are, with all things, some exceptions to this.) "Server-side" scripting, which runs on the computer that is serving up the webpage, is what modifies files (on the server) and then sends them to the user (to download, say). There's lots of interaction between client-side scripting and server-side scripting (e.g. AJAX), but this is fairly complicated stuff for someone who is new to this. The simple way to do what you want is not with Javascript, but with something like PHP, a server-side language that can take input from a browser form and add it to a file or database. --Mr.98 (talk) 13:16, 24 August 2012 (UTC)[reply]
Well, I see it's quite more complicated than I thought. Thanks anyway.Leptictidium (mt) 13:42, 24 August 2012 (UTC)[reply]
We could explain it in other languages — it would be easy to whip up a PHP script that did this — but are holding back unless you would like us to. --Mr.98 (talk) 01:36, 25 August 2012 (UTC)[reply]

Learning programming languages.[edit]

What is the best institution in North America to learn programming languages (e.g. C++, Python, Ruby, Smalltalk, etc.)? Thank you in advance. --190.19.96.181 (talk) 15:15, 24 August 2012 (UTC)[reply]

Khan Academy? Normally one wouldn't study these languages at an "institution". Typically an introductory class in computer science or some other subject, would also include some material about programming in some language. After that, you should be able to pick up other languages on your own. You can even get started from a video game. 69.228.170.132 (talk) 15:40, 24 August 2012 (UTC)[reply]
Yes, I am well aware of that as I am currently studying for a degree in web design and development. However I was thinking that a community college, a university or even a foundation either in the United States or Canada that I am not aware of would perhaps offer courses or simply training in programming languages, preferably not online. --190.19.96.181 (talk), as 190.2.41.37 (talk), 19:54, 24 August 2012 (UTC)[reply]
Well, if you need a brick and mortar class, you will want one in your area. Computer programming isn't so hard to teach that you need to cross a continent to find a decent class. Depending on the language, I'd think a community college nearby might be the best approach. StuRat (talk) 20:34, 24 August 2012 (UTC)[reply]
I understand what you mean, but are there any places that are considered to be the best at teaching programming, just like Yale, Harvard and Stanford are presumed to have the best law schools in the United States? --190.19.96.181 (talk) 02:57, 25 August 2012 (UTC)[reply]
No there is really nothing like that, at the level you're talking about. There are some extremely good programs in computer science and there are some in software engineering; but a topic like "programming in Python" is something you learn by reading the manual and practicing, maybe with some benefit from live instruction if you're a complete beginner. It's like asking what place is best for learning how to use Microsoft Word. It's just not a subject that warrants deep academic treatment. 69.228.170.132 (talk) 03:28, 25 August 2012 (UTC)[reply]
Oh ok, yes, a class at a local college or at a hackerspace might do you some good if you're just getting started. By "what is the best institution" I thought you were asking about MIT vs. Caltech or something like that. Since you are interested in web design, I'd suggest starting with PHP and Javascript. Those languages are similar under the clothes to Python and Ruby, which are on your list. I'd advise against C++ as your first language since it won't make much sense for non-experienced programmers, and will present a lot of obstacles. I'm not sure what to say about Smalltalk. 69.228.170.132 (talk) 01:48, 25 August 2012 (UTC)[reply]

Learning a computer language just for the sake of it[edit]

Is any computer language worth learning if you know upfront that you would not be working with it? For example, when it forces you to deal with some issues or to be more explicit than other languages, which might be on a higher level of abstraction? Comploose (talk) 22:14, 24 August 2012 (UTC)[reply]

In that case, why not wait and learn that abstraction in the language you will actually be using ? The only reason I can think of to start with a language you aren't likely to use is for an introduction to computer programming class, where something like BASIC can be enough for students to determine if programming is for them. StuRat (talk) 22:21, 24 August 2012 (UTC)[reply]
I get your point. But, imagine that you know that you won't be using Assembly at work, but you are serious about learning how computers work, wouldn't it be much instructive than to learn PHP? Or in a different setting, you want to learn about algorithms, and there are a lot of books about algorithms in C++ or Java, so, you would be learning Java or C++ just to go through the literature. Does that happen in real life? Comploose (talk) 23:01, 24 August 2012 (UTC)[reply]
Really it's a personal question about what's important to you, and we have some very knowledgeable computer science people lurking around here that could fill in the details better than I can, but if you want to learn a language for the intellectual exercise, I think you need to gravitate towards some extreme. That is, do something extremely high-level (object oriented, based around high level design ideas) or very low level (assembly, like you say, or something crazy, like brainfuck). I think that would probably drill home certain ideas in a way that could be valuable as a learning experience. Like doing an isolation exercise. Shadowjams (talk) 23:15, 24 August 2012 (UTC)[reply]
I don't think there is good reason to learn them in depth, but some languages are worth learning because they express a philosophy in a particularly pure way. Examples are Smalltalk, APL, and Lisp. Looie496 (talk) 23:22, 24 August 2012 (UTC)[reply]

Esoteric programming language 92.233.64.26 (talk) 23:32, 24 August 2012 (UTC)[reply]

Ooh! Ooh! Learn Scheme! It's a kind of Lisp, like Looie mentioned, and the nice thing about it is that it combines simplicity with power. There are advantages and disadvantages to Scheme's way of doing things (no static types, lots of possibilities for abstraction), but I think that Scheme is a great teaching language because of its simplicity. The textbook that my school and several others use is free online, and so is their Scheme-like language, Racket. Scheme is especially interesting for someone interested in programming languages in general, because its powerful macro system allows the programmer to reshape the language. Paul (Stansifer) 00:34, 25 August 2012 (UTC)[reply]
There's also a distinction to be drawn between learning the syntax of a language, and learning its methodologies and paradigms. Various programming languages are expressive for different sorts of problems. If you know Java, there's little point in learning C++ just to re-write your Java programs using double-colons. C++ is a different language, with similarities and differences; and if you just learn enough to make a Java-like program with C++ style syntax, you wasted a lot of time and effort. Similarly, if you learn Lisp and then try to use it to write an application that should be written in Java, you're again wasting your own time. Lisp has a different purpose than Java. It's expressive in different ways. It's not conducive to creating the sort of boring, practical, useful software the way Java can. Learn FORTRAN so you can learn to work with complicated vector math. Learn MATLAB so you can explore advanced optimization problems. But, don't learn FORTRAN and then try to write a 3D game with it. That's using the wrong tool for the job; and if your intent is to use the wrong tool as an exercise in solving unnecessarily-difficult-problems, then you should just work in Intercal. Nimur (talk) 01:11, 25 August 2012 (UTC)[reply]
I'll grant that some language/problem pairs are more appropriate than others, but I don't think that this is a productive way to look at families of languages. For example, both macros and static types are language features that have huge effects on language design, and can be used for performance, safety, or expressivity. They don't gear you towards specific applications, so much as specific groups of people and modes of thought.
Simple languages, like Scheme and Smalltalk and Haskell (well, conceptually simple, anyhow) and even Basic are good for learning with, because they engage with the problem at hand. Languages that are designed around performance, like C++ and Java and Fortran bog the user down in minutiae. It's a good thing some people struggle with C++ STL error messages, or the details of memory management in Java, so that we can have fast software, but the time that I've spent doing those things hasn't really made me a better programmer except in those narrow areas. I've never had a job where I didn't have to learn a new language (or, at least, a lot more about C++) after I got there, anyways. Fortunately, picking up new syntax and new details isn't very hard. Paul (Stansifer) 07:10, 25 August 2012 (UTC)[reply]
Haskell, Prolog, and ToonTalk are all unusual and interesting, and Go and Erlang to a somewhat lesser extent. -- BenRG (talk) 01:09, 25 August 2012 (UTC)[reply]
Seven Languages in Seven Weeks looks interesting, if you want a fairly quick introduction to seven very different languages.-gadfium 04:29, 25 August 2012 (UTC)[reply]
If you're looking for concrete suggestions, it would help if you said what your learning goals were, and what languages you use now. If I have to pick without that info, I'll suggest assembler, Scheme, and Haskell. Each of them is useful though, so there's no reason not to work with them once you've learned them. 69.228.170.132 (talk) 07:01, 25 August 2012 (UTC)[reply]