Archived entries for Uncategorized

M68000 Assembly Language Bounce Animation

This is a bouncing ball animation I made in Easy68K – a Motorola 68000 assembly language simulator.

This animation places the coordinates of the ball onto the stack frame as the ball falls, and uses a recursive function call to draw the ball on the way back up.  Below is an animated GIF screen capture of the Console I/O window showing the animation. Cool stuff.

 

Polynomial Graphing Software

This is another project that I created for school. It can be used to graph any polynomial in terms of a single variable with an integer degree. The plotter allows the user to input a polynomial, the variable the polynomial is in terms of and the range they wish to model the given polynomial over. The software also automatically graphs the first and second derivatives of the given polynomial.

Users can specify polynomials using integer operands and the operators: +, – , *, (multiple * operators for exponentiation)

For example:

(x*x)-6

x*x*x*x+4*x-4

(x-3)*(x+4)

0

4*x

-x

etc…

You can download the jar file here.

Feel free to try it out, suggest improvements and identify any bugs! Feedback can be left below.

Java BigInteger Calculator

This is a project I made for school. It is very similar to the windows calculator and supports the following operations on objects of the Java BigInteger class: addition, subtraction, multiplication, division, factorial, remainder, negation.

You can download the .jar file here.

You can leave a comment below!

Raspberry Pi Ordered!

Ordered a Raspberry Pi today. Updates to come!

Scripting Craps Odds In Java

Just thought I would show you guys a nifty little program I made in Java to simulate your odds on the dice game Craps. The main for loop of the program simulates one game, and you can adjust int i to simulate different numbers of games.  The final output shows your total wins, the total house wins and your winning percentage. As you can see, the house ALWAYS wins!


package myPackage;
import java.util.Random;

class Main{

public static void main(String args[])
{
float houseWins = 0;
float yourWins = 0;
int thisSum;

Random myRandom = new Random();

for(int i = 0; i <= 10000; i++)
{

/**
Roll two die, take their sums to establish the "come out roll"
**/

int roll1 = myRandom.nextInt(6) + 1;
int roll2 = myRandom.nextInt(6) + 1;

int comeOutRoll = roll1 + roll2;

//Automatic win
if(comeOutRoll == 7 || comeOutRoll == 11)
{
yourWins += 1;
}

//Automatic loss
else if (comeOutRoll == 2 || comeOutRoll == 3 || comeOutRoll == 12){
houseWins += 1;
}

//Play the game
else
{
boolean playing = true;

while(playing)
{
roll1 = myRandom.nextInt(6) + 1;
roll2 = myRandom.nextInt(6) + 1;

thisSum = roll1 + roll2;

if(thisSum == comeOutRoll)
{
yourWins += 1;
playing = false;
}

else if (thisSum == 7){
houseWins += 1;
playing = false;
}
}
}
}

float winPercentage = (yourWins)/(yourWins + houseWins);

//Print the results
System.out.println("Your wins: " + yourWins);
System.out.println("House wins: " + houseWins);
System.out.println("You win: " + winPercentage + "% of the time!");
}
}

Creating GnuPG Keys Using Cryptophane

My GunPG key got obliterated when I formatted my Ubuntu box. So today, I went about the task of setting up a new key. While playing around with Cryptophane, I noticed the documentation is a little sparse. So I am going to run through a quick tutorial about creating and using the program.

Cryptophane is a GUI frontend for the GnuPG encryption framework. Do a quick Google search to download it. It saves a lot of messy command line work, and works quite well. It allows you to create GnuPG keys, import/export keys and sign keys. This guide outlines how to set up and use the keys.

I am not going to explain the technicalities behind how GnuPG keys work (nor do I understand them). Wikipedia has all that info.

Generating Key Pairs

Generating key pairs is pretty simple.

Go menu > keys > generate secret key

Enter all the information is asks. Remember to write down your pass phrase. If you forget it, you will be unable to decrypt any items encrypted with your public key.

Set an expiry date if you wish. This is not necessary. Whatever works for you.

Encrypting

Create a .txt file containing the data you wish to encrypt.

Open Cryptophane, right click your public key >  “Encrypt To”.

Navigate to your file.

Click Process on the menu that comes up.

The selected file will now be encrypted.

Decrypting

To decrypt a file encrypted with your public key right click on the .txt file you want to decrypt.

Click open with Cryptophane.

Select a file name and location for the decrypted document.

Enter your private key paraphrase when prompted.

That’s all there is to it! If you have any questions/comments/concerns,  use comment form below!

IronKey Launcher Hanging On Windows 7

About this time last year, I purchased a new HP laptop complete with Windows 7. Unfortunately, my IronKey refused to work on this new machine. After clicking on the IronKey unlocker icon, the program would appear to load, the hard drive would click for a few seconds, then the program would hang. Nothing. A quick crtl + alt + del would indeed show that the ironkey.exe process was running, but no menu.

After two extremely unhelpful calls to IronKey support, even they admitted (I am paraphrasing here) “We have no idea what the hell is wrong”. After upgrading software versions, investigating drivers and playing with it for hours, I gave up. Thanks guys.

Well just for the record, the latest version of the IronKey software, version 2.5.1.0 released on Jan 6. 2012 has fixed this problem.

Better late than never I guess.

SEO Is A Complete Joke

Spam emails occasionally provide me with a source of hilarious entertainment. Ones that advertise “search engine optimization” are one of my personal favorites. What exactly IS search engine optimization?.  Google will provide you with numerous interesting results, however I thought I would come up with a short (yet not complete) list of all things SEO:

SEO is:

  • A complete scam
  • A way to make your “firm” look like it actually does something
  • A common subject of spam WordPress comments.
  • A common subject of robot Twitter accounts
  • A common subject of spam emails
  • Marketed in all the above ways with a lack of basic grammar using excessive links from url shortening services
  • A way to make your “firm” look like it actually does something
  • Commonly conducted by a click center
  • Not taken seriously by anyone
  • Overcharged
  • Overrated
  • A way to make your “firm” look like it actually does something
  • A “lingo” to give the impression you understand “all things web”
  • A often hilarious gimmick
  • A way to make your “firm” look like it actually does something
  • SEO < Nigerian fax scam
  • A overused buzzword
  • A way to make your “firm” look like it actually does something
  • The subject of 4,674 (and counting) spam comments in my trash can
  • The subject of numerous weblogs that dont have a clue
  • A way to make your “firm” look like it actually does something
  • Extraordinarily obnoxious
  • Meaningless
  • A way to make your “firm” look like it actually does something
  • That (insert groan here) when yet another SEO bot follows you on Twitter
  • A way to make your “firm” look like it actually does something
  • Especially the above ^

Disabling Those Annoying Blue HP Hotkeys

I have never used a É character in my entire life. I doubt you have either. HP on the other hand, apparently sees things a little differently. In fact, it is quite likely they think you need this “bilingual caps lock” about once a day. I sure don’t.  Around once a day, I was running into an annoying little problem: I found my self typing these characters at the worst possible times. When there is 10 minutes left in a Computer Science lab, and your struggling to complete all the tasks, the last thing you need is this annoying problem.

Judging from a quick Google Search, hardly anyone knows how to fix this problem (besides from rebooting) and judging from my call to HP tech support last night, they don’t know how to solve it either. Fantastic! (Even though they had absolutely NO IDEA how to fix it, they DID want to sell me an extended warranty, but that’s another story!)

Either way, I did figure out how to disable these annoying hotkeys after accidentally pressing some mystery key combination in the bottom right corner of the keyboard. The solution is simple. Press:

Ctrl + Left Shift + Right Shift

Eclipse and Infinite While Loops

It’s 2AM. I’ve been programming all day. My laptop was acting up, and I am blaming it all on Eclipse. Ahhhhh Eclipse, its one of those love hate relationships, ya know?  Turns out I did not properly set a condition on a while loop, and my CPU got caught up in infinite loop. This, combined with the simple fact my desk can barely be seen amongst the Mountain Dew cans and miscelanous math homework, should indicate I should be getting to bed. After all, I have to do it all again tomorrow!



Copyright © 2013. All rights reserved.

RSS Feed. This blog is proudly powered by Wordpress and uses Modern Clix, a theme by Rodrigo Galindez.