Tuesday, November 25, 2014
11/25/14
Today I continued working on the Searching and Sorting chapter, and I decided to go through each of the exercises. Although some confused me, I managed to finish them all, and then I went back and doublechecked them. I'll do a bit more studying when I get back and then I'll take the test.
Friday, November 21, 2014
Thursday, November 20, 2014
Although this is completely unrelated, I thought it was important enough to document on my blog so I decided to do so.
Today, I had to install CentOS7 on a server. Since I'm taking Java and everything, I thought I'd get back into hosting servers for Minecraft, since development for them is done in Java and it's pretty much where I got all of my knowledge. I also learned a ton of Linux commands from doing this. However, it's been a year or so since I last had a server, so I decided now would be a good time to pick it back up.
I first installed CentOS Minimal to my server PC. I chose Minimal because I don't really need the GUI, only command line to run a few Java programs - Spigot, which is a high-performance re-coded Minecraft server, and BungeeCord, another Java program which creates a proxy, enabling a player to teleport in between multiple hosted servers on the same machine or different IPs. For the most part, it's used with Spigot.
I got CentOS Minimal from their website, then installed it to a flash drive with Lili USB Creator (since in Windows, it's overly complex to create drives).
I then installed it to the PC, and then I had to get Java 8. That I had to do via FTP, since I had no GUI. I used FileZilla. After going into the directory, I installed it by typing:
tar xzf jre-8u25-linux-x64.gz
I then had to install the server. I first made the directories:
mkdir Minecraft
cd Minecraft
mkdir Bungee
mkdir Server1
...
mkdir Server20
Although it's considered only 1 server, there are actually 20 servers, each running their own sets of plugins and game modes, etc., for the people that play on them. For this test server, I won't be running them all at once, however, once they go live, I usually go with a dedicated server with at least 64GB of RAM, and preferably an E3-1275 or better for CPU. Since there's so much activity going on, and so many players (avg. 350-500 per server * 20 servers if the server is known) a lot of resources are used up.
Anyways, in each directory, I then used FileZilla to put the server .jar file in each folder, and one-by-one ran each server. I then also went into the Bungee folder and ran that .jar file. Then, I used BungeeCord to tie all the servers together. Essentially what this means is, as soon as a player joins the game, they will be able to choose where they'd like to go without having to close their game and join a different server.
After this, I had to setup a web server. All good servers allow for a website for their players to communicate on forums, donate, vote for the server on server lists, etc. For my website, my personal preference was to use XenForo. When I bought it, it was a bit pricey ($140). But it's highly customizable with CSS, and it definitely does a good job of handling forums.
I used FileZilla to install XenForo. I also made a TeamSpeak installation (will come in handy later).
And that's about it! I now have a fully usable test server. All servers are run with screen so that they can be viewed and reloaded to test new code and plugin additions.
Today, I had to install CentOS7 on a server. Since I'm taking Java and everything, I thought I'd get back into hosting servers for Minecraft, since development for them is done in Java and it's pretty much where I got all of my knowledge. I also learned a ton of Linux commands from doing this. However, it's been a year or so since I last had a server, so I decided now would be a good time to pick it back up.
I first installed CentOS Minimal to my server PC. I chose Minimal because I don't really need the GUI, only command line to run a few Java programs - Spigot, which is a high-performance re-coded Minecraft server, and BungeeCord, another Java program which creates a proxy, enabling a player to teleport in between multiple hosted servers on the same machine or different IPs. For the most part, it's used with Spigot.
I got CentOS Minimal from their website, then installed it to a flash drive with Lili USB Creator (since in Windows, it's overly complex to create drives).
I then installed it to the PC, and then I had to get Java 8. That I had to do via FTP, since I had no GUI. I used FileZilla. After going into the directory, I installed it by typing:
tar xzf jre-8u25-linux-x64.gz
I then had to install the server. I first made the directories:
mkdir Minecraft
cd Minecraft
mkdir Bungee
mkdir Server1
...
mkdir Server20
Although it's considered only 1 server, there are actually 20 servers, each running their own sets of plugins and game modes, etc., for the people that play on them. For this test server, I won't be running them all at once, however, once they go live, I usually go with a dedicated server with at least 64GB of RAM, and preferably an E3-1275 or better for CPU. Since there's so much activity going on, and so many players (avg. 350-500 per server * 20 servers if the server is known) a lot of resources are used up.
Anyways, in each directory, I then used FileZilla to put the server .jar file in each folder, and one-by-one ran each server. I then also went into the Bungee folder and ran that .jar file. Then, I used BungeeCord to tie all the servers together. Essentially what this means is, as soon as a player joins the game, they will be able to choose where they'd like to go without having to close their game and join a different server.
After this, I had to setup a web server. All good servers allow for a website for their players to communicate on forums, donate, vote for the server on server lists, etc. For my website, my personal preference was to use XenForo. When I bought it, it was a bit pricey ($140). But it's highly customizable with CSS, and it definitely does a good job of handling forums.
I used FileZilla to install XenForo. I also made a TeamSpeak installation (will come in handy later).
And that's about it! I now have a fully usable test server. All servers are run with screen so that they can be viewed and reloaded to test new code and plugin additions.
Learning Sequential and Binary Search
Today I read and reviewed the chapter. I learned about the Sequential and Binary Search methods. From what I've learned, this is basically what they are:
Sequential search: Standard search method. Goes through the array multiple times, going up one element at a time. If the element is the one it's looking for, it stops, and returns the position.
Binary search: A faster method. Continues checking for the element, but halves its amount of things it searches each time it is run, making it a lot more efficient.
I plan to take the test Monday!
Sequential search: Standard search method. Goes through the array multiple times, going up one element at a time. If the element is the one it's looking for, it stops, and returns the position.
Binary search: A faster method. Continues checking for the element, but halves its amount of things it searches each time it is run, making it a lot more efficient.
I plan to take the test Monday!
Wednesday, November 19, 2014
Tuesday, November 18, 2014
11/18/14
I decided to skip the exercise, as I was extremely close to completing it anyway and I knew the material. Today, I fully completed all the Turtle labs (minus a few that required me to open their project in Eclipse). I'm now ready to take Test 17, which I will do tomorrow!
Monday, November 17, 2014
EIMACS 11/17
Today I finished the last section of EIMACS and began working on the compareTo exercises. I'm currently stuck on Activity 26.3, and I'm working on a bug related to arrays. My array is 1 longer than it should be, according to the stacktrace, so I'm working on figuring that bug out and will hopefully fix it tomorrow.
Friday, November 7, 2014
Ubuntu App Dev
I can't seem to get my app working and I keep getting these two warnings:
:-1: warning: security_policy_groups_safe_app (debug): (REJECT) reserved policy group 'debug': not for production use
The debug policy group is automatically injected and should only be used for development.
To create a package for the store use the publish tab!
:-1: warning: desktop_Exec (app): found unexpected Exec with architecture 'all': ./qtc_device_debughelper.py
I searched up both errors but I wasn't getting any clear solutions. I think my Javascript may be incorrect because I noticed you need to add things like "UI.". On the other hand, I am not getting errors for the meanings app but it still won't work as intended and I don't know why but I'm guessing it is something small. Also, I downloaded the Pixel Dungeon Repo and I quickly changed some values like defense and health which is a cheap way to make the game easier. Alex and Finn helped me with it a bit because I had to change the name of the package but I haven't tested to see if it worked.
:-1: warning: security_policy_groups_safe_app (debug): (REJECT) reserved policy group 'debug': not for production use
The debug policy group is automatically injected and should only be used for development.
To create a package for the store use the publish tab!
:-1: warning: desktop_Exec (app): found unexpected Exec with architecture 'all': ./qtc_device_debughelper.py
I searched up both errors but I wasn't getting any clear solutions. I think my Javascript may be incorrect because I noticed you need to add things like "UI.". On the other hand, I am not getting errors for the meanings app but it still won't work as intended and I don't know why but I'm guessing it is something small. Also, I downloaded the Pixel Dungeon Repo and I quickly changed some values like defense and health which is a cheap way to make the game easier. Alex and Finn helped me with it a bit because I had to change the name of the package but I haven't tested to see if it worked.
Some bugs!
Today I worked a bit more on the Where am I? app and came into some issues. First off, my Nexus 7 isn't giving a last known location (error on the line that assigns a Double to both the latitude and longitude). This might be an issue with GPS or something similar not being enabled or allowed on the device, so I'll attempt to to bugfixes as well as test it on a different Android device hopefully over the weekend.
Edit: Today I also helped Aki with setting up his IntelliJ so that he could try getting his modified game to work. In the end, we realized that they have no USB Debugging drivers for the Android SDK on Linux (in other words, you can't plug in an Android device for testing in the SDK). Therefore, we had to put his project on my computer so he could test it on his phone. But this didn't work as it was a Java Applet, so I couldn't download it. We'll re-attempt it Monday.
Edit: Today I also helped Aki with setting up his IntelliJ so that he could try getting his modified game to work. In the end, we realized that they have no USB Debugging drivers for the Android SDK on Linux (in other words, you can't plug in an Android device for testing in the SDK). Therefore, we had to put his project on my computer so he could test it on his phone. But this didn't work as it was a Java Applet, so I couldn't download it. We'll re-attempt it Monday.
Thursday, November 6, 2014
Ubuntu App: Clicking a div
I wasn't able to figure out the problem with my meanings app and I got kind of frustrated so I abandoned it for now and I tried to make my own small app. I decided to make a div that when pressed would add a class. I had one error about my maintainer name because I was unaware you had to put a certain name for that field but I fixed that not too long afterwards. I also had 2 warnings that I don't really know how to fix and I couldn't find a solution on the internet.
In my body I simply had a div that also started with a class
<div id="test" class="blink">TEST</div>
I just used two classes that were already provided, the div started with "blink" which I'm assuming would make the div fade in and out
.blink {
animation:fade 3000ms infinite;
-webkit-animation:fade 3000ms infinite;
}
and when clicked would have the class "is-hidden" which I'm also assuming just makes the div disappear
.is-hidden {
display: none;
}
My javascript was just a click function that would add the class "is-hidden"
$(document).ready(function() {
$("#test").click(function() {
$(this).addClass("is-hidden")
});
});
In my body I simply had a div that also started with a class
<div id="test" class="blink">TEST</div>
I just used two classes that were already provided, the div started with "blink" which I'm assuming would make the div fade in and out
.blink {
animation:fade 3000ms infinite;
-webkit-animation:fade 3000ms infinite;
}
and when clicked would have the class "is-hidden" which I'm also assuming just makes the div disappear
.is-hidden {
display: none;
}
My javascript was just a click function that would add the class "is-hidden"
$(document).ready(function() {
$("#test").click(function() {
$(this).addClass("is-hidden")
});
});
Wednesday, November 5, 2014
Meanings
I did the "Meanings" Tutorial and yet it doesn't work. I was having an error with importing my jQuery but I fixed that. I am guessing it is some small error that I will have to search for. It's weird because it runs with no errors or warnings but it doesn't actually give me any definitions so I don't know if the button doesn't work as intended or I messed up some small bit of code.
A Huge Discovery!
Today I did some research for my Where Am I? app, and didn't find much, until I eventually discovered the Google Geocoding API, which is exactly what I was looking for! Not only did it provide looking up areas' coordinates, but it also did something called Reverse Geocoding, which is essentially what I needed. What reverse geocoding is, is when you're given latitude and longitude, and you need to figure out a location, such as a nearby address and zipcode. I figured out that the Reverse Geocoding via the Google Geocoding API allows me to use JSON to figure out a location from the coordinates the tablet gives me, which not only lets me look up the location for my app, but also ties into my last app (the JSON Example), and I can use some code from that.
I copied over my two JSON read methods that I found earlier in a StackOverflow post (from the past project).
public static JSONObject readJsonFromUrl(String url) throws Exception {
InputStream inputStream = new URL(url).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
String jsonText = read(rd);
JSONObject json = new JSONObject(jsonText);
return json;
}
finally {
inputStream.close();
}
}
private static String read(Reader rd) throws Exception {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
The Google Geocoding API requires an API key. This is limited due to Google wanting to limit a certain amount of requests per day (so that they don't get overloaded by them). Luckily, I have a Google Developer License, so I was able to easily obtain one that allows me a very decent amount (in the low thousands) of requests per day. I haven't tested the app yet to figure out which JSON arrays I need, etc., but I'm very sure that I'm extremely close to finishing the app. Not only will it tell you the nearest address, but it will also tell you your city, state, postal code, country, and even where you're standing (whether it be on a rooftop, etc.). I haven't yet tested the accuracy of this, but it seems to me like it'll be very accurate!
I copied over my two JSON read methods that I found earlier in a StackOverflow post (from the past project).
public static JSONObject readJsonFromUrl(String url) throws Exception {
InputStream inputStream = new URL(url).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
String jsonText = read(rd);
JSONObject json = new JSONObject(jsonText);
return json;
}
finally {
inputStream.close();
}
}
private static String read(Reader rd) throws Exception {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
The Google Geocoding API requires an API key. This is limited due to Google wanting to limit a certain amount of requests per day (so that they don't get overloaded by them). Luckily, I have a Google Developer License, so I was able to easily obtain one that allows me a very decent amount (in the low thousands) of requests per day. I haven't tested the app yet to figure out which JSON arrays I need, etc., but I'm very sure that I'm extremely close to finishing the app. Not only will it tell you the nearest address, but it will also tell you your city, state, postal code, country, and even where you're standing (whether it be on a rooftop, etc.). I haven't yet tested the accuracy of this, but it seems to me like it'll be very accurate!
Monday, November 3, 2014
Making the Where am I? App Part I
Today I made the first part of the Where am I app. So far, I've gotten it to get the current latitude, longitude, and altitude, however I haven't gotten the time to test it. I did this by creating a LocationManager, then creating a Location that is found by calling the LocationManager's getLastKnownLocation method. From there, I can determine the Location's latitude, longitude, and altitude. Hopefully, I'll be able to use these to eventually determine the location of the user, and put this into a text box that will display it.
Sunday, November 2, 2014
ImageView
On Friday I tried adding another pop up this time with a picture along with text. I looked at the method called ImageView which would display said image. So I made another button and basically did the same thing I did with my previous one but this time added an extra method. I am currently getting no errors which is good but I'm pretty sure it won't do anything right now because I still think my syntax is wrong but I think I could get it working soon.
Subscribe to:
Posts (Atom)