How to store your Android’s music with Google in 3 easy steps

Many people don’t know that Google offers a free cloud service that lets you store your music on Google’s servers, freeing up a lot of space on your Android phone. This service, Google Music, lets you store up to 20,000 songs with Google and lets you listen to these songs virtually anywhere. Here’s how to get started.

Step 1: Sign up for Google Music

First you need to sign up for this service by going to the Google Music website and sign up.

Step 2: Install Music Manager and choose the folders you want synced

Once you sign up just click ‘Upload music,’ download the Music Manager, and install it. This will sync wherever your music is stored on your computer with your Google account, allowing you to listen to your music anywhere.

Step 3: Install the “Google Music” app for Android

The Google Music app, found in the Play store, allows you to listen to the music stored on your Google account. Instead of storing the music on your phone, playing a song through this app lets you stream your music from Google. There is also a handy widget that comes with the app showing you what you are listening to.

Google Music is a very useful app as it frees up a large amount of space from your phone, especially if your music collection is extensive. You can also listen to your music from your computer via the Google Music website. A very awesome plus is that you can directly buy music from the Google Play store and have the music transferred to your account practically instantly — no need to download beforehand as it’s all stored with Google anyway! Enjoy having one music library available everywhere!

StumbleUponDiggTwitterFacebookRedditLinkedIn

5 Reasons Why the HTC One X is Still Better Than The iPhone 5

The iPhone 5 has recently been released. However, here are a few reasons why I still prefer my trusty Android phone.

1. Bigger Screen

While it may not have a fancy “Retina display,” the HTC One X has a beautiful screen much more vivid than that of the iPhone. While the screen is less dense in pixels than the iPhone, it has more pixels (720 x 1280 vs the iPhone’s 640 x 1136) and pixels are still very small.

2. Better Camera

The camera of the HTC One X is 1.3 megapixels whereas the iPhone’s is 1.2. The One X also has a front-facing camera like the iPhone.

3. Standard Connector

The One X uses micro USB, a very standard and common connector in mobile devices, making it easy to reuse cables for other things. The iPhone 5 has a new connector which is completely unique from any other.

4. Haptic Feedback

Pressing the touch screen on the HTC One X provides haptic feedback. Basically, it feels like you’re pressing buttons when you type. This feedback makes it feel a lot better to type or press buttons on the touch screen.

5. Android 4.0 Ice Cream Sandwich

While it isn’t the latest version of Android, Android 4.0 is still much better than iOS 6. It features widgets, typing via swiping, multitasking that lets you see your windows, and more. The Android OS is a lot more flexible and a lot better than the latest iOS which looks pretty much the same as the last version.

Overall, the HTC One X is still a great competitor to the iPhone 5. It also only costs $100 + plan vs the iPhone 5′s $199 + plan.

StumbleUponDiggTwitterFacebookRedditLinkedIn

The Mystical Coffeescript ‘by’ Keyword Explained

Coffeescript is an amazing language. As a matter of fact, it’s my favorite language. Here’s some recent code I used to split up one array into a multidimensional array with a certain number of columns.

matrix.push arr[i..(i + cols - 1)] for i in [0..arr.length - 1] by cols

Notice the second to last keyword: by.

The `by` keyword basically changes the increment of the generated for loop. Without the `by`, you’d have `i++` as the increment of your for loop. However, with the `by`, you’d instead have `i += 3` if you had `by 3`.

Here’s a simple example where I am getting money out of my bank account in the form of 5 dollar bills.

console.log "I have #{i} dollars." for i in [0..100] by 5

This translates to the following Javascript:

var i;
for (i = 0; i <= 100; i += 5) {
  console.log("I have " + i + " dollars.");
}

As you can see, the increment of the loop is now 5 rather than just 1.

Now the question is, are there any other hidden features of Coffeescript like this?

StumbleUponDiggTwitterFacebookRedditLinkedIn

5 Mistakes Solo Developers Often Make

Developers often code differently when not in a team. They deem many tools unnecessary for projects as “small” as what they’re doing. These tools are really actually pretty useful for solo projects, even necessary.

Mistake 1: Solo programmers think of version control as a publishing system.

These people write maybe 1,000 lines or more of code, then commit with a message of “pushing version 0.3″ or something like that.

First of all, the point of version control is as it says in its name — version control of your source code. It allows you to see every individual part of your code and your thought processes at the time (via commit messages, which are important too). When you make huge commits like this, you are not allowing selected changes to be rolled back.

Version control really is to manage your code’s history. It’s not just for showing off your code to the world. Commit early, and commit often. Don’t store your work on flash drives. If you lose the drive, your project is dead.

If an issue crops up, you won’t be able to roll back the specific part of code that messed everything up. Instead, you’d have to change everything manually, searching for what was wrong. This wastes time and energy and produces frustration.

Mistake 2: Solo programmers don’t write unit tests.

Programmers like this probably debug using print statements and go through the code flow. This usually happens due to laziness and/or a feeling of “I’m the only one messing with my code, so it should work the way I made it work”.

No — this is not the answer at all. Instead of wasting time doing this, how about writing individual tests for each METHOD? Compare the actual result with the expected one and make sure the code is working properly through a myriad of use cases. Furthermore, when you change something, if something breaks, you will know what broke something since your tests broke right after that commit.

This makes everything easier to see. When you don’t write unit tests, not only are you not sure if the code works, but you are wasting valuable time as your project grows debugging and making sure everything still works. An immense refactor could break one thing, but you would have to dig for hours finding what exactly broke and where.

Although, it’s easy to forget to build your project after you change something and commit it, or it takes a lot of time, which leads me to the following statement.

Mistake 3: Solo programmers don’t use continuous integration.

Continuous Integration, “CI” for short, is basically a process where your project is built from your latest source code. Whenever you modify your repository, the CI system basically builds your project, runs tests, and makes sure everything is in order.

People normally don’t use this because it seems like overkill for a simple project. Your project is small and pretty much personal. You can test it all on your own system since you’re the only one building your code. This is pretty naive. There are times where you forget to compile, or you don’t have an IDE handy and don’t see your mistakes right away.

An immediate benefit from this is that it saves time. You don’t have to manually wait to compile your code; as shown in this picture, compiling really takes out time from your programming and breaks your train of thought. Furthermore, it makes sure all builds are run in the same fashion, so that you know code will compile for everyone.

Now, maybe 2 years ago, that wasn’t really an option. You had to purchase a VPS and configure it with Jenkins or some other thing, etc. But now there’s a really nice distributed build system, a FREE one, called Travis. It supports a number of languages, from Ruby to Java to Node to Groovy — it’s constantly getting more and more support for more and more languages.

Travis also emails you when a build breaks and gets fixed, so I get a notification when I make a mistake in my code.

But CI really isn’t useful if you don’t have a nice, automated build script. This brings me to…

Mistake 4: Solo programmers don’t use build automation.

There are a whole lot of people I have seen who decide to commit their .project in Eclipse or their nbproject folder into source control, thinking that that’s all they really need to have a well-made project.

But the problem is, Eclipse users can’t use Netbeans projects and Netbeans users vice-versa. People have to work to get other people’s code working in their development environment.

That’s where build scripts come in. I am a huge fan of Apache Maven. It automatically downloads dependencies and builds your JAR in the way you want it. Best part, it’s universal. I works in all ides and text editors. Everyone just has to type “mvn clean install”. It’s that simple. And by everyone, that includes your trusty friends Jenkins and Travis, too.

By using build scripts, everyone can jump into your code right away. When alone, you can transfer code between computers easily. Furthermore, build scripts usually have other tools part of them, such as replacing variables within files such as version numbers. It really makes things a lot easier and consistent.

Mistake 5: Programmers don’t plan.

They just code. While it’s nice to be on a spree of ideas, you need to engineer your code before you write it. A few months back, I dropped a project because it was too much to maintain — the code was all just too messy and unorganized. I had random classes left and right, all because I didn’t plan the architecture. Good design is important.

Personally, I use Google Docs to manage everything. It’s a nice cloud based service that allows you to work on documents in real-time with others. A text file in a Git projects works too, but Google Docs is probably a better choice.

Conclusion

I think the reason many people don’t follow these rules is because as an independent programmer, they think they’re free to do whatever they want and handle everything on their own. The thing is, they’re not. It’s much, much better to follow the same practices as they’re not called “best practices” for nothing.

People should treat all of their projects as they do group projects — carefully planned, well-made, etc. You shouldn’t be programming in the dark. Commit your code when you write it and treat it as a quality project, not just a bunch of ideas whipped together into a bunch of code.

StumbleUponDiggTwitterFacebookRedditLinkedIn

You know you’re a geek when…

You know you’re a geek when…

  • You know Esperanto or Lojban.
  • You type in Dvorak (or even geekier, Colemak (or even geekier, QGMLWY)).
  • You prefer the Dymaxion projection for maps.
  • You prefer writing integers in base 16 even when not dealing with bitwise operations.
  • You know what Malbolge is.
  • You are on Github more than you are on Facebook.
  • You use Vim because it’s so much easier than a different text editor.
  • You prefer TeX over Word.
  • When saying “What’s Up”, you reply that up is a relative direction.
  • You hate Finder; “cd” and “ls” are all you need.
  • You find yourself saying “sudo” when things don’t go your way.
  • Mac < Windows < Ubuntu < Arch Linux

Things missing? I’m sure there are a lot. Comment below!

StumbleUponDiggTwitterFacebookRedditLinkedIn

Fast line segment interaction in three-space

I’m pretty proud of this code, seeing that I just learned the basics of linear algebra and vector math yesterday.

	/**
	 * Checks for a collision between two line segments.
	 * RoyAwesome says rays are line segments.
	 *
	 *  Perhaps Roy needs to brush up on geometry then
	 *
	 * Code based on http://www.bryceboe.com/2006/10/23/line-segment-intersection-algorithm/
	 *
	 * @param a
	 * @param b
	 * @return
	 */
	public static boolean checkCollision(Segment a, Segment b) {
		return (ccw(a.origin, b.origin, b.endpoint) != ccw(a.endpoint, b.origin, b.endpoint))
			&& (ccw(b.origin, a.origin, a.endpoint) != ccw(b.endpoint, a.origin, a.endpoint));
	}

	/**
	 * Checks if 3 points are counterclockwise.
	 * (A helper for a helper method)
	 * @param a
	 * @param b
	 * @param c
	 * @return
	 */
	private static boolean ccw(Vector3 a, Vector3 b, Vector3 c) {
		//This is Java lisp
		return (c.getY() - a.getY()) * (b.getX() - a.getX())
			< (b.getY() - a.getY()) * (c.getX() - a.getX())
			|| (c.getY() - a.getY()) * (b.getZ() - a.getZ())
			< ((b.getY() - a.getY()) * (c.getZ() - a.getZ()));

	}

As it says in the comments, I borrowed the original idea from this guy.

StumbleUponDiggTwitterFacebookRedditLinkedIn

Why I write open-source code

Recently, I have joined the development team of Citizens, a widely-used server mod for Minecraft. The code for Citizens is open-source, meaning that anyone can view it, fork it, modify it, or even make money off of it. From a business standpoint, I am working for free. Why would I do this?

First off, open source code gets you followers. Future employers, other colleagues, etc. will recognize how good you are at coding by how widely distributed your code is. It shows your ability to work in a team, use Maven, etc. It’s like doing community service. No — it is community service. Doing this shows dedication.

Second, writing open source code augments my skills. I’m learning how to work with others and use the tools of the trade to make everything. I’m learning deprecation and other things you wouldn’t learn from a private project. It’s like an internship, except you’re recognized for your work.

Lastly, I use the code. Linux isn’t written by unpaid people who just have a hobby. Linux is written mostly by companies like Novell, Red Hat, IBM, and even Oracle. Other people are helping me write my code in exchange for me sharing my code. It’s a win-win situation.

Open source software isn’t about doing free work. It’s about giving back to the community

StumbleUponDiggTwitterFacebookRedditLinkedIn