Cake Mix Cookies

These are incredibly simple and amazingly delicious.

Mix the following ingredients in a bowl:

  • 1 18¼ oz. box cake mix
  • 2 eggs
  • ½ cup of vegetable oil

Bake at 350° for 8-10 minutes.

Microwaves

Microwave (n) A hand gesture used by a midget to greet others.

Hey, that midget over there just gave me a microwave.

Got it Back

I finally got my blog back online again, after a three-day struggle with a virus that keeps coming back. I feel like GoDaddy had to be at fault the last time, I had nothing but a fully-secured WordPress 3.5 on the server. To my knowledge, recent releases of WordPress are incredibly secure…

Connecting a Domain to a Subdirectory

Update: nginx is better. Shared hosting is terrible. Use DigitalOcean. :)

If you want to host multiple websites on one hosting server, especially if it’s a cheap shared server, knowing some basic URL rewriting is essential. This is how I’m running mine, on both my Apache and Microsoft IIS 7 servers.

The examples below direct (www.)domain2.com to /domain2/.

Apache

Within the file .htaccess in your server’s root directory, include the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?domain2.com$
RewriteCond %{REQUEST_URI} !^/domain2/
RewriteRule ^(.*)$ domain2/$1 [L]

Microsoft IIS 7

Within the file web.config in your server’s root directory, include the following:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="prosecure.tk" enabled="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^(www.)?domain2.com" />
                        <add input="{PATH_INFO}" pattern="^/domain2/" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="domain2{R:0}" />
                </rule>
            </rules>
        </rewrite>
        <security>
            <requestFiltering allowDoubleEscaping="true" />
        </security>
    </system.webServer>
</configuration>

CSS Shorthand

Learning CSS shorthand can save time and keep your stylesheets cleaner and simpler.  There are several ways to write the same styles, some more efficient than others.  For example, padding can be declared for each side like this:

padding-top: 5px;
padding-right: 5px;
padding-bottom: 5px;
padding-left: 5px;

Or, you can condense each of the sides into a single line:

padding: 5px;

This works great if you want the padding to be equal on each side, but if that’s not the case, you can follow this format:

padding: [top] [right] [bottom] [left];

Say we want the padding to be 5px on the top and bottom, and 3px on each side:

padding: 5px 3px 5px 3px;

This can still be further condensed, setting the top and bottom together, and both sides together, like this:

padding: [top/bottom] [sides];
padding: 5px 3px;

If you need to specify the top and bottom separately, but keep the sides the same, you can use this format:

padding: [top] [sides] [bottom];

This shorthand format works with border, padding, and margin. The easiest way to remember the order is that the list of units goes clockwise from the top.

Approximating the Area beneath a Curve Programmatically

Given any function in the slope-intercept form, whether linear or non-linear, the area between the curve and the x-axis between two points can be easily approximated with the Riemann Sum using a For loop.

This is a simple pseudo-code example, where Y1 is the function and Y1(I) is the value of Y1 at X = I:

N = 0
For (I, Left Limit, Right Limit, Step Interval)
    N = Y1(I) + N
End
Display N

To determine the step interval, use this:

Step Interval = (Right Limit - Left Limit) / Number of Steps

To improve accuracy, there are multiple ways of using this approximation, which distinguish between which end of each step to use.  To adjust the limits and intervals for the desired method, use this code:

If LRAM (using left end)
    Right Limit = Right Limit - Step Interval
End If
If MRAM (using middle of step, often most accurate)
    Left Limit = Left Limit + (Step Intverval / 2)
    Right Limit = Right Limit - (Step Intverval / 2)
End If
If RRAM (using right end)
    Left Limit = Left Limit + Step Interval
End If

For anyone wishing to have a complete program for a TI-83 or TI-84 calculator, use my Riemann Sum Program (dead link).

Please note that this is an approximation. You can find exact answers using integrals.

Chocolate Chip Cookies

Preheat Oven to 375°

Cream together:

  • ⅓ cup shortening
  • ⅓ cup butter
  • ½ cup sugar
  • ½ cup brown sugar

Beat in:

  • 1 egg
  • 1 tsp. vanilla

Stir in with mixer on low speed:

  • ½ tsp. baking soda
  • ½ tsp. salf
  • 1 ½ cup flour

Stir in with wooden spoon:

  • ½ cup chocolate chips

Drop by rounded teaspoons onto ungreased cookie sheet.

Bake 8-10 minutes or until cookies are light brown.

Remove from oven and let cool slightly on a cooling rack.

No SMTP with GoDaddy

As the first letter in the acronym SMTP stands for simple, that’s what I was expecting when I decided to use the Google Apps SMTP server to send out notifications for Xusix. In the end, after three days of repeatedly rewriting the mailer functions, I discovered the reason nothing was sending.  GoDaddy shared hosting doesn’t allow SMTP connections. At all. They simply block anything that appears to be sent through that protocol, or uses a common SMTP port, leaving me to the only remaining option: using GoDaddy’s own mailer. The problem with this is that their spam filter is so aggressive, few messages ever make it through. And so, notifications on Xusix, although programmatically work, will likely never reach an inbox.

Xusix Updates

Our social network Xusix has been under development for quite a while now, and we’d like to introduce some of the neat things we’ve added in recent times.

  • Live comments - When you comment on a post, it instantly send the comment out, and anyone viewing the post is shown the new comment.  The text box immediately lets you write another comment, allowing a live, ongoing conversation.
  • Mobile Access - The Xusix layout has recently been redesigned from the ground up, and although it looks exactly the same on a desktop browser, it now optimizes automatically for netbooks, tablets, and mobile devices.
  • Direct Notifications - Users can now customize their notification preferences, with support for informing them of activity on their page through both email and text message, direct to all major U.S. carriers.
  • Photo support - Xusix now allows uploading an unlimited number of photos, and each supports a caption and its own live comment stream.  The entire photo gallery system is optimized to fit all screen sizes, from a Mac Cinema Display to an iPod touch.
  • Privacy Configuration - Control what groups can see basic information about you, and mark posts as private to only display them to people you follow.

All of these, and many other features are now available for free on Xusix. Sign up today!

For those interested in the technical side of the site, see xusix.com/current.php to list all of the in-depth statistics on our internal systems.

A new twist

About a month ago, I was working on a simple code project for school in some free time. It’s a web site that takes simple phrases and makes a song out of them, based on the 99 bottles of beer song.  I rediscovered the fun little script today, and you can see my song here. When you write a song with it, the URL that shows the song will always show your song, so you can send that link around to share it with anyone!