I don’t know about you, but I’ve gotten weird errors on occasion when I’m trying to write code like “if (i == 0)” and I inadvertently miss the double equals. Then, you have a double whammy because the if statement will probably always execute, and then i is set to 0. Bad Thing.
There’s a really easy way to avoid this, though! Reverse the check: “if (0 == i)”. The equality check is bidirectional, but you can’t assign a value to a numerical constant. So, if you happen to miss the double equals, the compiler will throw an error instead of pretending you knew what you meant.
It’s hard to break years of habits, but it’s a darn good idea to retrain yourself.
Note that in Python, this is irrelevant because the Python interpreter won’t let you have an assignment in an if statement (it throws a SyntaxError).
“Oh, I have to write a robot that solves a maze? Sweet, sounds like a great time to get inventive! I’ll just create an artificially intelligent robot, no big deal.”
“Hmm, okay, maybe I can use Dijkstra’s algorithm.”
“Crap. Well, I’ll just implement the right-hand rule. That shouldn’t be so bad.”
“I guess I’ll just have it move randomly. Gotta get this done!”
“I HAVE NO CLUE HOW TO DO THIS.”
So, there’s a package manager for windows that’s actually really well done. By default it’s only got a command line interface but you can install a GUI through it if you want.
It’s called Chocolatey, and the selection of packages is pretty impressive. For example, `choco install android-sdk` installs all those fun tools automatically and adds them to your $PATH. Or `choco install 7zip` installs it and before you know it it’s ready to use. There’s packages for most anything – JRE, Flash, VLC, Adobe Reader, countless development tools…it’s really handy. And, of course, you can update what you have installed with it by `choco update`.
@powershell -NoProfile -ExecutionPolicy `
unrestricted -Command "iex ((new-object `
&& SET PATH=%PATH%;%systemdrive%\chocolatey\bin
It’s a lot like Homebrew for Mac or apt-get (or whatever your favorite package manager is: yum, yast, pacman, emerge…) for Linux.
Definitely worth a shot! I use it a ton.
After programming for 3 years exclusively in Eclipse and its brethren (Pydev, CDT, etc.), I’ve made a switch that I’m really happy about.
Don’t get me wrong, Eclipse is not a bad IDE, it’s just sometimes too bloated and cluttered and not quite powerful enough. I really like that it has a plugin for everything under the sun and you can do all your development, in any language, in one program. But it was time.
I tried many different IDEs, ranging from Apple’s Xcode, Microsoft’s Visual Studio, and many more. I even tried going the text editor route, using both vim and Sublime, both of which are good at what they do, just not for developing code.
I found perhaps a bit of an underdog in IntelliJ IDEA and its brother PyCharm. They come in two varieties – one open source, without some advanced features (e.g. Django development with PyCharm), or a more hefty version, with a hefty price tag. For me, the so-called “Community Edition” works great.
You get all the cross-platform goodness and raw power of Eclipse, combined with the sleekness and elegance of Xcode, along with the code analysis toolbelt of Visual Studio. It’s the best of all the worlds, I think. And I’m happy with my move.
I’ve discovered a cool thing called BitTorrent Sync. It’s basically Dropbox on steroids, using BT technology. I’m always glad to see BT used for good, not evil.
You pick any number of folders to sync, and it provides you a secret for each which you can enter in on another computer – perhaps another computer of yours, a mobile device, or even a friend or family member’s computer. It then syncs anything in those folders between the devices (and you can choose manually on the phone, where space is limited), just like Dropbox. But it’s like having multiple Dropboxes, with no size limitations…that you can share with your friends completely if you want. The only catch is, and it’s both a positive and a negative, is because BT is peer-to-peer, it can only sync if another device is on and connected. That’s good because your data doesn’t go in the cloud, but bad if you have a handful of mobile devices but nothing that’s usually on.
Yes, it’s the BitTorrent protocol, which has some negative connotations. Security-wise, everything is 256-bit AES and the most an attacker could figure out is the IP addresses of the devices you use. As far as the app itself, it’s not currently open source, so it may not be for the paranoid, but for the average joe it should be fine.
You can also use it from the mobile app to backup a folder – say you don’t want to use Google+ or Dropbox, or you’ve run out of space on them. You can have it sync your pictures to your desktop, or anything else you might think of (app backups, rom image “just in case”, etc.)
So, for a class I had to write a 32 bit ripple carry adder in C, using only binary operators. This is what I came up with, although I’ve got to try and get rid of the increment operator, as I’m not sure I can use it.
For some reason, sometimes the gist viewer doesn’t work or load, so in case that happens, here’s the link.
Well, unsurprisingly, I didn’t finish all of my goals. But I actually made some progress!
- I became reasonably competent in Ruby, although not Ruby on Rails.
- I reached 1.0 in Pyberry (and beyond!).
- I read Killing Lincoln but due to a mishap with ordering my new Kindle Paperwhite, didn’t read a book in Spanish.
- I started to look at Android ROM development but decided it’d be easier to wait until I had my big desktop back.
I still feel reasonably accomplished! But now it’s back to school, and I’m already tired of that.
It was an…interesting first week. I had my first two days of classes, and then I got the news that my grandfather had passed away. So I decided to go spend time with my family and join together in celebrating his life (and not go to class for the rest of the week).
But now I’m back in class, and it’s boring and exhausting. I’d be a lot happier if the temperature would at least get above freezing…