494 Project – APE Grader

Finally finished up this class! Thought the day would never end. For my senior project, I was part of a group that implemented a sort of scheduling application for a special type of exam that the CS department at EWU gives to determine who gets to move further on in the degree. Basically it tests your abilities to make linked lists, recursion, and other general programming principles in the Java language.

This application lets you register for an exam if you’re a user, lets you grade exams if you’re a grader, and administer things if you’re an administrator. Pretty simple.

Trac link: http://trac.austrianalex.com/494/

SVN: https://trac.austrianalex.com/svn/494/

Mostly all the good information can be found at the trac site. I won’t go repeating it here. This program, like other good little programs, is released under GPLv3. If this code is useful to you, go ahead and use it

Posted in Programming and Coding, Technology | No Comments »

Half a year isn’t so bad…

…you know, for a new blog update. I mean, if I really had more time to type things into my website only to have it be publicly criticized, gosh darn, that’s all the motivation I need! I don’t need time, I don’t need to work on linear algebra homework, I can just write in my blog. Because I haven’t done it in a while. Half a year isn’t so bad.

So what’s new? I’ve began dabbling a bit into open source software in my free time (instead of writing in my blog! the blasphemy) and while the project is nothing too glamorous at this point, it is being maintained and updated…in my free time…blog…

Yeah, so the concept of this project was to simply take the existing (and pretty well built) wTorrent project and turn it into something more advanced…like wTorrent Advancedyes, very original; it took me all of my non-existent free time to come up with that and the logo.

wTorrent Advanced

Ok, so what is this exactly? Simply put, it is a web interface to a shell based torrent client (rtorrent) that communicates via XMLRPC. This project takes wTorrent’s codebase and improves the general user experience by adding in nifty little controls – file management, expanded admin capabilities, torrent management enhancements via categories/tags/whatever I want to put in. More details can be found at my trac site.

Right now, the project is very bleeding-edge and alpha-phasish, meaning if you want to try it, it’s at your own risk.

Now it’s 10PM and I gotta check woot.

Posted in Programming and Coding, Site Updates | No Comments »

Java Pacman™ — Pacmon!

So back in the spring, I was in a GUI class at my university that made me program a simple java based version of Pacman™. After screwing around with it for a bit more, I figured I might as well post it up on my site for others to enjoy or learn from (aka improve on my mistakes).

Technical Highlights

All of this code is made with Swing, which makes the animation on slower computers (and even some faster computers) a bit jaggy. The animations themselves are timed with java.awt.Timer’s, then the panel is repainted every 1/4 of a second at least, making that jagged effect happen. Yeah, I could have optimized the repaint function a little by making some buffers with the terrain and whatnot, but I was lazy.

There are 3 LinkedList objects being repainted: the terrain classes (Wall, Floor), the food classes (currently only “Pill”), and the Creature classes (Player and Monsters).

From PacCanvas.java

   /**
    * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
    */
   public void paintComponent(Graphics gfx)
   {
      //super.paintComponent(gfx) ;
      Graphics2D g = (Graphics2D)gfx;
      int statusFood = 0;
	  ListIterator titerator = tstorage.listIterator();
      while ( titerator.hasNext() ){
    	  Terrain t = titerator.next();
    	  t.draw(g);
      }

      ListIterator fiterator = fstorage.listIterator();
      while ( fiterator.hasNext() ){
    	  Food f = fiterator.next();
    	  statusFood++;
    	  f.draw(g);
      }

      ListIterator citerator = cstorage.listIterator();
	  while ( citerator.hasNext() ){
		  Creature c = citerator.next();
		  c.draw(g);
	  }

      frame.setStatus("Level: "+curLevel+". Current Points: "+statusPoints+". Number of pills left: "+statusFood+". Number of lives left: "+lives);
      if (statusFood == 0 && !end)
    	  newLevel();
   }

Each creature has its own timer that is called for animation and movement purposes.

The levels are basically preset by MazeGrid.java at 20×20 with declarations made in PacCanvas.java. An example is made below. 0 initializes a floor, 1 a wall, 2 the player, and 3 and above are reserved for monsters (these are all viewable from a switch statement made in the initial terrain linked list building function (wherever that is)).

From PacCanvas.java

transient final int lvl[][] = {
   {
			1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
			1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,
			1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,0,0,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,0,1,0,1,0,0,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,0,1,0,1,0,1,0,0,1,0,1,0,1,3,1,0,1,0,1,
			1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,0,1,0,1,0,1,0,0,1,0,0,0,1,0,1,0,1,0,1,
			1,0,1,0,1,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,
			1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,0,0,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,0,1,0,1,0,1,0,3,0,0,1,0,1,0,1,0,1,0,1,
			1,0,1,0,1,0,1,0,0,1,0,1,0,1,3,1,0,1,0,1,
			1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,0,0,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,
			1,2,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,
			1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
   }, ...
}

Everything was pretty much made public in terms of global variable declaration (actually more like default…), just so I didn’t have to worry about get and set statements and not having proper permissions, etc. If you want to do a better job, go right ahead :P . Oh yeah, I also gave direct access to frames from the canvas and menus below it (or in it, so to say), again for ease of access.

For the final version, I disabled the music from playing at startup, but this can easily be enabled from withing the main “main” function. The music is played with the tritonus_share and zoom libraries. The RelativeLayout library is used for the dialogue boxes (I had to go to awt.dialogue boxes because the swing ones (JDialogue) didn’t work properly once the game was started for some weird reason).

The gameplay specifics can be found in the readme document in the zip file attached to this post. The main program itself is licensed under the GPL v3, with the source code being in the main jar file.

Pacmon Screenshot

Pacmon Screenshot

In unrelated news, I had to use two alt codes in the title of this post.

PacMon Download

Posted in Programming and Coding | 2 Comments »

Redesigned: A new layout

So a month or so back I decided my site needed a bit of a face-lift. Thus, at that point I gathered together what resources I could gather, created a test directory, and started mashing away at a new look. And today I present the first look for the new Austrian Alex site – with theme adequately named “Simplistic Matters”.

So what’s new in this theme?

  • A LOT of new optimizations in the CSS code and image files, making the site load faster.
  • XHTML 1.0 Strict compliance for all pages, along with validated CSS
  • A more professional template with a more simplistic view. Easy to read and standardized.
  • Wider layout – optimizing screen real-estate for those bigger monitors.
  • No more wide column layout. All pages have a sidebar which simplifies navigation.
  • Various bug fixes with coding and images.
  • A new logo. That’s actually readable. YAY.
  • And some other things I can’t think of at the moment.

All in all the site turned out to be somewhat decent and the web designing part of my head has been fed. The design is not done yet, as I have a few more things in terms of bordering and coloring to add. Gray is good, but it’d be nice to add some vector art here and there and get away from everything rectangular. Or not; it all depends, but I put up a beta version of this template anyways.

So if you’d like to, tell me what you think of the new layout and any improvements you might suggest.

On another note, the gallery template has not been changed, so it’s still using the same old layout. This will be my next item to fix up.

And for further news, I am planning on destroying the Windows Vista OS I am currently running this server on (yeah, you’re probably looking at your monitor in complete shock, but it works great with Apache…) and switching over to some version of Ubuntu (there, happy now? No, I won’t switch over to server software because I need a desktop platform to actually do work at work :P ). This will happen as soon as I obtain an external hard drive to back up data and such on this computer. There will probably be a day or so of “downtime” (I will move the contents over to another computer and it’ll be hosted there for a while), but I am unsure of the exact date.

Posted in News and Info, Site Updates | No Comments »

Linux: The Better Alternative

When it comes to desktop oriented operating systems, Windows has been essentially monopolizing the market by being sold on every popular brand of computer. This in turn brought more popularity to the Windows operating system and created a standard for operating system software. The idea that every computer comes with Windows on it is not far-fetched, as most computer manufacturers include the operating system with their pre-built systems. However, anyone who had ever had spyware on their computer, anyone who had ever had a system crash, and anyone who had to spend hours trying to get tech support to get their computer back up and running was most likely one of the victims of Windows, not knowing that there were any other alternatives for their PC.

So here comes in Linux, the operating system that was originally built by Linus Torvalds, a Finnish hacker, to enhance the original UNIX systems that were currently in place at the time (Petreley). While it originally served a purpose for servers, Linux has been developed into a desktop platform as well, taking on the look and feel of any current Windows environment. Not many people have heard about Linux, unfortunately, and those who have are under the misconception that Linux is something for “geeks” to use, meaning it takes a lot of time to adapt and learn it. However, this misconception along with many others, are the reason why this operating system isn’t heard about or used more today. So why should Linux be used instead of Windows?

Linux is easier to use.

One of the main driving forces behind Linux is the implementation of many distributions of Linux – different looks, different functionality, and different computing purposes for each version. This may not seem easy at first; with many choices of Linux spread around on the internet, choosing a version that best fits your computer can be daunting. There are distributions of Linux suited to be a media center, a server, a graphics developing desktop, or just a plain and simple Windows look alike. “Ease of use in Linux is typically custom created by the user, to the user’s specifications” (Short). Not sure which one is best? Try them out. Most Linux distributions actually have a live version of their software for you to experiment with; plug the CD into your computer, play around with the distribution of Linux, and if you don’t like it, simply take the CD out and try another – without harming any data you currently have on your computer in any way. To compare, there is no trying out with Windows – you either have it installed on your computer or you don’t, so you never really know for sure exactly how well it would run on your computer before you take time to install it. Using Linux is just as easy, and if not easier than Windows. Most Linux distributions have a graphical environment similar to that of Windows – there are folders you can open up, there are applications you can open up, etc (Petreley). Anybody who has been able to use the basic functions of Windows could easily use Linux.

Linux is more secure than Windows.

The initial argument made behind Windows security is the fact that because there are more installations of Windows worldwide, it is therefore the prime target of attacks by hackers (Petreley). That being said, if Linux was to undergo the same amount of scrutiny in numbers, the operating system would show many inherent flaws that would have been otherwise unseen. This type of thinking is, of course, somewhat faulty. The Apache webserver, a native application of the Linux environment, is used by over 70% of all internet hosts, including Yahoo and Google because of its stability (Petreley). Yet, being the most popular webserver on the market, it doesn’t have a lot of security issues – while the issues it has are fixed almost immediately. This same sort of security applies to all of the Linux distributions, where a security issue is brought up and then fixed usually within a day (Petreley). Compare this to Windows which will fix a security issue the same day only if it is critical, otherwise updates and patches to the operating system are only released every second Tuesday of the month (a.k.a. “Patch Tuesday”). Furthermore, this also proves that Linux was built right the first time around, since it was built by security experts who knew exactly what they were doing. “Linux is security oriented and Linux users enjoy that inherent security” (Short). On a related note, the words anti-virus and Linux are rarely used in the same sentence – there just isn’t a need for Linux to have those kinds of programs when the security on it is already implemented well.

Linux is free and will always be free.

This compared to the current prices of the latest version of Windows, which ranges anywhere from $100 to $220, is quite an incentive for people who are looking to save money or who are on a budget, especially schools or organizations which have a lot of computers to maintain (Horowitz). An average computer lab which uses Linux instead of Windows ends up saving about $7,000. Linux is free to download, free to copy, and free to share with your friends, unlike Windows which forbids any of those actions. Ubuntu, an independent Linux distribution, steps the idea of “free-ness” up a notch and actually offers premade CD’s of their software shipped to your house at absolutely no cost to you (Ubuntu). Along with that, the company behind Ubuntu, Canonical, also provides full commercial support for the operating system, so you’re not left to fend for yourself if you do decide to switch from Windows (Ubuntu). Sure, you may get what you pay for, but you get so much more when you don’t have to pay anything at all.

Linux is not only free, it is open source.

This allows the person who is using Linux to take the source code of the operating system, change whatever they want to change in terms of functionality and features, compile those changes, and then redistribute the new operating system however they want to. The idea behind this is to customize a system based on the type of computer you have. For example, if a person has a five year old computer, they will have to buy a new computer to be able to run the latest version of Windows on it. However, they can also choose to save money and have the latest and greatest by switching to a custom designed version of Linux that runs on little resources to the computer itself – distributions of Linux such as Xubuntu (a lightweight version of Ubuntu) and DSL (Darn* Small Linux) which run with a simpler interface to save memory but still have the latest programs and features needed in a common operating system.

Linux is simply a better alternative.

Microsoft most certainly does not enjoy the idea that there is competition for their operating system, mainly that the competition is literally giving away their product. Or that the product given away is easier to use, more secure, and more customizable than their product. So why isn’t everyone switching to Linux now? As mentioned before, the standard for the operating system lies heavily with Windows at the moment. However, the standard can always change.

Works Cited

Horowitz, Michael. “Linux vs. Windows (a comparison).” 22 September 2002. MichaelHorowitz.com. 21 May 2008. <http://www.michaelhorowitz.com/Linux.vs.Windows.html>

Petreley, Nicholas. “Security Report: Windows vs. Linux.” 22 October 2004. The Register. 21 May 2008. <http://www.theregister.co.uk/security/security_report_windows_vs_linux/>

Short, Chris. “Linux and Ease of Use.” 10 June 2003. Lockergnome. 21 May 2008. <http://www.lockergnome.com/chrisshort/2005/01/04/linux-and-ease-of-use/>

Ubuntu. 20 May 2008. Canonical Ltd. 21 May 2008.
<http://www.ubuntu.com/>

Posted in Computers, Reports, Technology | 2 Comments »

Vista IP Blocking II: uTorrent

Seeing as how quite a few people found the previous article on a PeerGuardian alternative in vista useful, I decided to adapt the tutorial to fit a client that is used a little more frequently – uTorrent.

Those of you still interested in making this work in Azureus, you can read my previous article. As for anyone who is wondering on how to block IP addresses without using PeerGuardian in uTorrent, here it is (also, I assume you already have installed uTorrent at this point):

  • Open up uTorrent and head over to Options -> Preferences on the menu bar. Click on Advanced and search for ipfilter.enable – make sure that it is set to true (it should be by default). Close uTorrent.
  • Go ahead and open up Blocklist Manager:

blocklist-manager-main

  • Click on the Sources button. It should download the latest available source file locations (not the actual IP lists themselves, as they will come later).

BlockList Manager Sources Download

  • Now go to Tools->Options (Ctrl+O). Head on into the Sources option on the left. You should see something like this:

BlockList Manager Sources

  • Enable all the sources as you see fit. Just remember, this blog is on an Edu Range Wink
  • Now, head back to the main screen of Blocklist Manager and go to Export -> Export Manager in the menu bar.

Export Manager Blocklist Manager

Set the following fields:

Name: Whatever best fits
Format: eMule/Donk
Location: XP - C:\Documents and Settings\<USERNAME>\Application Data\uTorrent\ipfilter.dat
Vista – C:\Users\<USERNAME>\AppData\Roaming\uTorrent\ipfilter.dat
Export Location Active: Checked

And click Add

Now, go back to the main screen of Blocklist Manager and click Process. This will automatically download all the sources and compile a list of IP addresses which now need to be put somewhere. At this point, make sure that uTorrent is fully closed (out of the taskbar). Click Export List to export the IP addresses to the blocklist file. It may ask you if you want to overwrite the previous file – say yes.

You will also want to keep up to date with your IP listings; make sure you process and export the list from Blocklist Manager weekly or monthly (or daily if you are absolutely paranoid). The sources themselves are rarely updated, but it is nice to check by just clicking on the Sources button. Other than that, happy IP blocking!

Posted in Computers, Technology | 49 Comments »

DNS Problems

My web server has recently undergone maintenance and has moved to a new location. As such, I attempted to have the domain point to a temporary web page while this was all going on.

Now, except for the fact that GoDaddy has now taken my domain hostage to make any changes back to what they were, everything seems to be working dandy. Meaning the main site is back online, but that’s about it. I’m currently working on getting the gallery and private music site online at the moment, but without the DNS propagations, I am currently at a stalemate.

Hopefully things will fix themselves soon enough.

Edit: March 11, 2008

Nar, GoDaddy is still being a brat and isn’t changing my settings correctly. That, and with the recent events of GoDaddy taking down a legitimate website has made me move over to another registrar. Hopefully 1&1 will serve me better than GoDaddy has.

Posted in Site Updates | No Comments »

MySpace: The Last Straw

Why did they decide that my personal website was “dangerous”?
Any links I attempt to place anywhere on MySpace linking to my personal site: www.austrianalex.com gets filtered through a buggy filtering software. I’m thoroughly disgusted at this point that my site may even be remotely linked and related to any spamming services through the eyes of MySpace, and thus I say screw it. Screw MySpace, the social networking site that bases most of its services revolving around serving spam content through various forms of annoying advertisement (save the ones caught by AdBlock Plus…thanks to whoever made the lovely firefox extension), and then disables linking to a highly reputable site such as mine (well, highly reputable in the sense that it isn’t flooded with the same ads…actually none at all). Viruses and trojans? Why the hell would I store them on my webserver? And as for an associated IP address to the domain, it’s part of an EDU network…so if MySpace decides to block me, they might as well block all of Eastern’s website along with it.

Long story short, screw MySpace. I’ve seriously wasted too much time there to care about how it fails (because some day, it will, there’s no question about that). Throughout its many security vulnerabilities, hypocrisies, and one of the ugliest, most pathetic excuses for a web site design I’ve seen around on the internet, I must say adieu to this personal site filtering crap hole so called “Web 2.0″ site.

[*] You may be asking yourself, “Hey, what was it about that link that got it in trouble?” An excellent question! 99% of the time, it’s because of our buggy software that our first year college interns (who are thinking about having computer science as a career but usually never make it past their freshman year) make. You can’t blame them for that though, they can’t really handle programming and watching porn at the same time. They know HTML though!!!1!1!1 OMGLOLWTF”
-fixed your typo

Posted in Rants | No Comments »

C Me

So, I recently made my first “major” C program. While I did have previous experience with the C syntax and whatnot (C++ being the very first language that I learned on my own), I found C to be just as or even more…how to put it…ancient? I mean, this language is as old as I am practically. Nonetheless, it is still being used and is still pretty high level compared to assembly, so I don’t mind…much.This program basically takes grades inputted from the user, forms a linked list out of them, and calculates the grades, forming a % and gpa. The full specs can be found in the attached PDF. Note, I did not include main.c, because all it does is call the run() function.

func.h

/**
* Created on: February 05, 2008
* @author Alexander Chernikov
* @license GNU Public License v3
*/
#ifndef FUNC_H
#define FUNC_H
#include
#include
#include
//Set any G_* to 0 to have user input on max points
#define G_ASSIGN 0
#define G_QUIZ 25
#define G_TEST 100
#define G_EXAM 200

#define P_ASSIGN .40
#define P_QUIZ .10
#define P_EXAM .25

#define CAT 4

//Linked List FTW - the APE did bad things to me
typedef struct node {
double data;
int max;
struct node* next;
} list;

list* grades = NULL; //global linkedlist for storing a dynamic list of grades

void addNode( double, int); //adds a score and a max score
void clearList(); // obligatory command for memory - no memory leak for YUO!
void printlist(); //for debugging...unfortunately, the problem was never here

void getCatMax(int*); //gets number of items per category
void getScores( char*,int, int);

double calculateGPA(double*, double*); //actually calculates percentage...too lazy to change name
double calculateScores();

void print_results(double*, char**, double);

#endif

Func.c

/**
* Created on: February 05, 2008
* Grade Calculator
* Utilizes ALL extra credit available.
* @author Alexander Chernikov
* @license GNU Public License v3
*/
#include "func.h"
/**
* Sort of another main..err...
*/
void run(){
int catMax[CAT] = {7,3,2,1}, catMaxPoints[CAT] = {G_ASSIGN, G_QUIZ, G_TEST, G_EXAM};
double avg[CAT], catWeight[CAT] = {P_ASSIGN, P_QUIZ, P_EXAM, P_EXAM}, gpa;
char* catName[CAT] = {"Assignment","Quiz","Test","Final Exam"};
//list* grades = NULL;

//send off catMax to a function which asks for catMax values
//but just the first 3! we only have 1 final.
getCatMax(catMax);
//two for loops - outer with 4 for each category, inner doing catMax[x] and passing strings
int i, j;
char* s;
printf("\n");//just because
for ( i=0; i < sizeof(catMax)/sizeof(int); i++){
for (j = 0; j < *(catMax + i); j++)
getScores( *(catName+i), *(catMaxPoints+i), j+1);
avg[i] = calculateScores();
//DEBUG
//printlist();
clearList();
printf("\n");//just because

}
gpa = calculateGPA(avg, catWeight);
//print out results here
print_results(avg, catName, gpa);
}
/**
* The end - printing and quitting
* @param avg - Array of average scores from each category
* @param catName - array of category names
* @param perc - calculated overall percentage
*/
void print_results(double* avg, char** catName, double perc){
printf("--------------------------\n");
printf("Percentage per category.\n");
int i;
double gpa=4;
for (i = 0; i < CAT; i++)
printf("\t%-10s: %2.2f%%\n", *(catName+i), *(avg+i)*100);
printf("\nYour weighted percentage is: %%%3.2f\n", perc);
if (perc < 95)
gpa -= (95-perc)/10;
//and then the "exceptions"
if ( (int)perc == 63 )
gpa = .9;
else if ( (int)perc == 62 || (int)perc == 61 )
gpa = .8;
else if ((int)perc == 60)
gpa = .7;
//fail
if (perc < 60)
gpa = 0;
printf("Your grade point is: %1.1f\n",gpa);
}
/**
* Retrieves scores from user input
* @param name - Name of category
* @param maxPoints - Set number of the highest grade (0 for custom)
* @param num - the number of the item (Test #2 etc)
*/
void getScores( char* name, int points, int num){
double val;

if (points == 0){
printf("Please enter the max points possible for %s #%d: ",name, num);
scanf("%d", &points); //assuming the user is in HSL, otherwise add a while loop.
}

printf("Please enter grade for %s #%d: ",name, num);
scanf("%lf", &val);

while (val < 0 || val > points){
printf("Error: value is below 0 or above max points (%d) please re-enter grade: ",points);
scanf("%lf", &val);
}

addNode(val,points);
}
/**
* Calculates all scores in list and gets a percentage.
* @return double - percent average of category
*/
double calculateScores(){
double score=0, max=0;
list* temp = grades;
while (temp != NULL){
score += temp->data;
max += temp->max;
temp = temp->next;
}
return score/max;
}
/**
* Used to calculate GPA, now calculates overall percentage
* @param avg - Array of average scores from each category
* @param catWeight - Array of category percentage weights
* @return double - overall percentage, not GPA...I was lazy to change title
*/
double calculateGPA(double* avg, double* catWeight){
int i;
double score=0;
for (i=0; i < CAT; i++){
score += *(avg+i)**(catWeight+i);
}
return score * 100;
}
/**
* Gets max items in category from user
* This could have been modularized a bit more, but again, lazy.
* Also built so it won't ask for Final exam...since there is only 1.
* @param catMax - array to initialize
*/
void getCatMax(int* catMax){
int val;
printf("# of assignments (0 or less for default): ");
scanf("%d", &val);
if (val > 0)
*catMax = val;
printf("# of quizzes (0 or less for default): ");
scanf("%d", &val);
if (val > 0)
*(catMax+1) = val;
printf("# of tests (0 or less for default): ");
scanf("%d", &val);
if (val > 0)
*(catMax+2) = val;
}
/**
* Adds nodes to list - last item added to the front of list
* @param item - user inputted score
* @param max - max number of points possible, can be user inputted
*/
void addNode( double item, int max){
list *temp = (list *)malloc(sizeof(list));
if (temp == NULL)
return;
temp->next = grades;
grades = temp;
temp->data = item;
temp->max = max;
//return temp;
}
/**
* Removes contents from list.
*/
void clearList(){
list* p;
while (grades != NULL){
p = grades;
grades = grades->next;
free(p);
}
}
/**
* A debugging method - prints list contents
*/
void printlist(){
list* temp = grades;
while (temp != NULL){
printf("%f %d\n", temp->data, temp->max);
temp = temp->next;
}
}

Assignment #1 – Instructions PDF

Posted in Programming and Coding | No Comments »

WPG2 Installation: A bit of a hassle.

So I was browsing the internet today and checking for latest versions of software (PHP, Apache, etc) and I thought I might as well check on an update for Gallery. I was looking through the page and found that WordPress can be integrated with Gallery through a plugin; how I did not come across this plugin before is beyond me. So of course, the installation of said plugin turned out to be a necessity.

Everything went smoothly, as with any other plugin – it got put into the plugin directory and activated through the WordPress Admin section. Then to editing the options – walking into the first tab under WPG2 presented me with a nice entry about “your Gallery rewrite module has been disabled. Go to the next tab to re-enable.” Alright, I thought to myself, shouldn’t be too hard to get fixed up. The next tab presented me with a mostly white (no CSS) style page that told me that the URL rewrite couldn’t be enabled and to go and re-enable it within Gallery. Odd.

So, I navigated back to the main tab of WPG2 only to find myself staring at an Internal 500 Server error. Great, the plugin broke something on my machine. All of my site (including my Gallery) was filled with Internal 500 Server errors. I couldn’t disable the plugin through the WordPress interface because of this, so I went and tried manually deleting the files from the plugin directory – only to find that something was still locked onto the folder, not letting me delete it. I then proceeded straight to the .htaccess files (since I knew that the error had something to do with rewriting one of these) located in the root directories of my site and found that they hadn’t been touched since the upgrade that I did a few weeks back. Odd, yet again.

Replacing all my files in my site directory with backups didn’t help either; my site was still filled with the 500 error. This plugin couldn’t have messed something up with Apache itself, could it? After all, this wasn’t a malicious plugin of any sort. I went back to my Apache directory and checked folder modification dates to find that the only folders that had been affected recently were those of the logs. Ah, why hadn’t I thought of that yet – check the error log and see what Apache is really complaining about. Sorting through the various data and 404 errors, I came across to the last entries – something about URL rewriting not being able to accept a parameter (edit: specifically “C:\.htaccess: RewriteBase takes one argument, the base URL of the per-directory context”). Interesting. Even more interesting was that Apache was now referring to an .htaccess file that was under C:\. Why in the world would an .htaccess file be written there? Apparently, this was a problem with Gallery itself as the functions that were invoked were from the Gallery coding referenced by the WPG2 plugin (though the plugin could have passed in some bad parameters as well, not really sure here at this point – URL rewriting works perfectly with Gallery, so I assume it’s something with the plugin).

So I deleted the .htaccess file from the “ultimate” root directory and found my site to be back up and running. Well, that’s good, but I still want the plugin to work…so how? Well, if something (either the WPG2 plugin or Gallery) likes writing to C:\.htaccess, let’s make it so it doesn’t. Making a blank .htaccess file and setting the permissions to read-only, I moved it to the C:\ directory and then went back to the WPG2 rewrite tab in the Admin section of WordPress. Needless to say, everything else went quite smoothly from then on. I’m still going to check in on exactly which function call made that .htaccess file in the first place and hopefully fix this need for the blank .htaccess hack.

Edit: (12/12/07) The .htaccess file is only needed the first time you enter into the rewrite tab in the WPG2 options. After initializing the rewrite options through there, I could remove the .htaccess file and have no further problems. So it must be something in the first “set-up” of this plugin that’s causing this problem.

Posted in Programming and Coding, Site Updates | No Comments »