Wikipedia:Reference desk/Archives/Computing/2015 July 26

Computing desk
< July 25 << Jun | July | Aug >> July 27 >
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.


July 26 edit

How many levels of abstraction when running ? edit

When I run a java program, how many levels of abstraction are there? Is it bytecode - JVM - OS - machine language - physical switch?--Bickeyboard (talk) 00:33, 26 July 2015 (UTC)[reply]

That's gonna be implementation-dependent - and very often, there is a micro-code layer below machine code and above the level of physical gates (which in turn are abstractions of transistors and such). But the OS (Operating system) isn't a layer anywhere here. In a sense, the OS is nothing more than a different program that happens to be running on the same computer. SteveBaker (talk) 02:41, 26 July 2015 (UTC)[reply]
I wouldn't say the OS isn't a layer anywhere here. AFAIK, Java doesn't usually take care of things like file system implementations and CPU scheduling on its own; that's what the OS should do! That said, it is possible to run a complete program without any operating system (which is quite often the case in embedded systems). --Link (tcm) 14:51, 26 July 2015 (UTC)[reply]
No, of course Java doesn't do things like file systems - but the OS is more like a library as far as Java code is concerned. It's not a level of abstraction between JVM and machine code...no way. If it were a level of abstraction, then you'd be able to point to a complete description of your algorithm described in terms of the operating system - and that sentence doesn't even mean anything! And even if it was - it would still be implementation-dependent - you can run Java code on computers that don't even have operating systems. Consider something like Haiku-vm for Arduino - there is no operating system - there is no JVM either. It converts Java source code into bytecode, then uses a small C program to interpret the bytecode. The bytecode is never converted into machine-code either. Without reference to a specific implementation, the question doesn't even mean anything. You could (in principle) write a program to run on a Babbage analytical engine that would interpret ASCII Java source code directly from punched cards. It would still be a Java program - but there would be no byte code, no JVM, no OS, no machine language, no electronics...just a bunch of gearwheels. Java doesn't care how it gets executed...so it's meaningless to make generalizations about how it runs. Now, if you said "How is such-and-such implementation of Java run under Windows 8?", then we could provide a more definite answer. SteveBaker (talk) 01:16, 27 July 2015 (UTC)[reply]
It looks to me like the questioner thinks that the OS operates like a JVM. The OS is often referred to as an abstraction layer because programmers usually program for the OS, not the hardware. However, the OS does not convert the running program into machine code. It is a program that is running at all times and provides a common way to talk to a variety of different hardware devices. It is troubling to get tied down to a specific answer with "operating systems" because there is no universal answer to "What is an operating system?" It is clear though that it is not a "virtual machine". 209.149.113.45 (talk) 13:41, 27 July 2015 (UTC)[reply]
  • In addition to the points made above, many machines have an additional layer of abstraction between machine code and the physical electronic components, consisting of microcode. Looie496 (talk) 13:50, 27 July 2015 (UTC)[reply]

What language uses if!, enter!, exit!? edit

What language uses if!, enter!, exit!?--Bickeyboard (talk) 00:35, 26 July 2015 (UTC)[reply]

I don't know of one. Where did you see them? The context must provide some clue. Scheme has a builtin named set! and a bunch of functions with exclaimed names, but not the three you listed. Vim (text editor) uses ! as a modifier for some commands, but not those. -- BenRG (talk) 21:23, 26 July 2015 (UTC)[reply]
I used a stage play markup language (Shakespeare?) long long ago that ran on Perl. The markup language had "enter" and "exit" as commands for a character to enter or exit the stage. Once a character was in use, the ! was a shortcut for that character. So, if I had "John: I'm saying some lines." followed by "Exit !", it would add "[Exit JOHN]" to the stage play. I do not remember any conditionals, such as "if" in the markup language. So... you are probably referring to the Ruby programming language. 209.149.113.45 (talk) 19:35, 28 July 2015 (UTC)[reply]

replace character vs add character edit

I don't know how I got into this (perhaps some accidental control key combination?) but suddenly when I type text in the middle of a line, instead of just adding the next character, NotePad++ replaces the character, So, instead of adding 'c' as the sixth character of 'charater' -> 'character' I get 'characer.' What can I do? --Halcatalyst (talk) 16:49, 26 July 2015 (UTC)[reply]

I don't know NotePad++ but I guess you pressed the Insert key or chose it elsewhere. Try to disable the unwanted feature by pressing the Insert key. PrimeHunter (talk) 17:23, 26 July 2015 (UTC)[reply]
It worked, thank you! --Halcatalyst (talk) 17:47, 26 July 2015 (UTC)[reply]

Unicode Alternatives to: \ / : * ? " < > | in Windows filenames? edit

  Resolved

The following characters are not permitted in Windows7 filenames:
\ / : * ? " < > |
Q: What are the Unicode characters that will look the most like them on a web page (from any browser or operating system) without giving any protests or problems from Windows when I want to use them in filenames?
(The three most urgently needed are alternatives to: the colon :, the slash / and the question mark ?).
Do you have any suggestions?
--Seren-dipper (talk) 17:44, 26 July 2015 (UTC)[reply]

One standard method is to use the Halfwidth and fullwidth forms - FULL WIDTH COLON (U+FF1A, :), FULL WIDTH SLASH (U+FF0F, /), FULL WIDTH QUESTION MARK (U+FF1F, ?). See the table in the article for the other symbols. Tevildo (talk) 18:10, 26 July 2015 (UTC)[reply]
Try the Unicode Consortium's confusables utility for some options. For : you can often substitute a dash. -- BenRG (talk) 20:27, 26 July 2015 (UTC)[reply]

Perfect! Thank you both! ☺
--Seren-dipper (talk) 01:51, 27 July 2015 (UTC)[reply]

Presumably you're aware that people will hate you if you do stuff like that. They'll try to type the file names and it won't work. Looie496 (talk) 13:09, 27 July 2015 (UTC)[reply]

hard drive error edit

File:Screenshot of HD error.jpg
screenshot of the error screen

This morning Windows started giving me warnings about a hard drive error. I ran SeaTools on it, and it detected a problem. It said to run SeaTools for DOS. I did that but it said "No hard drive found"... "no controllers detected"... I ran Chkdsk /f but it didn't find any problems. Is there some other free or cheap way to test for HD errors and try to fix them? Bubba73 You talkin' to me? 23:06, 26 July 2015 (UTC)[reply]

I suspect your hard disk controller requires a driver that was not available from the DOS version of Seatools you have. If it needs to be said, the very next thing you do before you run any more tests or whatever is ensue if you have ANY data you want to keep on this disk that it's backed up. In my experience, regardless whether you find some software that claims to have repaired your problems, a hard disk that's had an issue is just a ticking time bomb. The cost of disks these days, just replace it ASAP. Vespine (talk) 23:11, 26 July 2015 (UTC)[reply]
Thanks - it is a secondary HD and I have current backups. Bubba73 You talkin' to me? 23:22, 26 July 2015 (UTC)[reply]
What warnings did you get from Windows, and what problem did SeaTools detect? The only problem I can think of that might be (temporarily) fixable is bad sectors. You can run chkdsk /r to scan the whole disk for bad sectors and mark them as bad so that the filesystem won't try to write to them later. If any of the sectors were in use, you'll probably lose that data. Chkdsk will allocate a new sector for that part of the file, but I don't know what it does about the unreadable data; it may replace it with zeros, which could contaminate your backup. Hard drives with bad sectors are likely to develop more of them, causing more data loss, so it would be better to replace the drive unless you really don't care about the files stored on it. -- BenRG (talk) 23:53, 26 July 2015 (UTC)[reply]
I don't remember the exact errors - something about sectors, I think. I think that replacing it now is probably the best idea. I went out to get a replacement, but the stores that have internal drives wer already closed. Bubba73 You talkin' to me? 01:24, 27 July 2015 (UTC)[reply]
Warning: Inadequate try to repair may cause preventable loss of data. Use an external disk and a Linux Live-CD to backup data. Use another computer to get the CD/DVD's ISO-image. Just boot from the CD, but do not install Linux on such machine. In case of hardware damage, CHKDSK might not be able to write essencial blocks due phyically damaged sectors. First, do not overheat the drive. Second, backup You data first an mention, the files might be damaged already. Do not overwrite or delete existing backups. By booting from an other device, a damage of the operating system is skipped when accessing Your files. When finisted the backup, figure out if the drive is damaged phyically or the filesystem only which can be repaired or renewed by killing all data on the drive. To try a second backup I heard form a software called Spinrite. I suggest not to a drive with physical damage again. Even on notebooks the drive can be removed quickly. Today drives are installed in a tray or drawer of the computer as far it can be called a computer. --Hans Haase (有问题吗) 08:23, 27 July 2015 (UTC)[reply]

I've added a screenshot of the error. It still comes up periodically. I ran a check of the drive with HDTune Pro 5.6 overnight (it took a few hours) and it didn't find any problems. CHKDSK /F didn't find any problems. I'm running CHKDSK /R right now. It is out of warranty, but it is a 2TB internal so I can replace it for about $90, so that is what I plan to do. Bubba73 You talkin' to me? 16:10, 27 July 2015 (UTC)[reply]

Seconding Hans Haase's advice above. That error typically means the disk is indeed failing rather than needing defragmenting/repair. It may still last quite a while, but especially if it's your boot drive, you should back up your data now and replace it ASAP (as it sounds like you're doing). I had a drive (which I stored some programs on but didn't boot from) give me that error on startup for more than a year before finally dragging the whole system down to a slow crawl until I disconnected it. One of those things best dealt with sooner rather than later. — Rhododendrites talk \\ 17:01, 27 July 2015 (UTC)[reply]
Thanks. I bought a new drive to replace it; I'm waiting on an extra backup to finish. This is not my boot drive, but it is where I keep just about everything other than Windows and the installed programs.
I haven't been very fortunate with hard drives over the years - nothing near their claimed MTBF. I estimate that about 1 in 4 or 5 internal drives has failed during the live of the computer and 1 in 3 external drives. Bubba73 You talkin' to me? 18:25, 27 July 2015 (UTC)[reply]
PS - it is getting harder to get internal desktop hard drives in local stores. Bubba73 You talkin' to me? 00:28, 28 July 2015 (UTC)[reply]
  Resolved

I got the new drive installed and it is being restored from a backup right now. Bubba73 You talkin' to me? 03:22, 28 July 2015 (UTC)[reply]

Good call.
Having been in charge of mainlining disk farms with thousands of disks in them, I have the following advice to maximize life:
  • Keep it cool. Heat kills hard drives. Extreme cold isn't quite as bad, but should be avoided.
  • Keep it away from vibration. Cooling fans are notorious for making the entire case vibrate.
  • Get a high quality power supply from a reputable manufacturer. Voltage spikes are bad for hard disks.
  • Powering down a hard drive one or two time a day is fine, and leaving it running 24/7 is fine, but avoid turning it off ten times a day.
  • Run the S.M.A.R.T. diagnostic utilities every 6-12 months. The CCleaner program is a good way to access S.M.A.R.T. from Windows.
--Guy Macon (talk) 05:57, 28 July 2015 (UTC)[reply]
Thank You all for reply. Defragging a damaged disk may cause valid data is moved from used sectors into damaged sectors. Is is causing further unnecessary loss of this data. Defragging moves blocks to get them lined up to have quick access by reducing the actuators cylinder change. Each cilinger change of the actuator is in milliseconds range. Never defrag an SSD. SSDs have loss of lifespan by writing. The each block has identical access time. --Hans Haase (有问题吗) 22:02, 28 July 2015 (UTC)[reply]