Contextless notes I took from watching 90 minutes of creation science.

Dr. Kent Hovnid’s six-parter which he sells with “why evolution is so dumb” as a sizzle reel. Taken on two index cards with a pen I wanted to try out. I specifically seek out material I don’t agree with on its face just in case I’m being stupid. So, I end up looking into things like young earth creationism. The piles of strawmen are enough to create the world’s largest most-flammable army. Notes after the fold.

Details »

Protected: Your job, and the doing of it.

This post is password protected. To view it please enter your password below:

A C+ essay I wrote five years ago.

I was looking through my Google Drive and found this “gem” from 2006.


Antigone, the third of the trilogy of Theban Tragedies written by Sophocles, has a central conflict between the title character and a newly anointed king, Creon. At the base of the conflict lies Antigone’s perceived responsibility to her dead brother, and Creon’s perceived need to never vacillate before the people of Thebes. This, all following the tumultuous events of the two prior plays, leads a reader on a tightrope walk of civil unrest on one side, and tempting the anger of the gods on the other.

Antigone should be lauded for her knowledge that her acts are more in line with divine law than the will of her king. In realizing that the acts of one man, even a supreme ruler should not contravene those of the immortal, Antigone has firmly put herself on the side of those who would value the quality of their afterlife. When asked by Creon if she was aware of his proclamation, banning the burial of her brother, she replied “Yes. Zeus did not announce those laws to me”.

Her reasoning are well understood by all, including the king Creon, which quickly marks her for death for her aiding an enemy, even family, even in death. This decision quickly becomes one that would hold dire consequences for his rule. Said the wise oracle Teiresias “Our state is sick—/Your policies have done this In the city/ our altars and our hearths have been defiled” (1127-30) Creon, perhaps drunk from the power of his recent promotion, does not hesitate when told, even earlier in the play “Death? She deserves a glowing crown of gold!”/So they say, and the rumour spreads in secret,/darkly . . .” (782-3)

Antigone has shown remarkable steadfastness in her convictions, which is remarked upon by the Theban elders:

It’s clear enough the spirit in this girl is passionate—her father was the same. She has no sense of compromise in times of trouble. (534-8)

That lack of compromise is what makes a person a hero in the most traditional forms, in the Hellenistic tragedy.

It would be said, however, that Creon’s own situation was far from ideal. Taking over a kingdom he was one year prior 4th in line to rule, he had little support amongst the populace. In his dealing with the prophet, Creon’s position is apparently untenable, with little hope of coming through the situation with a positive outcome. It’s this situation, where someone would choose their “job,” instead of their family, not to mention divine right, which makes Creon the villain in Antigone.

After studying the three Theban tragedies thoroughly in high school, on three separate occasions, it occurs to me that regardless of decision, all who stand before fate are inviting doom. With that said, to stand against those who rule the world beyond would seem the height of folly. Antigone, in Antigone, therefore, by showing remarkable forethought (especially for a female in the not-quite-liberal negative fifth century) and devotion to her kin, truly deserves to be lauded.

Social Network Roundup – September 2012

A hand-picked selection of only the finest crap I posted on social networks in the month of September 2012.

Interrogatives:

Cooler rap character: Mr. Me Too or Captain Save-A-Ho?

[The Last Boy Scout] isn’t this the pinnacle of buddy cop movies? TV pants? Satan Claus? http://www.youtube.com/watch?v=WAGPeBs0G1I

Hey guys, remember when Steve Jobs called the pack-in headset with the original iPhone as “sounding great”? or when Apple sold a bluetooth headset?

Assertations:

Hey guys we get it you like the Big Lebowski now is the time to shut the fuck up about it.

Fun fact: If someone ever says they have an allergy to MSG, you’re talking to a ghost because they are dead.

Guys the new grossest thing I’ve seen in A Target softline department. [photo redacted]

James Woods was really good in The General’s Daughter, especially given how pseudo-fancy his character was written.

Read about liberation management today. Sounds like some of the academic teams I hang with already are doing this.

Hard drives get warmer due to air resistance because the thing’s spinning about 7.8 million times faster than earth.

Guys, I think Imaginary Player might be the best Jay-Z song.

Being famous must be crap because i swear 2/3 of pop music is bitching about it.

I just saw a hood rat Sarah Palin. #boners

The owl, a nocturnal hunter, was initially adopted as a symbol because Temple began as a night school for young people of limited means.

Things you could read:

The Doc Fix Myth And The Right’s Misinformation Feedback Loop: http://www.tnr.com/blog/jonathan-chait/the-doc-fix-myth

Let’s Play Archive – Star Wars: Knights of the Old Republic II by Scorchy http://lparchive.org/Knights-of-the-Old-Republic-II/

The Ideological Fantasies of Inequality Deniers: http://nymag.com/daily/intel/2011/10/the_ideological_fantasies_of_i.html

SPECIAL #FFF EDITION – ANONYMOUS: http://pastebin.com/nfVT7b0Z

It may not look like it, but Octodad may be one of the sadder, more thought-provoking games at PAX: http://penny-arcade.com/report/editorial-article/it-may-not-look-like-but-octodad-may-be-one-of-the-sadder-more-thought-prov

Aspirations:

Yeah son I’m building a PBX VM so when you call me I can put you on hold to music.

Maybe I shouldn’t pay for iTunes Match: http://guides.macrumors.com/Keeping_two_iTunes_libraries_in_sync

I’d like to buy this thing: http://neogeox.com/NeoGeo/NeoGeox

Thinking about buying an old BIOS-locked IBM Thinkpad: http://sodoityourself.com/hacking-ibm-thinkpad-bios-password/

Consumptions:

The Ricky Gervais Show: http://www.youtube.com/watch?v=BpJPfpJQzwA

Danny Brown – Grown Up: http://www.reddit.com/r/Music/comments/zjoc5/danny_brown_grown_up/

Redlight – Get Out My Head (Joker Remix): http://www.youtube.com/watch?v=IxqcBUxAS7U

Diplo – Set It Off: http://cull.tv/#!/v3522521/3522521

Lawls:

Radioshack manager (peep the shirt, yo): http://www.okcenemies.com/image/25661296223

Horse girl problems: http://horsegirlproblems.tumblr.com

TheToddTime.com: http://web.archive.org/web/20071225222953/http://www.thetoddtime.com/

“Awesome” Conspiracy theorist drivel: http://www.bibliotecapleyades.net/luna/luna_apollomissions10.htm

It’d be nice to do this more often, huh?

Quit Blog: I may of been smoking for 20 of the last 24 months. (Day -n) [n | 9 > n > 0]

For some reason, perhaps due to some magic of SEO or quirk of wording, the post popular search terms for my untended backyard of a blog is the handful of posts I wrote about quitting smoking I wrote in the summer of 2009. From a content standpoint its for the best, because I managed to start smoking again that December. I recall that I was under a lot of stress due to final exams for some classes or some other temporary hassle and managed to make a super-bad decision to take the edge off with some butts.

So again, I prepare myself to cease being a smoker. I’ll say this: the quitting with most kinds of nicotine replacement therapy is actually more akin to quitting some a few times, that is, each dosage, at each juncture, there’s a bit of the old cravings and withdrawal. Thinking about over-the-counter cessation methods, I again am choosing the patch. The main attractions being that:

  • The patch is significantly easier to deal with than a lozenge or gum to actually use.
  • The patch works overnight, so I can tamp down on the waking-up cravings (this brings me to another point)
  • The patch seems cheaper, per-day/per-dose, than the alternatives.

Since George Carlin mentioned it quite a few years ago, I’m sure that most people have a good handle on support group jargon. A trigger for me, addiciton-wise, is being awake in the morning with the pretty low blood pressure my family is famous for, and smoking when I wake. It helps bring me around a lot faster than a cup of coffee (I have SNPs related to slow caffeine metabolism, thanks 23andme.) or other methods. Since having a modicum of nicotine coursing past the tobacco-hungry receptors in my noggin is possible through the patch, it also helps.

I haven’t set a quit date yet, which means its easy enough to change around. It’ll be soon, I want to take advantage of a relatively responsibility-free portion of the year.

Quitting itself is something I’m comfortable doing, the harder part, and perhaps the hardest part of any war, is winning the peace.

CS3207 Quiz 4 Review

1. The test-and-set (TS) instruction and the swap instruction are part of the hardware support for process synchronization contained in modern CPUs.

True. Since test-and-set solutions rely on condition codes (stored in the PSW), the processor reads the previous instruction.

2. Although the spin-lock solution and the Peterson algorithm provide busy-waiting solutions to the critical section problem, only the spin-lock solution controls the order of entry for waiting processes.

False. Spin-locks don’t control order. Peterson’s is a busy-wait in software.

3. In class we discussed a bounded-waiting solution to the critical section problem using test-and-set. This solution works because a process exiting the critical section transferees control of entry to the next process in an ordered list awaiting entry.

True. Bounded-waiting Mutual Exclusion with TestandSet().

4. In the single producer – single consumer, multi-slot budder problem, the critical section is the manipulation of the count of the number of filled cells.

True.

5. The implementation of the operations P & V on binary semaphores only require block/wakeup, while these same operations on general semaphores require block/wakeup and counting.

False. We want this to happen at their own rate. We are looking at the count value.

6. When semaphores and semaphore operations are implemented in a non-preeemmptable kernel, we will not have any busy waiting.

True. We need to do this if the semaphore is implemented in user-space.

7. In the multiple producer, multiple consumer problem with a multi-slot buffer, we require mutual exclusion of the ‘deposit’ and ‘take’ to ensure proper order of entry.

False. This solution doesn’t provide proper order. This only provides only the ability to feed the consumer empty spaces and the consumer full spaces.

8. How many philosophers may eat simultaneously in the Dining Philosophers problem with only 4 philosophers?

Two. Draw a picture if this isn’t obvious.

9. The readers-writers problem discussed in class…

c… required that no reader will be kept waiting unless a writer has already obtained permission to use the shared database.

10. A monitor wait() operation always blocks.

True. Waiting signal can be implemented using semaphores. A monitor wait using a binary semaphore initialized to 0, whenever a process waits, it’s guaranteed to block.

Questions about how semaphores are implemented and conditions are implemented. This is very important to synchronization.

CS 3207 Quiz 3 Review: Threads and friends.

1. Circle the following components of program state that are shared across threads in a multi-threaded process:
a. Register Values
b. Heap memory
c. Global values
d. Stack memory
e. Open Files

a, c, e.

Registers are part of the virtual CPU, as are stack and thread-private memory.

2. A good solution to the cirtical section problem included the condition of pregress, where each process waiting for entry to the critical section will be granted entry in order of arrival.

False.

Bounded waiting can be granted only after a certain amount of tried.

3. With user-level threads, thread control blocks are stored in memoery outside the kernel and managed in user mode.

True.

Everything that happens with management is done at user-level. The kernel doesn’t know about them. Only the process can manipulate them.

4. In an operating system that can schedule kernal level threads, there may be two independent thread scheduling mechanisms.

True.

There could be a user-level thread management system as well as the kernel’s.

5. A course-gained atomic action is one in which the statements in the critical section for a data item are designed so that the critical section cannot be executed concurrently with itself or other cirical sections for that data item.

True.

They are functionally indivisible. This is the def. of the critical path setion.

6. A thread pool is a collection of kernel threads, which can be created at process startup, reducing the real-time overhead of creating new application threads.

False.

When a user process creates a new thread, we’d like to map it to an existing kernel thread. The idea of pools is to have the threads already created, and it will map to a kernal thread. There is a delay involved with creating additional threads at the kernel level for user-level threads to map to.

7. Race conditions are possible in concurrent programs because of the unpredictable interleaving of atomic actions in the programs.

True.

Solve this and get a turing prize. Inturrupts aren’t serviced during atomic actions, for example.

8. In multithreaded programs, the kernel can inform an application about certain events using a proceadure known as an ______

upcall.

This sends a signal to the thread library to tell it to, for example, run another thread while that thread is locked. It is like a reverse

Not a signal, as they can/are be used for inter-process communication instead of an upcall, which is specific to threading. Also, the kernal can throw signals but not upcalls. The user-level thread library can receive signals, though.

9. Signals are delivered to a process, notifying it of the occurrence of an event, and synchronous signals are delivered to the thread running when the signal occurs.

True.

Async signals can be handled by any running thread.

Sync signals are in response to a failure (hardware-based): These are delivered to a running thread.

10. A successful call to an exec() function has a return to the calling program of a value 0, indicating no error.

False.

There is nobody to return to if you exec, exec overlays the running process (including, pid and other things, like file pointers)

Operating Systems Quiz #2 review.

1. The ready queue is essentially a linked list of the Process Control Blocks of all processes that have all required resources, except the CPU.

True

Don’t confuse this with the I/O queue.

2. I/O bound programs have a higher frequency of occurrence of large duration CPU bursts.

False

Why are they called I/O bound? Because they don’t need a lot of CPU (otherwise they’d be called CPU-bound)

3. The medium-term scheduler helps reduce the degree of multi-programming by removing partially executed processes from memory.

True

Three types- long term, medium, and short-term. The short term does most of the work, including choosing the next process to execute (by making the virtual CPU a real-life one).

The long term scheduler is in charge what processes can get some memory, thus being able to run.

Call the medium-term dude a “swapper” – there are two kinds of memory issues:

a. swapping – moving an entire program into/out of main memory. Due to low-priority or waiting for slow resources.
b. paging – this means the entire program/process isn’t moved – this is moving a part of it. There are two types of files: one is a “Swapped” file, and another is a page file. Swap files have partially-executed processes. The next time we run a process we don’t want just the partially-executed part. The OS manages the page files.

4. Hardware is a critical feature for preparing the CPU to begin the execution of interrupt servicing; because the state of the interrupted program could be destroyed by the interrupted service routine.

True.

Hardware needs to store at least where the prior process was. We need at least two pieces if info: the PSW and the program counter. The PSW can’t be stored by software.

5. Because of the overhead of context switching, programs that use concurrent processes will always take longer to execute than the same program with a single process.

False.

It takes longer to exec a context switch than not. IF a process blocks for I/O, another process gets to run. A program with multiple processes can perform other operations during I/O – i.e. while another process does I/O another process can do computational work. This allows less total time on the CPU overall, even with the overhead of context switching (especially if the two processes on one program share a lot of context).

6. To achieve high throughput, a multiprogramming OS assigns higher priority to CPU-bound programs.

False.

A compute-bound process will be a worse citizen if they never need to block for I/O. This means more leaving.

7. In general, CPU utilization increases as the degree of multiprogramming decreases.

False.

Programs naturally share the CPU if they’re waiting for I/O. The more multiprogramming, the less time the CPU is idle waiting for resources (i.e. disk access).

8. If we implement the consumer-producer problem with an unbounded bugger, we could expect that producter operations can always complete.

True

The unboundedness has no effect on the consumer.

9. Instructions like a ‘compare’ in assembly language, produce a side effect that saves the value of the arithmetic result in the PSW for use at a later time.

False.

Kind of tricky – Not the value. It does say if >0, overflow, etc, but not the value itself (look in the accumulator).

10. If a user program was able to access the processor status word for read and write, it would be able to ensure that it could keep control of the CPU forever.

True.

The CPU could always be “above” interrupts by default – if a user program is in charge of this it could exist in a state of highest priority.

Pictures: Shirts I took pictures of – featuring fun shirt facts!

So, I wanted to work on a little product photography, since today is an “off” day for me, I decided I’d take pictures of all the (screenprinted) t-shirts I currently am working with.

Here’s some fun facts:

  • There’s 35 of them, versus 13 not-screenprinted tees I own.
  • I’m down to zero tees purchased via thrift store
  • 9 from shirt.woot!
  • 2 from teefury
  • 3 from threadless
  • 2 direct video game references
  • 3 from webcomics (2 Megatokyo, 1 PvP)
  • 2 Star Wars references
  • 2 Temple University, 1 Northeast High School (I graduated 9 years ago), 0 CCP
  • 9 are too small for comfort
  • 2 are too large for comfort
  • 5 branded (2 Hurley, 1 Nautica, 1 DC Shoes, 1 Element)
  • 1 shirt was for free (Apple Student Developer)

    Colors

  • 10 Grey
  • 7 Red
  • 4 Light/Bright Blue
  • 4 Dark Blue/Navy Blue
  • 2 Brown
  • 1 Maroon
  • 1 Yellow


    Check out the gallery here.

  • [Java] Using Java graphics to show off heap sort.

    I’ve been working on implementations of various Java programs and the like in my Data Structures and Algorithms class, and since I really like how this turned out, I figured it’d be worth sharing.

    This is the first time I’ve used multiple buttons and the default UI layout – I think it’d be nice to share an implementation of it. This program also has a delightful side effect of showing how close heap sort works to O(n log(n)). Code follows:

    main.class

    // thanks to ping for heapsorter as well as rolf's colorbox
    // Heapsort was originally published by J.W.J. Williams as
    // Algorithm 232 in the journal Communications of the ACM [Wil 64].
    
    package lab10;
    
    public class Main{
    
        private static int[] a;
        private static int n;
        static int[] w1;
    
        static int w = 2000;
        static ColorBox b1 = new ColorBox(w);
    
        public static void main(String[] args) {
         //   int w = 600;
         //   ColorBox b1 = new ColorBox(w);
        }
    
        static int dh = 0;
        static int sc = 0;
    
        public static void sort(int[] a0)
        {
            a=a0;
            n=a.length;
            heapsort();
        }
    
        private static void heapsort()
        {
            buildheap();
            while (n>1)
            {
                n--;
                swap (0, n);
                downheap (0);
            }
        }
    
        private static void buildheap()
        {
            for (int v=n/2-1; v>=0; v--)
                downheap (v);
        }
    
        private static void downheap(int v)
        {
            int k =  2*v+1; //k = root's children
            while (k<n)
            {
                if (k+1<n)
                    if (a[k+1]>a[k]) k++;
                if (a[v]>=a[k]){
                    return;
                }
                swap(v, k);
                v=k;
                k=2*v+1;
                dh++;
            }
        }
    
        private static void swap(int i, int j)
        {
            int t=a[i];
            a[i]=a[j];
            a[j]=t;
            sc++;
        }
    }
    
    /*
     * Okay, these are the numbers I'm getting for the swaps needed for each job
     * When I say "should be" number x, I'm speaking of the following formula for
     * the O(n logn) amount of swaps required...
     * 
     * x | x is a side of the array
     * swaps = x^2 * lb(x^2)  
     * where lb is binary log.
     *
     * Since big O notation reperesents an >upper< bound after a certain nominal value
     * none of the trials should be larger than O(n log n).
     *
     *
     * size: 100
     * swaps: 123891
     * Should be ~130k
     * http://www.wolframalpha.com/input/?i=100%5E2+%2A+lb%28100%5E2%29
     *
     * size: 200
     * swaps: 575216
     * Should be about ~611k swaps
     * http://www.wolframalpha.com/input/?i=200%5E2+%2A+lb%28200%5E2%29
     *
     * size: 300
     * swaps: 1399854
     * Should be about ~ 1.4 million swaps
     * http://www.wolframalpha.com/input/?i=300%5E2+%2A+lb%28300%5E2%29
     *
     * size: 400
     * swaps: 2,619,194
     * Should be about 2.7 million swaps
     * http://www.wolframalpha.com/input/?i=400%5E2+%2A+lb%28400%5E2%29
     *
     * size: 500
     * swaps: 4,248,474
     * Should be ~ 4.4 million swaps
     * http://www.wolframalpha.com/input/?i=500%5E2+%2A+lb%28500%5E2%29
     *
     * size: 1000
     * swaps: 18,986,697
     * Should be 19 million swaps
     * http://www.wolframalpha.com/input/?i=1000%5E2+%2A+lb%281000%5E2%29
     *
     * size: 1500
     * swaps: 45,343,618
     * should be about ~ 47 million swaps
     * http://www.wolframalpha.com/input/?i=1500%5E2+%2A+lb%281500%5E2%29
     *
     * size: 2000
     * swaps: 83914749
     * should be about ~ 87 million
     * http://www.wolframalpha.com/input/?i=2000%5E2+%2A+lb%282000%5E2%29
     *
     */
    

    next, we have the ColorBox method provided by the Professor and it includes my added buttons. This is the first time I’ve ever implemented multiple buttons on the UI. I know, minor victory. But that, to me, is really what programming is all about – little victories until one day, bam, you are half competent.

    ColorBox.class

    /*
     * ColorBox.java
     * Created on November 1, 2007, 11:08 AM
     * by Rolf Lakaemper
     * Zach added the buttons and actions
     */
    
    package lab10;
    
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    
    public class ColorBox extends JPanel implements ActionListener{
    
        private static final int DEFAULTSIZE = 400;
        private int []colors;
        private int size;
    
        //zach's buttons
        public JButton j1;
        public JButton j2;
        public JButton j3;
    
        /* Creates a new instance of ColorBox */
        public ColorBox(int inSize) {
    
            size = inSize;
            colors = new int[size*size];
            initRandom();
    
            // Visuals
            setPreferredSize(new Dimension(size,size));
            JFrame frame = new JFrame("ColorBox");
            add(j1 = new JButton("sort"));
            add(j2 = new JButton("randomize"));
            add(j3 = new JButton("downheaps and swaps"));
    
            j1.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    Main.w1 = Main.b1.getColorValues();
                    Main.sort(Main.w1);
                    Main.b1.setColorValues(Main.w1);}
            });
    
            j2.addActionListener(this);
    
            j3.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent aw) {
                    System.out.println("size: " + size);
                    System.out.println("downheaps: " + Main.dh);
                    System.out.println("swaps: " + Main.sc);}
            });
            
            
            frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
            frame.getContentPane().add(this);
            frame.pack();
            frame.setVisible(true);
    
        }
    
        /* Creates a new instance of ColorBox */
        public ColorBox() {
            this(DEFAULTSIZE);
        }
    
        public void initRandom(){
            for (int i=0;i<colors.length;i++){
                colors[i]=(int)(Math.floor(Math.random()*256));
            }
    
        }
    
        public int[] getColorValues(){
            // return a COPY of colors, keeps colors private
            int []c=new int[colors.length];
            System.arraycopy(colors,0,c,0,colors.length);
            return(c);
        }
    
        public void setColorValues(int []c){
            if (c.length!=colors.length){
                System.out.println("Error, arrays of different size.");
            }
            else{
                System.arraycopy(c,0,colors,0,colors.length);
            }
            repaint();
            return;
        }
    
        public void paintComponent(Graphics g){
            int count = 0;
            for (int row=0;row<size;row++){
                for (int r=row;r>=0;r--){
                    g.setColor(new Color(colors[count],0,0));
                    count++;
                    g.drawLine(row-r,r,row-r,r);
                }
            }
            for (int col=1;col<size;col++){
                for (int c=col;c<size;c++){
                    g.setColor(new Color(colors[count],0,0));
                    count++;
                    g.drawLine(c,size-c+col-1,c,size-c+col-1);
                }
            }
        }
    
        public static void main(String []args){
            ColorBox cb = new ColorBox(500);
            int []c=cb.getColorValues();
            java.util.Arrays.sort(c);
            cb.setColorValues(c);
        }
    
        public void actionPerformed(ActionEvent e) {
        // randomize button
           initRandom();
           repaint();
    
        // get ready for another run by setting counters to zero
        // downheap set back to zero
           Main.dh = 0;
        // swap count set back to zero
           Main.sc = 0;
    
    
        //  Junk drawer from other implementations/versions...
    
        //  long time1 = System.currentTimeMillis();
        //  Main.w1 = Main.b1.getColorValues();
        //  Main.sort(Main.w1);
        //  Main.b1.setColorValues(Main.w1);
        //  long time2 = System.currentTimeMillis();
        //  System.out.println(time2-time1);
        }
    }