You are viewing dwmalone

David Malone's Journal
 
[Most Recent Entries] [Calendar View] [Friends]

Below are the 20 most recent journal entries recorded in David Malone's LiveJournal:

    [ << Previous 20 ]
    Thursday, December 5th, 2013
    9:07 pm
    Chirality
    Chirality is basically a fancy way of saying "handedness".
    Sunday, December 9th, 2012
    6:58 pm
    FreeBSD Soekris serial console
    I keep meaning to write down a reasonable set of options for making the serial console for booting FreeBSD on a Soekris box work well, so I don't have to keep looking them up. In the BIOS, set ConSpeed=19200. Next, in /boot.config add -P -S19200 - this tells the boot blocks to use a serial console at 19200 if there no keyboard attached. Then, in /boot/loader.conf add

    comconsole_speed="19200"
    console="comconsole"
    boot_serial="YES"

    which does the same for the loader. Finally, make sure that /boot/device.hints has either hint.uart.0.flags="0x10" or hint.uart.0.flags="0x30". On older FreeBSD systems this would be sio rather than uart.

    You may then also want to enable a getty at 19200 in /etc/ttys.
    Sunday, October 14th, 2012
    8:12 am
    POLA
    The oldest reference I can find to "principle of least astonishment" on Usenet is in comp.sys.amiga in 1988, though the new google groups interface seems to have trouble sorting by date (feedback filed).

    Using ngram, it seems that there is a much earlier reference in "Information Retrieval: Ground Rules for Indexing" from 1963.

    (The alternative versions from wikipedia, replacing "principle" with "rule" or "law" and/or "astonishment" with "surprise" look like they are probably newer.)
    Wednesday, September 26th, 2012
    6:16 pm
    Price of a pint
    The Economist had a nice chart showing long you have to work to earn 500ml of beer. However, they didn't include a link to the original report and didn't include Ireland (for shame, tomorrow is Arthur's day)

    I can find the average hourly wage on the CSO site and it looks like the average is usually about 120% of the median, so I reckon the median wage must be about 18.25.

    According to pintprice.com (and it's roughly backed up by finfacts.ie, who have historical data on the ratio of pint prices and average incomes), the average cost of a pint is about 4.50. So, for 500ml of beer you work for 60*4.50/18.25*500/473, or 15 minutes 38 seconds. That puts us between roughly Mexico and Britain.
    Saturday, September 15th, 2012
    7:23 pm
    TS -> mp4 -> DVD
    Today I converted a YouTube video to a DVD for one relative, and converted a programme recorded using out DVB-T&S DVR box into a DVD for another. It took a bit of fiddling around to find a smooth path for both, but the following seems to work.

    For YouTube, I used a Firefox plugin to download the mp4 video. Then I used iDVD on my Mac to make the DVD: you just drag the video file into the menu, then can drag a picture into the background and finally you click on the Burn icon.

    For the DVR recording, I copied the .ts file from the DVR. Then I used Handbreak to convert the .ts file into mp4. The file contained not just the programme, but some stuff on either side, so I used Quicktime's "Trim" then "Export" to produce a new mp4 file. Then I followed the technique above for creating the DVD.
    Tuesday, November 8th, 2011
    9:09 pm
    Adverbs
    This list of non-errors in English reminded me that CA has a nice regularisation in his grammar at the moment. He must know that adverbs often end in "ly" in British English, so at the moment, somethings are done "fastly" and "hardly". We did get "goodly" for a bit, but it seems to be less common now.
    Monday, October 31st, 2011
    8:05 am
    Ping User Process
    The search "ping user process" found David Mills's copy of the Fuzzball router code. The help file has sample output from ping dated 22-Aug-81. While the help file is considerably newer, that's an indication of how far ping might go back.
    Saturday, October 22nd, 2011
    8:59 am
    Random Numbers
    A long time ago, I wrote a section on randomness for FreeBSD's /dev/random manpage - you can find it by scrolling down to the section called "RANDOMNESS". I wrote it because arguments about randomness often seem to crop up on mailing lists, and people end up talking at crossed purposes because "randomness" has several meanings, and unless you agree which aspect of randomness is important, you're unlikely to reach agreement about how to implement it.

    For example, Julienne Walker's article gives some interesting advice on the use of the C rand() function. I think the author's focus is on uniformity, but that isn't clear, and they don't spell out why each code snippet is good or bad. I think they assume that rand() actually returns ints uniformly in the range 0..RAND_MAX, and are worried about how to map that uniformly into a number of boxes.

    If that's the case, then rand()%N is slightly bad because if N doesn't divide RAND_MAX, then the lower numbers in the range will have slightly more weight. Also scaling rand() by using division won't help, because the number of outcomes in 0..RAND_MAX simply can't be mapped evenly into 0..N. This is why the trial-and-discard version works, because it throws away the outcomes that don't map into the range. There's a slightly more efficient version of this discard code used to implement arc4random_uniform(), where you reduce the probability of rejecting outcomes by packing as many copies of 0..N into 0..RAND_MAX as possible, which makes sure the probability of acceptance is at least 0.5.

    I think the floating point uniform deviates code given in the article will not produce uniform output in the limit, because it maps 0..RAND_MAX outcomes to 0..N. However, the mean will be pretty close to right, so if you're using your outcomes as numbers, rather than discrete boxes, the difference won't be so bad. I can't say I understand the integer version of the uniform deviate code that's given in Julienne's article - it just looks like you couldn't depend on it working for a host of rounding/truncation issues.

    [I also don't really understand the problem with seeding from time_t. In C99, time_t is an arithmetic type, so you can have a go at converting it to an unsigned int. It's true, that its units might not be seconds, so the resolution might not be good. I guess fanf could tell me?]

    David Jones's advice is also worth looking it. It's fairly clearly focused on numerical simulation, which mainly needs to get samples in the right part of the numerical range. I mostly agree with the device here, but I'm not convinced that people should write always implement their own RNG, because writing portable code is hard. With that in mind, I had a read through the code, looking for portability issues, and there are some (Read moreCollapse )
    Thursday, September 29th, 2011
    10:09 pm
    Ping!
    Inspired by a question on Twitter, I though I'd check where the ping command came from. Checking in Google Groups, I found a post from 1985 from Jeffrey Mogul with the source code for a ping programme, originally written by Larry Allen in November 1983.

    In the historic BSD source code, it seems that ping appears about 1983, just after BSD 4.2. The version here is written by Mike Muuss and dated December 1983. December 1983 also brings RFC 889 by David Mills, which describes network delay experiments conducted between October and November 1983. It says that "Among the various measurement packages is the original PING (Packet InterNet Groper)
    program used over the last six years for numerous tests and measurements of the Internet system and its client nets." There doesn't seem to be any mention of ping in the RFCs before that.

    This hint lead me to Mike Muuss's page about ping. It says that Mike wrote the ping command in December 1983 after hearing Dave Mills describing using ICMP to measure delay in July 1983. Mike comments that he named it after the sound sonar made, but I'd guess that the name had been associated with the tool at this point.

    Searching around, there are some articles where Dave Mills claims credit for the term, having produced ping for the fuzzball routers in about 1980.
    Sunday, August 21st, 2011
    8:34 pm
    New Mux
    We ran the channel scan today and found that RTE1+1 has finally tuned up on the MUX at 738MHz. Even more interesting is a new MUX on 770MHz. At the moment it doesn't show much interesting - all the channels are entitled "future services", one is showing RTE News Now and the other is showing the HD test footage that was used before the official launch.
    Saturday, August 20th, 2011
    8:35 pm
    Gender Pay Gap
    Just flicking through the CSO's National Employment Survey, which also has some comparisons with the rest of Europe. Who would have though that Germany would have the 4th largest "Unadjusted Gender Pay Gap" - fourth after Estonia, Czech Republic and Austria.
    Tuesday, August 16th, 2011
    7:35 pm
    Who'd have thought...
    Cilantro is just coriander leaves!
    Friday, July 1st, 2011
    9:38 pm
    RF Possibly Carcinogenic
    The International Agency for Research on Cancer put RF into the "possibly carcinogenic" box a few weeks ago, their press release is here. The list of possibly carcinogenic things is quite interesting, and includes some nasty stuff (like petrol and lead) and some more everyday things (coffee and using talc on your nether regions).

    I was rather disappointed to see that their report was not yet available. A summary of the decision has turned up in Lancet Oncology Online, and is available for downloadable if you register.

    Both the article and the press release are worth a read. They say there's limited evidence (which means the results could be by chance) for an increase in certain cancers and inadequate evidence for others. Here limited and inadequate seem to be technical terms they use. The INTERPHONE study, which showed a 40% increase for the heaviest group of users, seems to have have split people into ten groups and used a 95% confidence interval on each group, so I guess they have a pretty good chance of getting some result by chance. The Swedish study they describe sounds a bit more convincing, and they skim over the details of some earlier studies that didn't show any correlations. A few members of the committee felt this evidence was inadequate rather than limited, so I should track down the papers and read them for myself.

    Interestingly, they note that 3G can operate with much lower power than GSM (when the base station is close). I should check this out, as I don't know much about power control in 3G and GSM. I wonder if that means femtocells could actually reduce your RF exposure?
    Friday, June 10th, 2011
    9:30 pm
    VSWR and Lumped Elements
    VSWR seems to be important to people who design antennas and radios - it's something to do with how much of the power your radio outputs actually makes it to the antenna and how much is bounced back into your radio. This can be bad for high-power radios, as you can fry parts of the electronics if too much power is reflected back. I got the basic idea of VSWR while studying for my lisence, but didn't really I'd understood what was being reflected and why.

    Reflection of something usually relates to waves, and you usually have to be pretty careful how you think about waves 'cos they do weird stuff (like being refracted or reflected). My understanding of waves is somewhat limited, so I'd usually try to understand what's going on by writing down an equation for the system, and trying to figure out where the wave comes in.

    For example, in a circuit with a resistor, inductor and a capicator you know that the sum of the voltage drops around the circuit is zero, and that V = IR for the resistor, V = q/C for the capicator and V = dI/dt L for the inductor, so if put all that together, you get a simple second order differential equation, and so has nice solutions in terms of sin and cos, so you get oscillations.

    This approach for circuits works fine if you assume all your components are tiny, and so the voltage doesn't vary along them. I wasn't sure how you did this for wires when you're sending a signal along that has a wavelength comparable to the size of the wires. It seems you can basically do the same trick, but treating each bit of wire as a resistor and a inductor with a bit of capacitance between wires. With a bit of work, you get a (partial) differential equation, which happens to be related to the wave equation.

    Now, since a wire is a 1-dimensional system, you find that at each frequency there are basically two possibilities for the steady state: a wave goes one direction or the other direction. If your radio puts a signal on the wire at one end, you imagine that you have some voltage source driving the signal in the direction you want. The full solution then has to be a sum of what you drive in one direction plus a wave in the other direction, which depends on the properties of the cable. You regard the wave going in the other direction as a reflection of your original signal. The sum of these two produces a standing wave in the voltage amplitude, which you can measure using a Voltage Standing Wave Ratio meter.

    The reason this is important is because if you design your parameters carefully enough, you get no reflected part, and all the power your radio produces ends up in the antenna, where you wanted it. This often called "antenna matching" or sometimes "antenna tuning", though tuning seems to be regarded as a misnomer, because you usually try and match the impedance of the radio, cable and antenna.
    Sunday, May 15th, 2011
    11:36 am
    Fisher-Yates
    A Fisher-Yates shuffle and Algorithm-P are basically the same thing. I was interested in Algorithm-P after trying to figure out how votes should really be shuffled.
    Monday, May 9th, 2011
    9:06 pm
    Words Mark 2
    Hiya, This, Tata, Uh Oh, Deedeen (CA), Dada (Mommy or daddy), Dayday, Byebye, uffuff (woof woof), EhTeh (Eiffel Tower), Teejay, Allgoh (All Gone).
    Wednesday, May 4th, 2011
    9:16 pm
    Three Phase Main
    I tried some powerline ethernet stuff in a house with a three phase main at the weekend. It does actually seem to work OK between phases. I expect that it should work fine between houses too, but I'll have to talk to some friendly neighbours to check that.
    Sunday, May 1st, 2011
    9:05 pm
    More Trees than Wood
    I've added a couple of things to my page about seeing the wood for the trees. First, while doing my prep for my Ignite talk last year, I discovered an earlier use of this phrase in Early English Books Online in a book by Thomas More, which gives a usage about ten years before any I've seen mentioned in a dictionary.

    Second, I got a copy of the Random House dictionary of Proverbs and Sayings. It has some nice examples of usage, including
    1994. See the forest? The world bank can't even see the trees. - New York Times.
    Finally, using Google's Ngram Search, I had a go dating the phrase in different languages. It gives some indication of when the phrase was in use, but based on the earlier references that I know about for English, it seems like more digging would be needed.
    Read more...Collapse )
    Thursday, April 28th, 2011
    9:05 pm
    Counting the Votes
    Voters per seat in recent Irish elections:

    Seanad Taoiseach's nominees 0.09,
    Seanad Vocational Panels 24.8,
    Average Counciler 2129,
    Seanad University of Dublin 5185,
    Seanad National University of Ireland 11271,
    Dail Dublin North Central 17664,
    President 1269836

    Numbers from wikipedia and various spreadsheats that are doing the rounds.
    Tuesday, April 26th, 2011
    9:11 pm
    Spin the Bottle
    Someone showed me the vortex technique for emptying bottles a few years ago. You shake the bottle in a circular motion to get a vortex going as you hold the bottle upside down to empty it. There's a video showing the vortex trick.

    The vortex technique is supposed to be quicker than just emptying a bottle, because you get a gap in the middle of the vortex that lets the air in, so you don't get the glug-glug-glug that's associated with turning a bottle upside down. I though I'd check this, so I collected up some bottles, a stop watch, a bath full of water and a four year old helper.
    bottle type time to empty
    with vortexwith glug-glug
    Kia-Ora5.10, 5.22, 6.6611.81, 10.05, 10.34
    Coke5.1, 5.5, 3.86.8, 5.5, 6.9
    Fraoch Beer4.53, 4.65, 4.566.65, 7.37, 7.15
    West Coast Cooler6.7, 4.47, 5.189.35, 9.66, 8.68
    Matey Sailor8.40, 7.97, 6.568.18, 9.66, 8.22
    Matey Octopus7.06, 6.09, 5.628.31, 7.67, 7.75

    Despite the measurement errors introduced by the combination of water and four-year olds, it seems fairly clear that it is faster to empty the bottles with the vortex method. I thought that the numbers might be too noisy to be able to check this with statistics, but even R's one-sided t-test seems to agree!

    So, for a range of bottles (glass/plastic, long/short neck, round/irregular, ...) it probably is faster to empty them with the vortex effect. It also is more fun, which is why I'd wondered if the effect was just psychological in the first place.
[ << Previous 20 ]
My Website   About LiveJournal.com