Wikipedia:Reference desk/Archives/Computing/2015 October 6

From Wikipedia, the free encyclopedia
Computing desk
< October 5 << Sep | October | Nov >> October 7 >
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.


October 6[edit]

Terms for abuse of OO?[edit]

I have encountered some forms which think are abuse of OO (Object-Oriented programming) at work. I can't reveal trade secrets, so here is an abstraction.

I have encountered something like this:

public void DrawShape(Shape shape) {
  if (shape is Circle) {
    DrawCircle(((Circle)shape).Origin, ((Circle)shape).Radius);
  }
  if (shape is Rectangle) {
    DrawRectangle(((Rectangle)shape).TopLeft, ((Rectangle)shape).BottomRight);
  }

instead of having the DrawShape method implemented in the class Shape itself as an abstract method, with Circle and Rectangle providing their own implementations.

And I had myself made a method to write the rendered HTML code of a web page control into a string, and another coder found out that it was not working properly for one of his controls. So, instead of writing his own code, or making a subclass of the class I'd written, or introducing a delegate to perform custom rendering, he had hacked my code so that if it encountered a specific class of control, it ran his own, specific code hard-coded to handle a single specific instance. In my opinion, this introduced hard-coded special cases to code intended as fully generic, which I consider abuse.

Are there any specific terms for this kind of programming? JIP | Talk 19:21, 6 October 2015 (UTC)[reply]

Perhaps Anti-pattern. Your title and "abuse" reminded me of Abuse of notation in math, but that is rather different -- often tolerated and sometimes even preferred. SemanticMantis (talk) 19:55, 6 October 2015 (UTC)[reply]
You'll find plenty of similar examples if you just search for things like /OO(P) abuse/, like this blog post [1]. SemanticMantis (talk) 20:01, 6 October 2015 (UTC)[reply]
According to Steve McConnell, this is called "logical coupling", but we don't have an article on the specific topic. Tevildo (talk) 20:23, 6 October 2015 (UTC)[reply]
I reformatted your code: the leading spaces are sufficient without <code>, and they mix badly. --Tardis (talk) 13:39, 7 October 2015 (UTC)[reply]
It's called "programming in such a way as to make the maintenance programmers hate you". But I made a good career out of cleaning up after such terrible programming practices. I had a t-shirt made saying "Because they're idiots." --jpgordon::==( o ) 16:56, 7 October 2015 (UTC)[reply]

Installing Linux without ever touching Windows[edit]

After seeing a Facebook meme about requiring IE to install other browsers, I got to thinking. Even though I have to use Windows at work, I have only ever used Linux at home for the past decade. I can't even remember how I first installed it, but every subsequent installation has been done using Linux only.

Is it possible to buy a fresh new computer, either as a pre-packaged commercial product or as parts you assemble yourself, and install Linux on it, without ever running Windows on it? Would it require a pre-packaged installation medium of Linux also bought from a store? JIP | Talk 19:29, 6 October 2015 (UTC)[reply]

Well, you can't download it off the Internet without some minimal O/S already installed to allow for Internet access. You could install it from a flash drive, if the BIOS was set to boot from a flash drive. Of course, getting the Linux O/S on a flash drive would either require that you pay for it or use another PC to download it. I suppose you could also have a flash drive with just enough O/S on it to enable you to download the rest online. StuRat (talk) 19:35, 6 October 2015 (UTC)[reply]
It's hard for me to tell what rules you're operating under. If you're allowed access to some other computer, then you can install Linux without booting Windows on the target PC. Live_USB#Examples_of_Live_USB_operating_systems gives several official Linux distros that can be loaded and booted from a flash drive, also you can make your own - List_of_tools_to_create_Live_USB_systems. Depending on which one you use, that OS can then be used to install other OSs. SemanticMantis (talk) 19:51, 6 October 2015 (UTC)[reply]
I didn't have a home machine until 2002 and I wanted it to run Linux. I purchased a PC without an o/s from my neighbourhood PC shop and went to a news ageny and bought a Linux mag with a distro on a "free" CD which was stuck to the cover. I imagine many other people did this too. TrogWoolley (talk) 20:57, 6 October 2015 (UTC)[reply]
I met up with some people from my local Linux user group, they will be more than happy to help you install Linux on your computer without even mentioning windows. Vespine (talk) 21:54, 6 October 2015 (UTC)[reply]
Concise answers to your questions: yes and no, respectively. Semi-random example: Here are the installation instructions for Debian. --71.119.131.184 (talk) 23:09, 6 October 2015 (UTC)[reply]
You can download or buy a Live-CD or a Live-USB which mostly also offer the option of installing the OS. YX-1000A (talk) 00:58, 7 October 2015 (UTC)[reply]
Just yesterday, I purchased a new computer. I used my Linux machine to download the latest Centos 7 (Linux) install disk. I turned on the computer and went into the RAID utility to set up the disks (RAID happens long before it gets to Windows). I put the Centos disk in the DVD drive and rebooted after I got RAID set up. It booted up to the Centos install screen, installed Centos, and rebooted into Linux. I never saw Windows. I don't know if it came with Windows or not. How about the computer I used to download Centos? It runs Linux. It came without an operating system. I used my previous computer to download a Linux install disk for it. My previous computer was one of a set of four that I purchased. I had a Redhat disk from the company I work for that I used to put Redhat on each one. My company got the disk from Redhat. So, it wasn't downloaded. How did Redhat get the disk? They likely used their own Redhat computers. You can keep going back and back and back. Eventually, you will hit a time when it was possible to download the original Linux install software using a popular non-Windows computer of the time, such as the Amiga. 209.149.113.94 (talk) 15:57, 7 October 2015 (UTC)[reply]

Images not displaying in MS Word[edit]

I usually copy WP articles then paste it into my MS Word due to internet security reasons. Recently (from 2nd or 3rd November) it stopped copying the images from the WP articles, just copy's the article's words... How do I need to mitigate this? By the way, I'm using 'Google Chrome' if this helps. -- Space Ghost (talk) 21:00, 6 October 2015 (UTC)[reply]

Can you explain the security issue ? One option might be to save the web page as an HTML file, which will also copy the images. You would then use any browser to view it offline. I believe you right-mouse-click on the page, being careful not to be on a pic (or then it will just save that pic), then click Save As. StuRat (talk) 00:30, 7 October 2015 (UTC)[reply]
Maybe this helps: http://smallbusiness.chron.com/copy-word-42912.html If it doesn't work, perhaps something happened to your google chrome or MS Word installation (automatic upgrade)? Ssscienccce (talk) 03:49, 7 October 2015 (UTC)[reply]
I tried restoring my PC, it doesn't restore. I don't usually restore, I reinstall, I restored it once before, fearing that it will mess up my PC, knowingly, I had to restore because my sound system wasn't working. Now I can't even reinstall because of the Antivirius I possess; keeps me secure from the internet.

StuRat: The security issue, you won't believe it, even if I tell you. WP-user Guy Macon came up with something really good i.e. Tails (operating system) OS. The guy who downloads things for me is giving me attitudes indirectly, probably I've gone to him for downloading purposes a bit too much, so 50/50% chance now that I might download it from him or I might do it myself. The option that you guided above works by the way; its just a long process. Thank you, this has to do for now. -- Space Ghost (talk) 18:56, 7 October 2015 (UTC)[reply]

I guess You linked to the picture files only. You need to embed the pictures when transfering the document file outside Your accessible files system paths like other computers or users using other file system paths on Your computer or network. --Hans Haase (有问题吗) 11:56, 11 October 2015 (UTC)[reply]
No one uses my payg internet dongle except me. That being said, I do have people trying to get into my PC for the last 4-5 years, since 2014, I think they've been failing due to the Antivirus I possess. Other Wikipedians advised me a few ways to identify the hackers, 1)The AV just about satisfies/covers the satisfaction of security, 2) The reason why I requested for help in order to find out who's trying to hack in, later the issue turns out due to an Windows restoring problem, therefore I did not follow through also because the Tails OS was specified and I'm planning to get that when the right time comes...
How do I mitigate? How do I fix this issue? I can't restore my PC (it doesn't restore properly to any specified point). I reinstalled both the 'web application' and 'MS Office' software, still doesn't work. What you are stating, could you give me a step by step guide please of the fixation you stated; if you don't mind? -- Space Ghost (talk) 18:48, 11 October 2015 (UTC)[reply]