Jump to content

Wikipedia:Reference desk/Archives/Computing/2015 March 29

From Wikipedia, the free encyclopedia
Computing desk
< March 28 << Feb | March | Apr >> March 30 >
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.


March 29

[edit]

Why break backward compatibility, when developing new programming languages?

[edit]

As I understand, C++ is be a kind of expanded C, developed when a developed was needed. I am aware that this does not apply to everything written in C, but a C program is also a C++ program.

Why weren't all the new programming languages built with a backwards compatible compiler? You don't like C, you are missing something? Fine, expand C like Bjarne Stroustrup did with C++, do not re-build anew. A language can incorporate different programming styles after all, can't it? --Senteni (talk) 02:50, 29 March 2015 (UTC)[reply]

C++ broke compatibility with C in several ways, most importantly by strengthening the type system. Preserving compatibility with C is limiting because C claims a lot of concise readable syntax and assigns it less-than-ideal meanings. Strictly speaking, you couldn't even add any keywords to the language (unless they started with an underscore). C compatibility means that 1 <= x <= 10 has to mean (1 <= x) <= 10 instead of 1 <= x && x <= 10 (or at least a compile-time error), and x & 15 == 0 has to mean x & (15 == 0) instead of (x & 15) == 0, and that you have to accept if (x = y) even though the programmer probably meant if (x == y). It means you can't use x, y, z or (x, y, z) as a convenient tuple notation. It probably means that programmers would shoot themselves in the foot by using a fast unsafe operation when they meant to use a safe one, because the syntax makes it too easy. -- BenRG (talk) 05:25, 29 March 2015 (UTC)[reply]
These are all good points, but I don't know if they hit the nail completely on the head. The syntax examples are (with the exception of =/==) probably not what most people think about when talking about "breaking compatibility" (although they are the kind of changes that will bite them in the end ;-). Many of the newer languages do indeed follow C in many respects - and for good reason, because C got many things right. But sometimes a different syntax is one of the goals of the language. Look e.g. at Python. Of course, in a really rational world we would all use S-expressions... --Stephan Schulz (talk) 07:30, 29 March 2015 (UTC)[reply]
Well, the question was not much about C/C++ compatibility, but about losing compatibility across languages. So, if I understand correctly, it's a must to break compatibility, since some abstractions can not co-exist? However, couldn't a language accept different types of syntax for expressing the same thing? If you have an explicit expression like int a = 3, the compiler will know that this is an integer, but if if comes across an implicit expression like a = 3 it will try to guess what's the type. If the compiler finds a class with {} and then it finds a class declaration with indents, it will create a class in the same way. Both syntaxes do not exclude each other. --Senteni (talk) 16:08, 29 March 2015 (UTC)[reply]
Having multiple types of syntax to do the same thing sounds like a recipe for unreadable, hard-to-maintain code. It would also be a lot harder to learn. Learning a programming language would require learning every other language that it's compatible with. The design goals of Python include an emphasis on readability. Allowing people to mix C and other languages in would defeat the purpose.
And how would that work with regard to libraries? Would every library need an implementation in every possible variant of the language, or would certain ones only work with certain variants? Could you use a Python dict with C libraries or a C struct with Python libraries? And then there's the compiler itself. Many modern languages like Python and Perl are interpreted, not compiled, and there are things you can do in an interpreted language that can't be done in a compiled one.
And I say "every other language", because it's not like C is like the father of all programming languages. There were dozens of others developed around the same time and earlier. Mr.Z-man 18:25, 29 March 2015 (UTC)[reply]
You may find the paper "C++: as close as possible to C—but no closer" an interesting read, as it describes the rationale for some of the incompatibilities between C and C++. -- Tom N talk/contrib 16:17, 29 March 2015 (UTC)[reply]
While S-expressions may be a fantastric way to describe how a computer "thinks" about a problem, they're seriously limited for describing how humans think about a problem. Of course, humans are flexible enough that they can bang their thought processes into the shape of an S-expression for the sake of a computer, but if you view programming languages as a way for humans to tell a computer what to do (as distinct from a way for a computer to be told what to do), then they have severe deficiencies. That, of course, is part of what underlies the wide diversity of programming languages. Each creator of a new programming language has their own conception of what a programming language "should be": Should it be easy for new users to use, or should focus be on power for established users? Should it be "pure" based on this or that theory of computation, or is "practicality" in real-world usage more important? What sort of operations should it make easy, which are to be ignored, and which are actively prevented? Are words better than symbols, or are symbols better than words? Each set of design decisions forces particular restrictions onto the language. C had its own set of design goals, and these may conflict - perhaps severely - with the design goals another language designer. You can't maintain C-compatibility if the design goals of the two languages are completely different. C-compatibility may be one of your design goals, as it was for Stroustrup, but doing so forced Stroustrup's hand in a lot of other areas, areas where other designers might not want to be forced. -- 162.238.240.55 (talk) 16:27, 29 March 2015 (UTC)[reply]
"Why weren't all the new programming languages built with a backwards compatible compiler?" Because some language designers believe that past languages had design flaws and that it's better to fix them than try to be compatible with them. You'll note that C# is a rewrite of C++ and avoids many of the mistakes made in C++. In fact, there's an entire category of languages (Coffeescript, Typescript, etc.) which attempt to fix the issues in JavaScript and transcompile to JavaScript. A Quest For Knowledge (talk) 01:37, 30 March 2015 (UTC)[reply]

Hard Disk Unformatted?

[edit]

I have a hard disk that was running on my eSata port. I keep it turned off mostly. Today, when I tried to turn it on, Windows Explorer described it as not formatted. When I open Computer: Manage: Disk Management, it describes the File System as: RAW. I've stored about 1.5 gigs of data on it. Now my OS (windows 7 Pro) wants to format it? I'll lose all my data! Is there a way for this disk to be recognized as it was before without wiping it clean and losing all my data? HELP!72.47.125.4 (talk) 03:43, 29 March 2015 (UTC)Carl J LaFong[reply]

Is the filesystem on the disk compatible with the operating system on the computer? If yes, check: The disk might be not detected in is correct (former) geometry or size. Check for data sheets, specifications, firmware issues and comptibility lists. All information to the M/B, used controllers and the drive. --Hans Haase (有问题吗) 08:52, 29 March 2015 (UTC)[reply]
Create a Linux boot CD such as Knoppix on a different computer to avoid any additional damage to the drive. Knoppix is fairly intuitive and Windows-like. If the disk shows up in Knoppix (it should appear as icon on the desktop, if I recall correctly), use an external usb drive to back up the contents of the possibly damaged disk. Knoppix is designed not to touch the hardware configuration of the system it runs on, unless you explicitly tell it to. --NorwegianBlue talk 09:14, 29 March 2015 (UTC)[reply]
Knoppix is as good as any. Don't panic and just take your time. How to Recover Data with Linux--Aspro (talk) 16:48, 29 March 2015 (UTC)[reply]

Skype

[edit]

When I was using MSN, I was getting random 'add me' messages from people. I would add them, in case they were from project managers for the many agencies I worked with, but the majority were just "Hey, wanna do webcam sex?" or "Visit my webcam site" etc., so I switched to Skype. For a while, I only had colleagues (and a few friends and family) on it, but since Microsoft bought Skype, it has all started again. Is there any way to remove my Skype ID from their public listings, because I am getting these things almost twice a day now. KägeTorä - () (もしもし!) 11:23, 29 March 2015 (UTC)[reply]

All you have to do is launch the Skype application and open your profile by clicking on your name in the interface. From there, look directly under your photo and you should see a drop-down box labeled 'Contacts.' I believe if you change this setting to 'Contacts only - visible just to your contacts' you won't keep getting solicited by random people. Please see this link http://www.tothepc.com/archives/skype-profile-photo-private/ for a walkthru and video of this process. For further information on configuring Skype profiles, check out the following links as well: how-to-set-up-your-skype-profile and these links from the Skype forums that give more information on making a profile private How-do-I-make-my-profile-private and how to delete your ID from the Skype directory altogether Delete-Skype-IDTimbyskii (talk) 16:42, 7 April 2015 (UTC)[reply]

PDF direct from bitmap?

[edit]

Is there any way to convert a bitmap image (from MS Paint) into a PDF wothout printing out and rescanning?--109.146.20.31 (talk) 14:20, 29 March 2015 (UTC)[reply]

With imagemagick: convert foo.bmp foo.pdf -- Finlay McWalterTalk 14:33, 29 March 2015 (UTC)[reply]
With Openoffice or Libreoffice: open the Write application, drag and drop the image into the new document that opens, and press the "export directly as PDF" button. -- Finlay McWalterTalk 14:35, 29 March 2015 (UTC)[reply]
I cant drag and drop the image from within Paint, but I can pretend to send it as email and then drag/drop the icon in the email form to the empty text document in Open Office. So yes, this is a workable solution. Thanks.--109.146.20.31 (talk) 19:45, 29 March 2015 (UTC)[reply]
Do you see the second-from-left icon, right at the top, the one that looks like a floppy disk? You can save the .bmp from there, and choose a destination to save it on, such as the Desktop. Then, you will be able to drag'n'drop it into any of the programs we have mentioned. KägeTorä - () (もしもし!) 20:22, 29 March 2015 (UTC)[reply]
With GIMP: open the bmp, then file->export_as, type foo.pdf and click export -- Finlay McWalterTalk 14:38, 29 March 2015 (UTC)[reply]
MS Word 2007 onwards also has an export to .pdf function. KägeTorä - () (もしもし!) 14:42, 29 March 2015 (UTC)[reply]
With Inkscape: create a new document, drag and drop the bmp into the document (and choose "embed" on the dialog that appears), then resize the image so it fits on the page template, then "save as" to foo.pdf -- Finlay McWalterTalk 14:44, 29 March 2015 (UTC)[reply]
BTW, are we correct in assuming it's OK to leave it as a bitmap in PDF, versus converting it into a vector drawing ? I'm guessing that's the best all the methods above can do. StuRat (talk) 17:01, 29 March 2015 (UTC)[reply]
I have just tried it, with some random squiggles, and it converted perfectly, using my method above: MS Paint> MS Word> Save as PDF. KägeTorä - () (もしもし!) 20:17, 29 March 2015 (UTC)[reply]
It takes a "little bit" of setting up but you can actually get a free windows priter driver that prints to a PDF file directly from just about any applicaiton that can "print". That way you don't need to copy the BMP out of MS Paint and there is only one single step to the process. cute pdf is an example of one, i'm not sure how easy it is to set up but it doesn't look too hard, if you get it working, all you'll have to do is print your BMP from MS Paint exactly as if you were going to print it to a printer, but select the PDF driver instead and it will save it as a PDF file. . Vespine (talk) 22:12, 29 March 2015 (UTC)[reply]
I would still recommend saving the oroginal .bmp, in case the OP decides it needs to be modified at a later date. Therefore, it's not just a 'one click' process, and avoids the download of unnecessary software. KägeTorä - () (もしもし!) 10:42, 30 March 2015 (UTC)[reply]
Sorry i'm confused. I assumed the BMP was "already" saved? If it's not then you only NEED to save it if you want to convert the file using a different program. If you print it to a PDF you don't need to "double up". If you decide to "modify it" later, you can just screen grab it from the PDF. OR you can save it as a separate file if you decide it's important enough to keep a copy, up to you. As for "unneccessary software" it's a printer driver that's a few MB, using MS Word to export a PDF file is "unneccessary software", cute pdf lets you save the PDF file FROM MS Paint, whether it takes one click or two clicks, it save the need to open the file in another program all together. Vespine (talk) 22:14, 31 March 2015 (UTC)[reply]

Computing

[edit]

Which was the first microcontroller chip? — Preceding unsigned comment added by Surya2208 (talkcontribs) 15:57, 29 March 2015 (UTC)[reply]

The Intel 4004 is considered to be the first I think. It was expensive too. --Aspro (talk) 16:56, 29 March 2015 (UTC)[reply]
Apparently, it sold for US$200, a bit less than US$500 after inflation. That's about the price of a cheap laptop, or a medium-range i7 processor today. --Stephan Schulz (talk) 17:25, 29 March 2015 (UTC)[reply]
The Intel 4004 was the first first microprocessor. The first microcontroller was the TI TMS1000. See [ Microcontroller#History ], [ http://www.datamath.org/Story/Intel.htm ], and [ http://www.circuitstoday.com/microcontroller-invention-history ] I believe that the TMS1802 was the first chip in the TMS1000 family but it is generally considered to be a microprocessor. The TMS1000 was the first microcontroller. See [ http://www.computerhistory.org/semiconductor/timeline/1974-MCU.html ] and [ http://smithsonianchips.si.edu/augarten/p38.htm ]. --Guy Macon (talk) 19:39, 29 March 2015 (UTC)[reply]
I think you must be using a fairly odd inflation statistics or may be made a mistake. I've tried several different ones including the US government one and they give something over $1000, [1] gives US$1,159.12 from 1971 - 2015 for US$200. Nil Einne (talk) 05:28, 30 March 2015 (UTC)[reply]
Indeed, I forgot to press "calculate", and got the default (US$20 from 1913 to today ;-). So it's a medium class laptop but still a medium class i7 (server model). --Stephan Schulz (talk) 12:46, 30 March 2015 (UTC)[reply]
Does anyone know what the Busicom 141-PF calculator -- the first calculator to use a microprocessor (Intel 4004) -- originally retailed for? --Guy Macon (talk) 05:45, 30 March 2015 (UTC)[reply]
The significant distinction here is that the 4004 (which I actually programmed in my first job) needed a ton of additional circuitry to be of any actual use. It's a microprocessor...a very small processor...but not a microcontroller, which has control circuitry in addition to the processor). A typical microcontroller can do meaningful tasks with nothing more than a power supply and (possibly) a clock. The 4004 is really just a CPU - it can do logic, math and flow control - but not much more. It needed external memory, both ROM and RAM, and some kind of an I/O controller chip. A typical microcontroller can be hooked up to a battery and with no other circuitry whatever, boot up, run software and interface to things like switches and LED's directly from the pins of the chip. SteveBaker (talk) 13:35, 31 March 2015 (UTC)[reply]