Saturday, October 4, 2008

dos

In 2008, this guy is still including dos.h.
Vista's command prompt still uses DOS commands.
In Romania, certain high-school programming contests are still happening in Borland C (on DOS), and many high-school students are still learning programming in Borland Pascal (on DOS).
A few weeks ago a 1990s program didn't work in dosemu with a USB-to-RS-232 converter. Was it failing because of the high clock speed, like the Pascal library? Was it written like the guy's code? Was it failing because the serial converter wasn't emulated accurately enough? I don't know.
Anyway, I thank Microsoft for removing the serial ports from desktop PCs and notebooks (they're not called laptops anymore, because some dissipate too much heat to allow comfortable use in one's lap).
Apart from the once ubiquitous but now outdated dial-up modems and serial mice, serial ports are actually useful for a huge lot of devices and tasks, such as:
  • dial-up modems. Over mobile GPRS or satellite.
  • serial mice. Why occupy a hi-speed USB port with a low-speed mouse? (if you happen to want 2 or 3 mice on your system)
  • serial barcode scanners
  • small serial printers (frequently used for printing receipts)
  • uninterruptible power supplies
  • networking (wireless modules for interfacing low-power sensor networks, for instance. The networks run IPv6, btw.)
  • GPS receivers
  • mobile phones and PDAs (some mobile phone "USB data cables" are actually USB-serial converters)
  • a huge variety of industrial and laboratory instruments (meters, process controllers etcetera)
  • infrared communication (with mobile phones, PDAs, instruments etc)
  • serial console for configuring and debugging routers and other embedded systems and screenless devices. Frequently used by network administrators.
  • microcontroller programming, homebrew hardware, firmware upgrade for various devices
  • small auxiliary text-mode LCD screens to display what song you're playing or what mail you've got or whatever
  • infrared remote control receivers (for controlling your computer from the comfort of your bed/armchair/whatever)
  • low cost, easy to build laser links between buildings (with enough speed - 92kb/s - to stream medium-quality audio, transfer documents or work in a remote shell)
  • etcetera.
There. Fuck you, PC 97.

Monday, September 29, 2008

imaging

I was watching some mediocre movie where the actors were playing detective on an open hard drive. Weird, negative chars filled the hexdump, with an occasional readable string.
"It's an image!" the guy exclaimed upon reaching a "²¡¤³§«©±°something.jpg⊧⊤⊧⊩⌬".
"Let's see it!" said the chick.
The image is slowly loading.
"It looks digital", the guy wisely concluded.
No shit Sherlock! Wow, they actually did not use a VHS recorder on those platters, those are actual BITS, wow.
Fortunately there's at least one professional photo* guy on the webs who maintains that digital sensors are not intrinsically different than film when it comes to capturing images.
-----
* about 3/4 down the page: "there's nothing at all digital about that look".

Wednesday, September 24, 2008

puţa

It's now Google's turn to show me questionable advertising. True, this is not spam per-se, but it's close:
Translation:
Penis enlargement 6 cm - Total satisfaction or your money back. 100% Guaranteed, test it for free!

I find this situation truly alarming, as I usually receive useful advertisements in the WebClips, and I certainly believe Google to be a reputable company that adheres to higher standards.

пр0н

I've started getting spam in Russian:


Translation:
pussy - Huge boobs video clip

I hate spammers.

Tuesday, August 26, 2008

waste

Look at what people at some Indian atomic research center are producing.
Simply put, the guy comes up with a "clever" way to measure stuff using a lot of "general purpose" chips, instead of the obvious, straightforward solution that everyone uses: a programmable microcontroller. He gives a complicated schematic that underutilizes an expensive component and needlessly employs another expensive component. It's more of a novelty, an academic curiosity (though not a particularly interesting one), than a sane product.
Table 1 below lists approximate prices for the components in the guy's design:

Component Price Link
-------------------------------------------------------------------
DLP-USB245M* $25 http://www.dlpdesign.com/usb/usb245.shtml
MAX187CCPA** $14.81 https://shop.maxim-ic.com
74LS164*** $0.49 http://www.futurlec.com/IC74LS00Series.shtml
74LS90 $0.49
74LS74 $0.29
74LS132**** $0.30
R,C etc. negligible
--------------------------
Total $41.38

Table 1: Guy's Bill of Materials
*not an actual "general purpose" component, at least not as general purpose as a 74LS chip, and certainly less general purpose than a microcontroller; to save money, it could be replaced with just the FTDI IC, crystal and USB socket, because you don't actually need to include a prototyping module in a production device (unless you can't solder SMD).
**the weakest performance variant
***74LS parts could probably be found for cheaper, for instance $0.37 for the '164 at www.ti.com, but for 1000 units.
****implied, part number not listed on schematic

So that's 42 bucks just for the parts. Given that there are a lot of parts, the PCB is going to be big, so that's also going to cost a bit. Also, using just 8 of the 12 bits the 15-dollar ADC gives out, now that's pure waste. Nobody gives a crap about a data acquisition system that gives 8 bits (256 levels), unless it's very very fast, which this isn't. The author states that the system can be modified to make use of the full 12 bits, which is reasonable, but no schematic is given, and I have a hunch it would require at least one more 74LS chip.

Now here's the proper way to do it. A lot of manufacturers offer microcontrollers with integrated USB circuitry, as well as on-chip ADCs. So there go the two most expensive components. Plus, a microcontroller, being programmable, that is, having code, and memory, can do a lot more interesting functions such as calibration, unit translation, alarms, outputting control signals, whatever. Plus, a lot of microcontrollers have many analog inputs, so they can measure more than one thing, unlike the guy's design. And they're cheap, very cheap.
My idea would be to use an AVR microcontroller, such as the ATmega8. Using the software-only USB implementation kindly provided by obdev, and the internal ADC of the ATmega8, I can measure 8 voltages with 10 bit resolution (4 times finer than the guy). Moreover, I can increase the resolution in software by using oversampling. Well he can do that too actually, but I can do it in firmware which is nicer. And my PCB will be much smaller and cheaper, because I only use ONE integrated circuit instead of 6. Table 2 below lists my costs:

Component Price Link
-------------------------------------------------------------------
ATmega8-16AU $2.23 http://nuhorizons.com
USB socket $0 - low-speed device mandates captive cable
(like in USB mice)
R,C,D etc. negligible
PCB less than the other guy's
--------------------------
Total $2.23

Table 2: Proper Bill of Materials

As you can see, it's much cheaper, and much simpler to manufacture (therefore even cheaper). It will be slower and it probably won't pass USB certification, but it works. Using a proper USB microcontroller would make those two problems vanish and still cost no more than about fifteen bucks.

Table 3 below summarizes the results of my analysis:

Designer Price (excl. PCB, enclosure etc.)
-----------------------------------------------
Atomic Guy $ 41.38
Me $ 2.23

Table 3: Comparative Wastage

There. More than 18 times cheaper, and much better specs. Waste.

Saturday, July 26, 2008

idiocy

1. I stumbled upon some show on some channel where they were showing some stuff and then blurring some other stuff "for security reasons" or something like that. Good thing I don't remember. If the stuff they were blurring out was in fact real and not some "reconstruction", they'd have made a terrible mistake. Blurring doesn't "delete" any information, it just "scrambles" it. Furthermore, it's a poor scramble. Blurring does what's called a convolution, which is basically adding pixels to their neighbors. They can be easily subtracted - the frame can be deconvolved, revealing the original image. It's being used to enhance pictures that come out defocused or otherwise distorted (by analog convolution versus the digital blurring you do in the GIMP). So I hope those sequences were bogus.
2. News are getting dumber by the day. Besides the presenter obsesivelly calling some kids who pretended to sell stuff on some websites, without actually sending the items, hackers, which is insulting to all hackers on many levels, some other dude was reporting on the way cool "thousands of decibels" at some concert the actual TV station was organizing. Yeah, i'd have liked having a few thousand dB SPL there... any increase in news quality is welcome; though anything above a mere 200 dB isn't physically sound anymore, it's a blast shockwave, a concept similar to the one discussed near the end of the previous (relevant) post.
2000 dB SPL (the smallest that could count as "thousands") equals about 2*10^95 pascals (notably, almost one googol, or "ten duotrigintillion":), of them). Normal air pressure is about 10^5 Pa, or 2{90 zeros} times less.
Having failed to find what the pressure is inside a neutron star, the densest object known, let's calculate a very rough estimate. The average density of such an object is thought to be about 10^17 kg/m^3, although it varies from the surface to the center in a way I don't know, so this limits the accuracy of my calculation. Anyway, the pressure dp contributed by a layer of thickness dx at distance x from the center is dp(x) = rho(x)g(x)dx. The gravitational acceleration g(x) = Gm(x)/x^2, where m(x) is the mass contained in the sphere of radius x. Assuming a constant rho(x) for simplicity and lazyness to search for data, dp(x) = G*rho^2*(4/3)pi*x*dx. Integrating over x from 0 to R we get the pressure in the center of a homogenous sphere of density rho and radius R: p = 2/3 pi G rho^2 R^2. In terms of its mass, that would be p = 3/8pi G M^2/R^4 (the smaller, the more crushing). Doing the numbers, I get around 1.4*10^32 Pa, which is of course much, much, much less than 2*10^95; any other more accurate model would still give a result that's much, much, much less than 2*10^95. So on second thought, I wouldn't like having "thousands of decibels" anywhere, if that were possible.

Monday, June 30, 2008