Jeffkillian.com initially started as a Geocities website when I was in 6th grade. Over the years, it has slowly evolved into a place where I can practice and become familiar with web development as it progresses. I started out coding with Microsoft Frontpage, then moved to Dreamweaver. Initially, there was very little coding, and it was all WYSIWYG. However, as I learned more, I could make it more interactive.


I incorporate drawings and blog posts to keep those that are interested updated. Through the evolution of the website, I was forced to learn HTML, PHP, CSS, XML, jQuery, javascript, and the handling of MySQL Databases. I've put online some code samples.
CLOSE
Subject:
Message:

SUBMIT
Overlapping Squares

A friend brought up the question of "How do you determine if two randomly generated squares (or rectangles) are overlapping?" I had to do this in a java class before, but it was a while ago, so I thought I'd revisit it. I'm sure there are some answers online, but I wanted to take a stab at it before I looked at others' solutions.

Previously (in my java class), we had been given the two diagonal corners of the shape, and had to check to see if it overlapped with any other shape (there were lots of squares on our plane). In our solution, there were three possible options. For two shapes to be overlapping, one of them must either contain one, two, or all four corners of the other. Therefore, we had a function with an equation satisfying only those points within square 1, and we tested each corner of square 2 to see if any corner coordinates satisfied. If only one corner did, we knew only one corner was in. If two corners returner, we knew it was partially in. Four meant the entire square was contained within the other. Lastly, if none of this returned true, you pick a corner of square 1, and test whether it is in square 2. If this were true, that would mean square 2 were entirely within square 1.

However, when my friend posed the problem, she did not have the corner coordinates. Rather, the program she was using would generate squares based on a center coordinate. Her eventual goal was to create a randomly generated city block with buildings, and she wanted to ensure no two buildings overlapped. As long as two bases never overlapped, no two buildings would either. For simplicities sake, we assumed that all buildings were square.

If all buildings were square and we only had a center point (and length to the edge from center, aka half the width/height, referred to as "w"), the simplest idea is to draw a circle with radius sqrt(2w*w). This would result in a square perfectly inscribed within a circle, as seen in the image below:

Every time you create a square, you could generate this circle, and check for two things:
1) the circle surrounding your newly created square doesn't overlap edges with any others. You would check this by setting the equations for the two circles equal, and verifying no solutions.

2). The center of your new circle is not contained within any other circle. You would check this by seeing if the center of this new circle satisfies the comparing circle's equation, but using an inequality (less than or equal to instead of equal to) in order to get all circles contained within.

This is not the most efficient way, however, for there is extra space that isn't technically in a square, but we are restricting. You would be less likely to find two closely adjacent squares because the area in the circle that is not in the square would be prohibiting this. Another option proposed was to calculate the points of the corners, and then use the method first described. Because she only needed to generate a city block or so, we weren't too concerned with the time it took to generate. Because she isn't at the project where this needs to be written, our conversation moved onward. However, I'm sure I'll approach this later, as it's a pretty interesting puzzle. I'd like to focus more on optimization of a way in order to minimize resources used.

Classes Over
Since classes are over I figure now is as good of a time as any to update. I'm really excited for next semester, specifically my Algorithms and Data Structures class. I have extensive computer science experience, and I'm excited to learn the ins and outs of scalability. On a related note, you can watch algorithms in the form of dance on youtube. Check out quick sort or bubble sort.

My Rapid Prototype class is done, which is a shame. It was my favorite class that I've taken here, and really taught me a lot. It was great because it gave you just enough information/forced you to learn just enough so that you could understand what the purpose of that language or platform was for. I was able to redo this entire site because I took that class, which was a big plus. The last module dealt with remote procedure calls, which is a cool concept, but I don't think it would be all that necessary for this site currently. The best way I learn is when I have a goal/outcome in mind (aka not just "learn python"). This class gave me a goal for each module that we had. In fact that's how I usually learn languages. For example, to familiarize myself with python, I made a program to create a zig zag pattern on the screen. It was a pretty simple program, but really let me learn the syntax and how it works again. I'm thinking of adding a page here which includes some various code samples from some of the languages that I learned (such as the clock problem).
CSS
I've been working more on the CSS. It's a learning process, but it's good. I redid the navigation bar using a tutorial found here and I think it turned out well.
Number of 90 Degree Angles Between A Minute and Hour Hand in a 24 Hour Period

A brain teaser was posed to me a month or so ago, and it wouldn't leave my head. It goes as follows:

How many times do the hands of a clock make a right angle in a 24 hour period?

It seems like twice an hour would make sense, and that is initially what I thought, but this seemed too simple of a solution. The thing to realize is that the hands don't move instantaneously, and thus a "success", where both hands form a 90 degree angle, won't always fall on a time precisely divisible by 15. In fact, the first success occurs 16 minutes and 22 seconds after 12:00 am (due to the hour hand having moved a bit in that 16 minute span.


The general equation for the angle between two hands given any second, minute, and hour is: Ө = 180 - abs(180-30*h+11*m/2+11*s/120). Where h is the hours past 12:00 am, m is minutes past the hour, and s is seconds past the minute. I wrote some code to get an exact solution. If you want the source or more info, feel free to send me a message.

Solution? There are 44 right angles between an hour hand and a minute hand on a clock in a 24 hour period.
The reason it's not uniformly twice per an hour (and therefore 48 successes) is due to the second right angle during the 2:00, 8:00, 14:00, and 20:00 pairs occurring directly at the beginning of the following hour.
Note: Angles are not exact due to seconds being discrete.

There are 44 right angles between the minute hand and hour hand of a clock in a 24 hour period.
Count Time Angle Theta Mod 90
10:16:2290.01666666670.0166666666667
20:49:6270.050.05
31:21:5090.08333333330.0833333333333
41:54:33270.0250.025
52:27:1790.05833333330.0583333333333
63:0:0900
73:32:4490.03333333330.0333333333334
84:5:2790.0250.025
94:38:1190.00833333330.00833333333333
105:10:5490.050.05
115:43:3990.0750.075
126:16:2190.0750.075
136:49:690.050.05
147:21:4990.00833333330.00833333333334
157:54:3390.0250.025
168:27:1690.03333333330.0333333333333
179:0:0900
189:32:4390.05833333330.0583333333333
1910:5:2890.06666666670.0666666666667
2010:38:1090.08333333330.0833333333333
2111:10:5590.04166666670.0416666666667
2211:43:3890.01666666670.0166666666667
2312:16:2290.01666666670.0166666666667
2412:49:590.04166666670.0416666666667
2513:21:5090.08333333330.0833333333333
2613:54:3290.06666666670.0666666666667
2714:27:1790.05833333330.0583333333333
2815:0:0900
2915:32:4490.03333333330.0333333333333
3016:5:2790.0250.025
3116:38:1190.00833333330.00833333333334
3217:10:5490.050.05
3317:43:3990.0750.075
3418:16:2190.0750.075
3518:49:690.050.05
3619:21:4990.00833333330.00833333333333
3719:54:3390.0250.025
3820:27:1690.03333333330.0333333333334
3921:0:02700
4021:32:4390.05833333330.0583333333333
4122:5:27270.0250.025
4222:38:1090.08333333330.0833333333333
4323:10:54270.050.05
4423:43:3890.01666666670.0166666666667
Dogs are really dumb
Exhibit A:
Site Overhaul is Complete

So what exactly did I do?

I completely reorganized the entire structure of this site. I'm now using databases, which allows me to index and archive automatically all posts and images uploaded, instantly. Previously, I stored posts in a very inorganized fashion. Whenever I posted a new entry, a new file named _TITLEOFTHEENTRY.txt would be created, and stored in my "/Blog/" folder. I also had a running text file that would append the new entry to the beginning of the text file. It was this text file that was then displayed on the front page. However, it would just keep appending when I made a new entry, and I would have to manually go in every so often and trim the last entries in the file off so the main page didn't get crowded with too many entries.

For the archives page, I used to have to manually go in and make each month's archives, which was extremely tedious (and hence why it wasn't updated nearly as much). Similarly, every new drawing meant I had to manually update the drawings page, add the image, and go through the entire process of making a blog post.

Making a blog post used to be very confusing. So confusing, in fact, that I made a word document that told me exactly what to do. It said:

1.Open Dreamweaver…
2. Open up blogposts.php
3. Blogpage.php
4. Index.php
5. postlist.php

TO MAKE NEW POST:
6. Go to blogposts.php.
7. Write post
8. change the URL of the hyperlink of the title so that it links to “the title of your page”.php
9. save page as “title of your page s.php”
10. Drag that page to the blog folder on server. Go to that page via broswer and copy the url (with the %20s).
11. Paste the copied url into the contents in blogpage.php.
12. Copy the script on blogpage.php and insert into index.php
13. Drag index.php onto
14. save the blogpage.php as “the title of your post”.php
15. Open Postlist.php
16. In the file, type in title/make it a hyperlink

Furthermore, these directions did not take into account if I was posting a picture or not, if the image was from Jabberbox or just Drawings, or anything about monthly archiving. Also, if I wanted to edit the old post, I had to redo all of those steps.

Instead of steps 1-16, now I just go to a website, type the title and post contents, and I'm done. EVERYTHING is securely automated. I even added a password protect so that I am the only one who is able to post. Also, I can modify old posts and delete old posts online with the simple click of a button. But that's not the important stuff for you, it really only affects me.

What affects you is the following:

  • 404 page works.
  • Archives automatically update
  • Rss Feed works wonders
  • Search Function is no longer google-run, I hard coded it.
  • Added an about section
  • I've been meaning to do this for a long time, and my Rapid Prototype and Development Class really forced me to. I selected one of our creative modules to be part of this whole redesign, which forced me to get started on it. Once I was started, I kept making little improvements, and I'm extremely happy with how everything turned out. Most of it was work behind the scenes, and doesn't affect how the site is viewed. I've still got some work to do on the drawings page to make it flow better, but the hard stuff is done.
    Big Blog Post Coming
    Finally finished as much CSS as I want to do for today. Update coming soon.
    Phew
    Finished. Pictures uploaded. Entries archived. 404 page fixed. RSS feed up and running. Time to sleep. I'll go into more detail about the entire overhaul tomorrow.
    Archiving
    Archived about 30 Blog Posts, going to do some more when I get back from soccer.
    Images
    Images Page is done. Most recent image automatically shows. I'm going to work with the look to make it better, but for now I'm moving on to archiving old posts.
    Want more? Check the blog archives
    Untitled Document