Wednesday, 11 February 2015

AWS Learnings

This post is for me not you ☺

I've started looking at Amazon Web Services as a cheap and easy way to host my various projects. Yes valued reader, that is another reason for this blog to die!
Since my memory is horrible I'm going to make a couple posts about the "problems" I faced. And by problems I mean things that weren't immediately obvious.


Creating a server


So you want to create a server? That's pretty vague. Let's attach some context.
> PHP, Linux, potential for autoscaled instances, auto load balancing, MySQL, simple code upload process.
Great! Let's use AWS Elastic Beanstalk!



  1. Click the 'Create New Application' link in the top right.
  2. Enter all the details, paying attention to: 
  3. Click Go
  4. Wait
Things of note. 
  • You don't have to choose an auto-scaled application right off the bat. You can select a single instance and change it later. This is great for testing that things actually work. 
  • You can add multiple environments later. If you want to separate dev, test and prod, you can do that. 
  • It gives you a readable URL. That's nice. 


How do I create my Application Source


A .war file for Java or a .zip for other supported languages. Pretty simple. 


Uploading a new Version


  1. Click on the environment you want to upload the new application version to. 
  2. Click "Upload and Deploy"
  3. Upload your version and give it a name
  4. Click Deploy
  5. Wait


Connecting to your RDS through PHP in your EC2


Now that you have an RDS and your PHP in an EC2 (or a couple of them), you are going to need to find a way to connect to the RDS. 


Setting environment variables


Now that you can connect to your RDS you are probably going to want to store your database access credentials as environment variables. Here's how you do that:
  1. Select the Environment for which you would like to add the variables
  2. Select Configuration from the left hand panel
  3. Click the gear icon on the Software Configuration box
  4. Scroll to the bottom of the page
 




I'm sure there will be more stuff but this will do as a quick post for now. 

Tuesday, 21 October 2014

Security Status Calculator - EVE

This post is a tool for EVE Online.

The calculations are well known but no one seems to have written a simple calculator for working out your new security status if you kill a dude.

So here you go:


Want to play for free? Here is a 21 day trial :3

Wednesday, 3 September 2014

Apache Server Permission Error

Every single time I create a new apache server I forget to give permissions to the www-data group. So I'm pasting a great answer I got from stackoverflow to this blog for future reference.

//Create new group
$ sudo addgroup webdev

//Change the group of your web directory:
$ sudo chgrp -R webdev /var/www/
$ sudo chmod -R g+rw /var/www/

//Set the guid bit on all folders in your web directory:
$ sudo find /var/www -type d -exec chmod +s {} \;

//Add Apache to the webdev group:
$ sudo usermod -a -G webdev www-data

//Add your user to the webdev group:
$ sudo usermod -a -G webdev <user_name>

Hopefully this helps someone

Monday, 13 January 2014

CreepTD Tower Defense

You require Java to play this game.

Play CreepTD - Online Multiplayer Tower Defense

Tower defense games are pretty cool. But something that's always been absent from them is multiplayer. This game has it. Give it a go. Pretty self explanatory if you know about Tower Defense games.

Saturday, 9 November 2013

Linux ATI Underscan Issue

I've recently installed Debian onto my PC and ran into the same problem I had with Ubuntu, and had to spend a long while finding the fix to it. I actually also had this problem with the same drivers on Windows 7 but the Catalyst Control Center GUI makes finding the answer a lot easier.

Here's the problem:

Images of problems thanks to am7146 of ubuntuforums [source]

The problem was due to the default setting of the ATI drivers setting the underscan to 20%. Why they would do this, I have no idea.

The solution is (as you'd expect) to change some of the settings! But which settings? Not the ones on the thread with the problem images!

I found the answer on askubuntu, here.

aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0

Now if I ever decide to reinstall Linux on this box again I have the solution handy.

Monday, 28 May 2012

Exception Help

Keep find myself searching which exceptions to throw when, in regards to 'this code should never be reached' exceptions. Found a great post by Kevin Bourrillion, a software engineer at Google, which can be found here. Which I've copied below.
"
I've noticed a lot of confusion about what type of unchecked exception is the right one to throw under various circumstances. Here's a very simple explanation of the most common types.

NullPointerException
Multiple schools of thought on this one. Of course, it's thrown automatically by the runtime when you try to dereference null. Many say that you should never rely on this behavior, and should always check for null explicitly. Many also believe that when you find a null reference, you should throw IllegalArgumentException instead of NPE. This way, a thrown NPE always indicates some programming error in the implementation of the method, not a failure of the caller to pass valid parameters. I'm not taking a stand on this issue right now.

IllegalArgumentException
Throwing this exception implies that there exists at least one other value for this parameter that would have caused the check in question to pass. If the caller can't remedy this exception by substituting another value for the argument in question, it's the wrong exception to throw. Note that in some of these cases IndexOutOfBoundsException is more appropriate (and strangely, IOOBE doesn't extend IAE).

IllegalStateException
This exception implies that there are no argument values that could have caused the check to succeed, yet, there does exist at least one alternate state that the instance in question could have been in, which would have passed the check. Note that this type almost never makes sense for a static method, unless you rely heavily on static state (shame on you). Note also that this exception is appropriate whether or not it is possible to actually mutate this aspect of the instance's state, or it's already too late.

UnsupportedOperationException
This means that the method invoked will always fail for an instance of this class (concrete type), regardless of how the instance was constructed.

AssertionError
This is the right exception to use whenever a statement should by rights be impossible to reach.
"

Cheers,
Michael

Monday, 20 February 2012

By The End of 2012, I Will [Continued]

An update on this, as we are almost 2 months in.

1. Books read: 
The Stand, by Stephen King.
A Brief History of Time, by Stephen Hawking.

Currently reading:
Cell, by Stephen King

I'm not counting these but I'm also reading / have read a bunch of MLP fan fiction.
My Little Dashie, by ROBCakeran53.

Heonnshy, by Fenix.
And a bunch other short one chapter stories not worth mentioning.

2. Marathon Training:
Got a stationary bike and riding that on occasion. Making progress and that's the main thing.

4. Flip:
Not much done here. Doing handstands and stuff. Surely my overall fitness increase is helping this too.

5. Android Game:
Another game. This one based on Raiden.
Also have a working prototype. Doing this one straight to Android instead of coding to PC and then porting, like I tried with the last one. Once I get the prototype working, I'll post it up here.

6. Foods:
Had some Takoyaki a couple weeks ago. Pretty damn good so had some more this week again. That will do it for me, but I'm going to keep eating odd stuff where I can.

3. 7. 8. 9. 10. The rest:
Yeah, nothing. Some of these are one off things that I don't really need to prepare for, and will just happen when they happen.

On a funny note, this guy:

Cheers,
Milk