Logic’s Last Stand

November 3, 2008

A Few Rants

Filed under: Computers, Philosophy, Politics — Tags: , , , , , , , — Zurahn @ 12:43 am

Alright, I’ve been a bit slow on blogging, so some issues I’ve wanted to rant about but haven’t have built up, so this blog will be on a few different topics.

Firstly, Sprint threw a hissy-fit and completely disconnected its network connection with Cogent. This was only reported on tech sites, and got no significant attention, but this was a huge story.

Cogent is a Tier 1 network, which means if you don’t connect to it, you are disconnecting from an entire segment of the Internet. And guess what, so is Sprint, so Cogent couldn’t then connect with Sprint, meaning Sprint thereby screws Cogent customers in the process. Not only did they do something that ought to be in violation of contracts with their customers, it’s against the peering agreement between the customers, and against the Cogent customers contracts as well. Oh, and guess what, there are only 14 Tier 1 networks, and the rest have to pay to go through the lines of Tier 1 networks. If a Tier 2 network is then paying to connect through Cogent, well, you can work that out yourself (though they can work around if they’re paying for transit through enough additional networks).

For once, could every single tech corporation, and especially telecommunications companies stop screwing the consumer? The Internet is one of the greatest achievements in history, marking the ultimate source of knowledge for a species that thrives on the extension of its own ingenuity, and in one fell swoop, Sprint threatens to kill that.

Fortunately for the time-being, the networks will reconnect.

Secondly, there’s this story: Christians pray to golden bull on Wall Street.

I don’t even know what to say with this one. That something so obscure in concept plays out in direct contradictions to the famous forbidding of that exact obscure concept, what do you even say? You’re part of a religion oft accused of not following its own tenats or even reading its own holy book, and you go and pull this.

This is as about as speechless as I can say I’ve been.

Lastly, the Atheist Community of Austin (who sponsors the web-famous Atheist Experience call-in show), has released its Austin voters’ guide, which asked as candidates to answer a series of questions from Strongly Disagree to Strongly Agree. Naturally there are various questions about the separation of church and state and religion in schools where you’d see religious bias show through not surprisingly so. However, one question genuinely surprised me for the worse,

20. Parents who, on account of religion, prevent their children from receiving life-saving medical treatment should not be immune from prosecution or from loss of custody of their children.

This question inexplicably was split very evenly across the board. You kill your child and there are a significant portion of the electorate who thinks that’s just fine. Even Ralph Nader went for “Unsure.” Are you kidding me? Are you out of your damned mind?!

How can anyone of any faith, gender, nationality, HUMANITY not recognize this inarguable? You’re not going to suggest that a parent whose child died of their gross negligence shouldn’t lose custody of their other children? If the parent had gotten drunk and beaten their child to death, would you have the same answer?

There are only two possibilities for anyone who did not choose to Strongly Agree with question 20 on that guide:
1 – They misread
2 – They’re mentally unfit to hold office

And no, I don’t consider that a false dichotemy.

May 25, 2008

Beginner’s Guide to a Real Web-site – Part 6 – Intro to SQL

Filed under: Computers — Tags: , , , , , , — Zurahn @ 2:46 pm

Database interaction is in most cases dealt with using a language called SQL (Structured Query Language). For our purposes, we only need to know the basics, which are:
-Inserting data
-Updating data
-Deleting data
-Retrieving data

These are conveniently done using the keywords INSERT, UPDATE, DELETE and SELECT. However, before we can get to that, we need to understand what we’re storing and how to store it. We know that we simply want to store blog posts; these will have titles, dates, and a body. We can do this with a single table. A table is what we call what we store data in, because we use “columns” of data.

Our table, which we’ll call “blogs” will have these columns:
-id
-title
-date
-body

We can do this either in SQL or in the handy PHP tool phpMyAdmin which is included with WAMP (click the WAMP icon on the taskbar, and choose phpMyAdmin). PHP web hosts will typically have phpMyAdmin installed for your use. In our code we need to use SQL to interact with the database, but setting up the structure we can, and for simplicity’s sake in this tutorial, do it in phpMyAdmin.

Firstly, we create a new database, which we can call “mysite” and click the Create button. This will create the database, which will store the table. Now you’ll see at the bottom “Create new table on database mysite”. Enter “blogs” for the name, and we need 4 columns (id, title, date, body).

On the next screen, “Field” is the name of the column (id, title, date, body). For the data type dropdowns, id will be INT, title will be VARCHAR, date will be a TIMESTAMP (not DATETIME), and body will be TEXT.

INT is short for Integer (a number with no decimal points and can be positive or negative). IDs should be Integer values. Set the length to 11, EXTRA to auto_increment (meaning it automatically assigns a unique value to it when you INSERT), and choose the first radio button under the page with the key to set it as the Primary Key (the value that uniquely identifies a record — in our case a blog post — in the table).

For title, VARCHAR is a text field with a set length. We’ll set the length to 50 (seems reasonable for a maximum title length).

For date, TIMESTAMP is the number of seconds having passed since December 31, 1969. Timestamps are easily converted to date formats in PHP. Change default to ON UPDATE CURRENT_TIMESTAMP; this just means to insert the current time by default.

And for body, TEXT is a text field with no specified maximum length and is only limited by the database software itself. This will allow for blogs without having to worry about one being too long.

Click Save to create the table.

If you wanted to do this in SQL, here is the code, though I won’t go through it to explain.

CREATE TABLE mysite.blogs (
id INT(11) NOT NULL AUTO_INCREMENT,
title VARCHAR(50) NOT NULL,
date TIMESTAMP NOT NULL,
body TEXT NOT NULL,
PRIMARY KEY (id)
) ENGINE = InnoDB 

For the sake of building our SQL skills before jumping into PHP usage, click the SQL tab in phpMyAdmin to get a box where we can enter SQL queries. This way we can test our queries and see how they work. Here’s a query to insert a record into our table

INSERT INTO blogs (title, body) VALUES('A Blog Post', 'This is where a blog post would be');

Selecting all records from a table:

SELECT * FROM blogs;

Select specific records and columns from a table:

SELECT title FROM blogs WHERE id = '1';

We can also update the record:

UPDATE blogs SET title = 'My Blog Post' WHERE id = '1';

Or, finally, delete the record:

DELETE FROM blogs WHERE id = '1';

This is basically all you’ll need for the development of our site. We can use SQL statements directly in PHP to modify the database, which we’ll do in Part 7.

April 16, 2008

Beginner’s Guide to a Real Web-site – Part 5 – PHP Programming

Filed under: Computers — Tags: , , , , , , , — Zurahn @ 5:57 am

PHP is a complete programming language, as opposed to XHTML and CSS which are mark-up languages.

Programming languages have a few simple characteristics:
-Variables that store data
-Conditional statements
-Loops

Variables in PHP begin with a dollar sign

$num = 1;

The above statement (which must end with a semi-colon) assigns a variable called “num” the value of 1.

Conditional statements check the value of a variable or variables.

if($num == 1)
{
  echo "YES!";
}
else
{
  echo "NO!";
}

The above if statement checks if the value of $num is equal to 1. If it is, the page outputs the text “YES!”, otherwise, it outputs the text “NO!”.
Anything within the { } brackets applies only for that statement.

There are other conditional operators than “==”. Here are a list of operators in PHP:
== (equal to)
=== (equal in value and in type)
! (NOT)
> (greater than)
>= (greater than or equal to)
< (less than)
<= (less than or equal to)
|| (OR)
&& (AND)

Loops repeat a section of code several times over. There are two basic kinds, the while loop and the for loop.

A for loop is designed for when you know how many times you want to go through the loop.

for($i=0;$i<10;$i++)
{
echo $i;
}

The above loop repeats 10 times, starting from 0. The loop repeats as long as $i is less than 10, and $i increments 1 each time through.
Also note
$i++
This increments the variable $i by 1. ++ is a shortcut. Equivalents to this would be
$i += 1
or
$i = $i + 1;

A while loop lasts while a condition is true.

$count = 0;
while($count < 10)
{
  echo $count;
  $count++;
}

The above loop repeats 10 times. It keeps going as long as the count, which started at 0, is less than 10. In the above case, it works identically to a for loop; however, if you have an uncertain condition, such as a random number or user-input, the number of times is unknown.

All we’re going to do to start is to receive some data from the user, then output it back.

Make a copy of index.php and call it blog.php. This will be the start of our blog page.

<?php include_once('includes/top.php'); ?>
<title>Main Page</title>
<?php include_once('includes/middle.php'); ?>
<p><h2>My Blog</h2></p>
<p>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<textarea name="blogpost" id="blogpost"></textarea><br />
<input type="submit" value="Submit" />
</form>
</p>
<?php include_once('includes/bottom.php'); ?>

There’s a bit to explain here. A form tag in HTML surrounds a series of data you want to send to the server (our PHP). In this case, we just want to submit the data to itself, so we echo out the page we’re on, which is stored automatically by PHP in the variable $_SERVER[‘PHP_SELF’]. You could just type in ‘blog.php’ to get the same effect, except it won’t work if the page gets renamed.

The input type submit sends everything within the form to the server.

Anything sent to the server (in this case with method post) in PHP will be stored in $_POST. Let’s echo out the value of the blogpost.

<?php include_once('includes/top.php'); ?>
<title>Main Page</title>
<?php include_once('includes/middle.php'); ?>
<p><h2>My Blog</h2></p>

<?php
if(isset($_POST['blogpost']))
{
  echo "<p>".$_POST['blogpost']."</p>";
}
?>

<p>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<textarea name="blogpost" id="blogpost"></textarea><br />
<input type="submit" name="submit" id="submit" value="Submit" />
</form>
</p>
<?php include_once('includes/bottom.php'); ?>

All I’ve added is a check to see if there’s a value in the blogpost, and if there is, to display it in a new paragraph.

For the sake of making things look a little nicer, you can create a new CSS file called blog.css and add this to it (and don’t forget to import it into blog.php using the tag)

#blogpost
{
  width: 85%;
  border: 1px dashed white;
}

#submit
{
  border: 1px solid white;
  background-color: black;
  color: white;
}

Our problem now is that the blog doesn’t go anywhere. It needs to be stored in a database, which we’ll cover in Part 6.

January 26, 2008

A How-To: Guide to Home Computing

Filed under: Computers, Freeware — Tags: , , , , , , , , — Zurahn @ 12:05 am

If there’s something I’m in a position of doing, it’s telling people how to use their computer. This includes the software they should use, the software they should avoid, and the configuration of everything inbetween.

What you should know before we start is that due to a longstanding use of dated computing hardware, I am very mindful of both compatibility and performance.

Security
Do you have any anti-virus software installed? Norton? McAfee? Now, I could go into why both of those are poor choices for security, but it’s irrelevent. Uninstall it. I don’t care what it is, delete it.

Here are two steps for what you need to do for your computer to be secure:
-Don’t download from sleezy sites. You really don’t have to worry too much about it, just don’t do anything stupid.
-NEVER use Internet Explorer unless you’re testing a site that you’re making.

Now that we have those things out of the way, you can forget about Norton. Keep in mind you can’t uninstall Internet Explorer, there are issues because Microsoft is monopolistic. Anyway, now you need a browser.

Browsers
Browsers come in 3 flavours, IE based, Gecko based, and Opera based (Internet Explorer, Mozilla, and Opera browser engines respectively). You will not be using any IE engine browsers on my watch).

There are an absolute tonne of browsers out there, and I will tell you that I’ve tried 95% of them. So I am simply going to break down my Top 5 browser choices, any of which is a necessary improvement over IE.

Please also note that if you’ve tried any of these browsers in the past, don’t dismiss them for it. One update can change everything. I’ll personally vouch that even as a fan of Opera 9 now, Opera 5 was a pile of crap.

1. K-Meleon – K-Meleon is the fastest, most customizable browser out there, and runs on the ultra-secure Gecko engine. It also still receives development time, so it’s not abandonware. If you like your browsers quick and compact, there’s no competition. It is also compatible with most Firefox plug-ins. Also much to my dismay, comes with its own RSS Reader.

2. Opera – Opera has the most W3C complient rendering engine, and has a wealth of convenience features, and is relatively quick. It can be a bit resource heavy on older machines, however.

3. Orca – Orca is the Gecko engine equivalent of the very popular Avant Browser. If there’s a competitor to K-Meleon in customizability, it’s Orca. The only thing bringing it down is compatibility and bugs, which may cause it to be unreliable or even unusable depending on the machine in which it’s running. Here’s hoping further development irons out the issues.

4. Netscape Navigator – If you’re looking for a streamlined browsing experience, Netscape is the way to go. The heaviest of the browsers on this list, it aims for a robust feature-set that gives you all the options for one-click browsing. Netscape is another Gecko engine browser.

5. Mozilla Firefox – A definite solid choice that is middle of the road feature-set and performance. Due to popularity, there are tons of plug-ins for the browser and is the only one fully compatible with them all. It’s the fastest growing in userbase, so there’s definitely a lot of development coming.

Customizing Your System
Now that we’ve filtered out the crap, it’s time to get optimizing.

Go to the Start menu and choose Run. Type the following:

msconfig

This brings up a simple little configuration tool. First thing’s first are the Start-up items. Choose the Startup tab. Now deselect anything that you’re not using absolutely every time you turn on the computer. If you’re not sure, you can turn them all off; there’s nothing under Startup that is necessary for your computer to run.

Once you’re done that, if you know what you’re doing you can disable some Services. If you’re not too sure, click the checkbox to hide all Microsoft services and you should be safe. Deselect whatever’s unnecessary.

It’s not all just configuration though. There are some free utilities you should definitely have:
Auslogics Disk Defragmenter – I’ll be straight with you: Windows Disk Defragmenter sucks. Even if you don’t like the Auslogics one for whatever reason, go find another free one.

CCleaner – You’d be amazed how much crap builds up in the background, and Windows after ME makes it worse than ever. CCleaner is a must, both for wiping tons of useless old temp files as well as cleaning up the registry that can severely slow Windows.

Run these both once a week, or even if you’re lax, once a month.

Freeware Replacements
There are a lot of programs you may have come to just assume are the only option or the best option, or may not have even known the option existed at all. For this, I have the better, free solutions.

IZarc – A must-have compression utility. Wait, everything on here is must have. Forget that. It handles basically every compression format, is quick, simple and compresses well.

7Zip – There have been a few instances where I’ve had problems with IZarc, though, namely with Japanese characters. I much prefer IZarc overall, but 7Zip has covered every time IZarc has failed. The perfect compliment.

SumatraPDF – Adobe Reader no more. SumatraPDF is lightning fast, a stark contrast the GameSpot editor slow Adobe Reader.

CC PDF Converter – Print anything to a PDF file. For example, open a Microsoft Word document, go to File->Print, choose CC PDF and print. You now have a PDF version of the document. No paying here.

OpenOffice – Ok, I’ll be honest here: I’ve never used it. However, I’m aware of this Microsoft Office clone, and if I didn’t already have Office, would be all over it.

Optionals
Everything before now are better than anything you currently have. I demand you do everything I say and install eveyrthing I have recommended (ok, you only need 1, maybe 2 browsers) and be rid of their replacements (ok, you can’t be rid of IE). Now, to things that you don’t need per se, but you may want.

Process Explorer – An excellent utility straight from Microsoft that lets you examine every single thing running on your computer.

Microsoft Keyboard Layout Creator – Another from Microsoft that lets you rearrange functions on your keyboard. It lets you assigned multiple strokes to a single key, which could turn unused keys into a big convenience.

MapKeyboard – An alternate utility for those who want to reassign a larger spectrum of keys.

MediaMonkey – Ok, this one is a bit more up in the air on preference, but I like the light-weight, very organizable nature of MediaMonkey over its competitors. Plus, as we all know, monkeys make everything better.

XMPlay – If instead of a big music organization utility, you’d rather have a light-weight small music player, XMPlay is the way to go. Light, customizable, plays music. There you go.

Citrus Alarm Clock – A nice alarm utility that will play any audio file (or playlist) you choose at whatever time you want.

VirtualDUB – An excellent video editing utility that just offers a lot of helpful options. A must-have anyone working with video files.

FFmpeg – A miracle conversion program that converts from and to virtually every video and audio file type (including .flv files, i.e. flash video that comes from youtube). You can also use it by the exact same method to extract just the audio from a video file. It’s a command-line utility, though, so understanding of how to use command line is needed for just the windows binary. It’s as simple as
ffmpeg -i file1.flv file2.mpeg

FFmpeg GUI – For those not so inclined toward command line, there’s always the FFmpegGUI which is a Graphical User Interface for FFmpeg.

Daemon Tools – A tool for mounting files as virtual drives. It’s free, light, and basically everything you could ask for.

GoldWave – This one is technically shareware (trial software) but the only limitation is that after several hundred clicks (equivalent to say 15-20 minutes of use) you’ll start getting the occasional annoying alert box. At this point you can save and then close and reopen.

HTML Editor – Direct to the point, and yet misleading. HTML Editor is an excellent programming text editor that is for much more than HTML, including but not limited to, JavaScript, VBScript, PHP, ASP, Java, C and C++.

SmartFTP – Another “shareware” but is only that in name. The 30 day trial is an honour system one. I guess if you’ve got a moral objection to the programmers being too lazy to stop you, then this isn’t for you.

ChessBase Light – Because I know everyone loves chess, a great free database and interface.

Freebie Sites
Download.com – BOO CNET BOO. Ok, at least they have quite the nice download site. BOO.
ZDNet.com – Want to stick it to CNet? Try this almost identical site, albeit with uglier layout.
SourceForge.net – To quickly avoid those shareware programs, head over to SourceForge for some freeware independent programs. K-Meleon originates from SourceForge 🙂
FreewareFiles.com – All FreeWare, all the time. Oh yeah.
Google.com – Google can find anything. If you can’t find it, you just aren’t searching right.

Sites for your Assistance and Entertainment
Lastly, what’s a computer without entertainment to accompany it. Here are my most visited sites outside of the typical gaming sites:

Digg.com – An aggregate of popular stories that seems to have much better taste than the most popular Youtube videos
Youtube.com – And yet we still love the Youtube.
Dailymotion.com – A nice compliment to Youtube for finding videos taken down by copyright infringement.
Wikipedia.org – People don’t give Wikipedia enough credit. Bubuttbut you can’t trust thems!!! Psst…Encyclopaedia Britannica has a history of biggotry, you can’t trust any single source ever! Wikipedia CITES THEIR INFORMATION 🙂
Nintendojo.com – I won a free DS game from there. That makes any site good.
iCanHasCheezBurger.com – Invisible tango partner!
Savetube.com – Save Youtube videos in .flv format. If you were paying attention earlier, you’d already know you can convert .flv videos to common formats using FFmpeg.
W3Schools.com – If you want to learn or reference anything about proper web coding, W3CSchools is the place to do it.
Y-REVIEWS (yo.knows.it) – Why haven’t you joined yet? Nobody believes you when you say you actually like 1UP’s review system.
Answers.Yahoo.com – I like to tell people what to do, and the people here ask me to do so. So you better listen to what I say and follow my instructions.

Additional Recommendations:
Veoh.com
Stage6.divx.com

Keyboard Shortcuts
Some little tips on speeding things up by expanding the use of your keyboard. Forgive some of these being a bit common knowledge.

CTRL+L for the address bar – This is my most used. Pressing CTRL+L automatically selects the address bar in basically every browser. F6 also does the same thing.

CTRL+F, CTRL+H – Find, and Find/Replace. You can use CTRL+F (find) in most applications, including browsers and PDF readers, and CTRL+H (find and replace) in virtually all text editors.

PrintScreen – Pressing the PrintScreen button copies a static image to your clipboard of whatever was visible when you pressed it. You can then paste it into anything that will accept an image.

ALT+PrintScreen – The same as PrintScreen except it only copies the contents of the current window and ignores the rest.

ALT+Tab – Allows you to quickly jump between open windows.

ALT+Numpad – Holding ALT then entering the ASCII value of a character on the numpad will output that character in text. Similarly, in places that will not render that information properly, typing &# followed by the ASCII value then a semi-colon will render the same character in a browser. For example, ‚ = ‚

Run Commands
Just typing something into the Run box under the Start menu is a quick access to many things, and is an easy way for a decent typist to open a specific folder.

msconfig – Opens the Configuration Utility including start-up options.

cmd – Opens the DOS command prompt (only in XP or higher. In earlier versions, you run C:\WINDOWS\DOSPRMPT.PIF).

regedit – Opens the Registry Editor.

chkdsk – Runs the disk integrity checker in the command prompt.

charmap – Opens the character map for special characters (note that it gives you the ALT+ combination in the bottom right corner, and the UNICODE information in the bottom left).

Using the Command Prompt
Navigation with the command prompt can be useful in unforseeable situations.
Note that commands follow a patter of

commandname -options -moreoptions sourcefile.extension destination.extension

Also, quotes are only necessary when there is a space in the name, for example if I were moving “test 123” to “test 321” quotes would be required while for testing123 testing321 they are not.

C: – Jumps to the C: drive. Do the same for any other drive.

cd – Change directory
Example: cd “Documents and Settings”

.. – Look in the directory above
Example: cd ..
(If the current directory is C:\Documents and Settings\, the above command jumps up to C:\)

mkdir – Creates a directory
Example: mkdir testing123

rmdir – Deletes a directory
Example: rmdir testing123

move – Moves or renames a file or directory.
Example: move testing123 testing321

ipconfig – Gives you a lot of information about your physical network setup.

x /? – Any command followed by /? will give you more information about that command
Example: ipconfig /?

Create a free website or blog at WordPress.com.