Wikipedia:Reference desk/Archives/Computing/2010 July 20

Computing desk
< July 19 << Jun | July | Aug >> July 21 >
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 20 edit

16-bit microprocessors edit

Do these still exist on any wide scale? It seems like the embedded processor world is now divided into small 8-bit (AVR, Pic, etc) and bigger 32-bit (ARM, x86-32) processors. Not much 16-bit seems to exist any more, except maybe some DSP's. Is that accurate? Also, are 4-bit processors still used on any scale? 67.122.211.208 (talk) 06:27, 20 July 2010 (UTC)[reply]

They are certainly still available. I used a Renesas M16C and an M32C (despite its name, both are 16-bit CISC-style instruction sets - actually, the architecture derives from Mitsubishi/Hitachi lineage). Here is the product-family-tree. You can see that Renesas still sells processors with 4-bit, 8-bit, 16-bit, and 32-bit instruction sets. They also have a "Product Roadmap" displaying the lineup and each processor's "intended" application - these categories are a business/marketing target, but are generally based on each device's actual capabilities. Nimur (talk) 07:39, 20 July 2010 (UTC)[reply]
I would recommend Freescale Semiconductor's family of 16-bit microcontrollers. They appear to have suitable 16-bit microcontrollers for just about any industrial application (I'm assuming you're intending to use 4-bit and/or 16-bit microcontrollers for an industrial application). Rocketshiporion (talk) 19:19, 23 July 2010 (UTC)[reply]

Convert <? to <?php edit

I have to work on some scripts that are using <? instead of <?php is some files. I need to convert them all to <?php. That wouldn't be too much of an issue, but I also need to convert <?= to <?php print. Is there a program that already does this before I write a sed replacement for all the files? -- kainaw 13:17, 20 July 2010 (UTC)[reply]

I dunno, but wouldn't this do it?
perl -pi.bak -e 's/<\?=/<?php print/g; s/<\?(?!php\b)/<?php/g' *.php
Obviously you'll need to be cleverer if the input files have things that look like PHP tags that you don't want to change. --Sean 14:00, 20 July 2010 (UTC)[reply]
Yes, it would, but I just wrote it in sed instead. I hope that <?=/<? print and <?/<?php are the only replacements that need to be made. -- kainaw 14:17, 20 July 2010 (UTC)[reply]

I'm trying to "compile" a QT program. I have no idea what I'm doing, but I downloaded Qt Development Tools and installed it. Now I'm trying to make the source files I downloaded for the program I'm trying to "build", but I'm clueless. I tried Qt Created and "run qmake" which finally outputted an exe but when I tried to run it it kept asking for a load of .dll files, one of which was 140mb in size. What am I doing wrong? 82.43.90.93 (talk) 16:51, 20 July 2010 (UTC)[reply]

Have you acquired all of the DLLs the program is requesting? If so you may want to check the source code to ensure the program is looking in the correct location for them. It would easier for people to help if you let us know which program you have downloaded. AJCham 20:01, 20 July 2010 (UTC)[reply]
Or rather, one of us can check the source code and tell you which directory the program is trying. AJCham 20:03, 20 July 2010 (UTC)[reply]

Digital Images edit

Like all computer software files, digital images are made up of 0s and 1s. Then how can we open them down to 0 & 1s and see actually how are they made etc.  Jon Ascton  (talk) 19:50, 20 July 2010 (UTC)[reply]

A hex editor is what would typically be used to edit or analyse a file at the binary level. It doesn't actually display binary, but every hexadecimal pair is directly convertible to an 8-bit byte (eg. 5D = 01011101). I don't know what you intend to learn of a digital image file from its binary however. Mind sharing? AJCham 20:10, 20 July 2010 (UTC)[reply]
The 1s and 0s of an image file are really pretty meaningless by themselves. They don't necessarily correspond to individual pixel values or anything like that (raw image formats are the exception to this). Of more interest is probably the specifics of any given image format, which tells how 1s and 0s (in hex form) store the actual image data. --Mr.98 (talk) 20:35, 20 July 2010 (UTC)[reply]
I have recommended GNU Octave before, because it will simplify the process of reading an image, and load its decoded values as a matrix of numeric values that directly represent pixel intensity levels for each color. One command - imread - will open most common image file formats, automatically convert them to a bitmap image, and produce the matrix of pixel values for that image. This may be more intuitive than a hex-editor; though strictly speaking, it is not bit-identical to the file on disk (it has been decoded into a bitmap, and any meta-data or headers have been stripped). If you care about the actual bit representation of the file, then a hex editor is what you need. "Nobody reads binary" - rather, almost nobody reads binary (because it is unwieldy), it is much more common to read hex, which is why there are so many hex-editor tools and so few binary-editor tools. Experience and memorization will help you look at a hex-code and decode its value quickly to either a decimal numeric value or a binary bit-vector, as the context requires. Most of the time, you will write or obtain a program that interprets the binary for you and present output in a human-consumable form (in a sense, that's what any image-viewing software is doing for you). Nimur (talk) 20:39, 20 July 2010 (UTC)[reply]

Yesterday I got an "OfficeConnect dual speed hub 16" for £4. It has 16 ethernet ports on the back (presumably where it gets it's name from). I have some questions;

  1. how exactly do I use this thing? Can I just connect my computer into one of the ethernet ports and it will work it out itself? My computer is Windows 7 / XP
  2. can I plug my internet ethernet cable into the hub and all other computers connected to the hub as well will have the internet?
  3. does this thing eliminate the need for a cross-over cable?

Thank you 82.43.90.93 (talk) 21:08, 20 July 2010 (UTC)[reply]

Yes, yes, and yes. Here is the manual for your hub. Our article Ethernet hub may be of interest, also. For the record, it's hard to find hubs nowadays; this part appears to have been from around 1998; nowadays network switches are much more common. Comet Tuttle (talk) 21:57, 20 July 2010 (UTC)[reply]
That's awesome, thank you! :D Why are network switches more popular than hubs these days? Do they do everything a hub can do and more? Also, is it possible to change the mac address of a hub? 82.43.90.93 (talk) 22:07, 20 July 2010 (UTC)[reply]
Here is a nice comparison of hubs vs. switches. Apparently the biggest thing in favor of a hub used to be its price, but switches have gotten cheaper. Switches are apparently smarter about traffic handling than hubs, which probably won't matter much for casual use. --Mr.98 (talk) 22:42, 20 July 2010 (UTC)[reply]
Hubs are dumber than switches. Once you have your network set up, every time you watch a YouTube video or look at a Wikipedia page from computer #1, every single data packet is going to get broadcast through every port in that hub, which will cause many, many packet collisions for computer #2. This isn't fatal, but it will slow down network performance. Switches actually look at the data packets and only route them to the appropriate port. Hubs don't have MAC addresses; as our Ethernet hub article states, they basically just wait for an electrical signal, and then repeat it on all the other connected ports. All that said, of course — a good buy for 4 pound! Comet Tuttle (talk) 23:40, 20 July 2010 (UTC)[reply]
It should be said that for "normal" networks, a DHCP server and (usually) a router are needed - a hub does neither of these things. Usually, if you have a router or a cable-modem (often a modem + network bridge), then that device fulfills the DHCP role as well; you just connect it into the hub, and everything works. However, if you have no router, and just connect the hub straight to a PC that is not configured to "share network connection" (or more completely, to serve as a DHCP server and router), then the hub can't facilitate IP-based networking on its own. You can work around this by assigning static IPs; assigning static routes; or setting up a hardware or software router. Nimur (talk) 01:02, 21 July 2010 (UTC)[reply]
If Windows XP/7 is configured to automatically set up the network and it cannot find a DHCP server, it will fall back to a Link-local address. That will be sufficient for computers on the same hub to talk to each other, but not for sharing internet access. Unilynx (talk) 02:44, 21 July 2010 (UTC)[reply]