Thoughts on National Computer Science Education Week
This week is apparently National Computer Science Education Week.
Code.org is organizing the "hour of code"
to promote teaching of Computer Science and Programming in schools.
They're also organizing petitions to make CS courses count as credits in
Mathematics or Science for High School graduation requirements.
In High School, my CS courses were by far my favorites, Programming in
Pascal, AP Comp Sci in Pascal, Programming in C++, and AP Comp Sci in C++ (
the language for the exam switched my junior year). I learned a lot
about structured code, elegant, efficient code. I learned enough about
Data Structures and Algorithms that I didn't have to study for my
college CS classes until Computational Structures (Discrete Math II with
Scheme, essentially) in my third semester. I had an amazing Computer
Science teacher who also taught me Calculus and the proper order of
precedence in life: God, Family, Math. I wouldn't be where I am today
without that educational opportunity I had in High School. I want others
to have that opportunity too.
However, this is where I differ with the opinion of the Code.org folks.
I do not believe that CS classes should count toward the Math or Science
requirements. In this state, CS counts toward the "practical or
performing art" requirements, I'm assuming under the "practical" label.
I think this is a better place for it at the High School level.
Computer Science is not a hard Science. It's not Physics. It's
not Biology. It's not Chemistry. There's a saying that if the subject
has science in its name, it's not really a science. That is true with
Computer Science. It's not studying the how and why of atoms, of
molecules, of living systems, of anything really. It's not science.
Computer Science is really applied mathematics. I am very fortunate that
the college program I went through was very strong in mathematics: Calc
I and II, Linear (Matrix) Algebra, Discrete Math, Discrete Math II in
the guise of Computational Structures, Probability and Statistics,
Theory of Computation, Algorithmic Analysis... the list goes on. All of
these mathematical foundations were then applied to a machine, to make
the machine carry out a task in an efficient manner. It's those
mathematical foundations that are the true core of Computer Science.
While mathematics is the core of Computer Science and Computer Science
is essentially applied mathematics, I do not believe it should count
toward the Math requirements. The CS classes would likely detract
from other mathematics courses such as Geometry, Trigonometry, and
Calculus. These courses are far too important to an education to be
replaced by a Computer Science course. Many, maybe even most, High
School Computer Science courses focus more on "programming" than the
fundamental mathematical theories. They will pick the language du jour
and teach you the syntax and semantics. They'll teach about basic data
structures like arrays, and linked lists. The AP exam currently focuses
not on implementing lists, trees, stacks, queues, and sorting and searching
algorithms, but on arrays and lists using Java library calls. This is
not math. This is learning Java syntax.
I realized that if and when I have children, they will grow up thinking
it's normal to have a DeLorean.
... On man pages, a mini-rant
I really despise the linux man pages. They're useless at best and wrong
From the man page for setsockopt: "The include file <sys/socket.h>
contains definitions for socket level options, described below."
1) The options are not "described below."
2) No, that file actually doesn't contain those definitions.
On the other hand... The FreeBSD man page for setsockopt does actually
describe the options and under FreeBSD the <sys/socket.h> file does
indeed contain the definitions.
I hate bash. I hate it. I hate how it bastardized bourne by adding
half-assed implementations of features from ksh and tcsh.
Problems with loader.conf
First the background. The story of how I got into this mess:
I'm trying to get ACPI working on my laptop under FreeBSD. Specifically,
I'm trying to get Resume to work properly. Suspend works, and resume
seems to partially work. The fans spin up, the keyboard's backlight
comes back on, but no screen. And without video, it's a little hard to
figure out what's going on.
ACPI works great on my server. It's running the same FreeBSD 9.1 x86-64
build that the laptop is, but the biggest difference is that it's an
intel motherboard. The laptop is an Alienware, for our purposes, I might
as well just call it a Dell.
I started comparing the ASL output from both machines and noticed some
things. First, the Alienware's ACPI implementation looks for the OS to
be various forms of Windows or "Linux." The intel ACPI implementation
also looks for these Windows variants and "Linux" but it has an
additional OS string. It has an entry for "FreeBSD."
I figured the easiest next step was to use iasl co compile the intel ASL
source and load that DSDT onto the laptop.
I calculated the odds it would work vs the odds I was doing something
incredibly stupid... and I went ahead and did it anyway...
I compiled the asl and I set /boot/loader.conf to override the DSDT with
the intel one I had just compiled and I rebooted. At first everything
was good. The machine went down, I got the boot loader, and the FreeBSD
kernel started to load. Seconds into the kernel load, it rebooted
itself. After the second time, I powered off and tried a cold boot. Same
problem just as I had feared.
Now i was in a situation where I couldn't successfully boot because of
an error in loader.conf I needed to find a way to edit it.
And here's the solution:
The FreeBSD bootloader, like many others, works in stages. At a certain
point, it can be interrupted at which point it provides a set of simple
yet powerful commands to control various aspects of the loading process.
If you still have that default menu at load, I beleive the option to
chose is 6. I disable that menu so during a brief countdown I hit escape
before the boot loader turns control over to the kernel.
Once in the boot loader prompt, I entered the following commands:
Pretty simple right? The unload command does what it says, it unloads
the kernel and any modules loader.conf had pulled into memory. The load
kernel command grabs the kernel and loads it into memory... but only
the kernel thus ignoring the broken DSDT in loader.conf. And of course
boot tells the boot loader to continue booting the system.
Once booted, I removed the bad DSDT from loader.conf.
Good night, demonslayers.
This mobile text message is brought to you by AT&T
Content-Type: text/plain; charset="Windows-1252"
Sent from my Windows Phone=
Content-Type: text/html; charset="Windows-1252"
Sent from my Windows Phone
Corning is a quaint little town. Looking forward to exploring.
This mobile text message is brought to you by AT&T
WARNING: possible TMI
I thought I had healed from the chafing left after Saturday's River to
Sea Relay... Until I ran in the rain yesterday. To quote a friend, "It
feels like someone took a cheese grater to my crotch."
Windows 8.1 in Virtual Box
I was attempting to run the Windows 8.1 Preview in a VM using
Sun's Oracle's Virtual Box on a Windows 7
host. I ran into a minor problem.
The OS wouldn't boot. I received an error stating:
Your computer needs to restart.
Please hold down the power button.
Error Code: 0x000000C4
Looking for the error code online led me to this
describing the issue and a fix. The key to fixing this was
running the command:
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" setextradata "" VBoxInternal/CPUM/CMPXCHG16B 1
The CMPXCHG16B is an instruction in 64-bit X86 processors that allows
for atomic operations on octal words.
Excluding directories while using pax(1)
My primary disk is failing. There are large segments that are generating
low level IO errors during read or write operations. Most of the files
written to the bad area were under /usr/ports/ where the FreeBSD Ports
collection is installed. A few files were under the web server's root.
Figuring I'd take care of things prior to the disk actually failing to
the point of it being irrecoverable, I purchased a new disk early. I
installed it, partitioned it, and formatted it.
To copy the data over, ignoring the areas that were causing the IO
errors, I used mv to "move" the files from the web root under /usr/ports
and used the following command as root:
pax -rwvpe -s':/usr/ports/.*::gp' -X / /mnt/newdisk/
The -X prevents pax from traversing into mount points that have a
different device ID than the one on which it was started. This prevents
an infinitely recursive loop from happening when the new disk's mount
point would have been hit. It also prevents data on the non-failing
disks from being copied as well.
the -s option allows for sed search and replace scripts to be run. In
this example, the : is used as the delimiter and any path matching
/usr/ports/* is replaced by a null string. With this replacement all
directories under /usr/ports are excluded from the copy.
PATIENT: "The problem is that obesity runs in my family."
DOCTOR: "No, the problem is that no one runs in your family."