Stupidest Google Groups Message I Have Ever Found
May 24I understand that google groups has upped the number of permissions that people can tweak. That way, you have separate permissions to join, post, reply, etc. If you want to be a nazi in your group, they give you the power. However, I came across the most ludicrous message I have seen from any google application:
“You do not have permission to leave this forum.”
And just so that folks don’t think I’m just making it up, I took a screenshot.
Now, I know that Google Groups isn’t the most feature rich forum software out there, nor is it the most feature rich newsgroup software. Unfortunately, I have now relegated this to “The place where the retard Google devs get to play.” This is because, whomever thought that this was an appropriate message or rule to make, falls into that category.
(PS – Sorry if I insulted any special needs kids. Just know that you can make fun of some of the Google developers now.)
Simple Groovy-isms
May 17You learn pretty quick when switching over from Java to Groovy. Problem is that it is fairly backwards compatible, so if you aren’t doing something in the easiest way possible, it may be hard to know. For the basics, I just want to state them so that everybody is at least covering the basics.
Scoping
By default, classes are public in groovy. Don’t add the public keyword. Similarly, member variables are private. The accessors and mutators are generated (as you’ll see in the next section).
Accessors and Mutators
Accessors should be adjusted from
dbCollection.getMyVar()
To the following
dbCollection.myVar
Similarly, the mutator
dbCollection.setMyVar(10)
should be used as follows
dbCollection.myVar = 10
It looks like you are accessing the private method, but it’s not. It’s just shorthand for calling the “get” function. This is important because even if there is no member variable – such as x.getCount(), this should still be called using x.count. That’s one of the fun shortcuts in Groovy.
GStrings vs Strings
You should know the difference. It’s pretty important. For info about these, click here. It covers it in depth pretty well. Basically, just know that single quotes and double quotes are very different. And if you use 3 double quotes or 3 single quotes to start a string, you are doing a multi-line string.
Using this, your strings should be adjusted from the following Java-like syntax
dbCollection.insert("abc" + var1 + "def" + var2.prop)
To the following
dbCollection.insert("abc $var1 def ${var2.prop}") (Gstring parses faster using the formatter and string buffers)
Print statements
Although I would suggest that you use something like log4j/slf4j/etc rather than printing directly to the console, print statements get easier:
System.out.println("something")
Should be changed to
println 'something'
Collections
There are so many goodies added to the collections GDK that it’s very hard to cover it all. But syntax-wise, there are only a minor couple of changes to make:
For maps, accessing and
Map m = new HashMap, ?>()
System.out.println(m.get('abc'))
m.put('abc', 2)
should be
Map m = [:]
println(m['abc'])
m['abc'] = 2
Also, the following also works to the same effect
Map m = [:]
println(m.abc)
m.abc = 2
For lists, this
List arr = new ArrayList>()
System.out.println(arr.getAt(2))
Array arr = []
println(arr[2])
For statements
Basically, don’t use them anymore (there are a couple of valid cases, but they are mostly not necessary within groovy. The following for statement
for( i = 0; i < 20; i++ ) { funcCall(i) }
can be rewritten as
(0..<20).each { funcCall(it) }
This uses the range object within groovy. For more details on the Range Objects in groovy, click here. Also, it then uses the each function on the range object, passing it one parameter, a Groovy Closure. Closure's are one of the most powerful things in Groovy. It allows you to design very functionally (rather than in a totally object-oriented way). For more information on these, please visit Groovy's Closure page.
My New Favorite Toys
Feb 15OK, I’m going to admit it. I tend to get really excited about Configuration Management (CM) type work and I have no idea why. This is one of those.
Machine Images/Virtual Machines
Ok, these have been around. If you don’t know what a machine image is, then stop and go download Oracle’s VirtualBox, because it is something that everyone should know. These were revolutionary when they first were introduced. So much so that most Operating Systems support some form of images (disk or machine) right out of the box. Especially because a number of companies, including VMWare and Parallels, found out that they could manage your hardware better than the Operating System (which was originally supposed to do just that, but has really turned into something much more complex and more like a user interface). So, it turned out that if you used machine images, you could have a snapshot to a point in time. Sure, it still required some configuration after getting it going, but after that, it was cake. IT departments (and Dell/Norton, with their Ghost Image partition) were loving it. It really cut the mind-numbing monotony of setting up new boxes.
Puppet and Chef
Essentially, Puppet and Chef do the same thing. Both start on the assumption that you have a base image installed on your box. Both represent a language that gives you the ability to install the software, users, and whatever else is necessary on a box to have it ready for tasking. Both have claimed to support all major OS options. This way, you could install the same users on the Windows boxes and Unix boxes in one script! Of course the multiplatform argument is crap, but it still is a great option to finish what Machine Images started.
Take passwords for example. Each OS handles this so completely differently that you would have to create a different module for the password for each OS. Too much hassle. Most companies are going to pick an OS and stick with it. Heck, most are going to pick the same hardware too. This is the suggested use for almost all companies anyways. Google, Yahoo, Amazon, etc. all use proprietary hardware. But it’s THE SAME proprietary hardware. Every machine has the same specifications. (If you want, check out the Google server machines or the data center). And I’m guessing most of them aren’t Windows boxes. Just sayin’.
So, you create a new machine configuration for each type of machine. One for your Web servers, one for the database servers, etc. Makes scripting all boxes that you might want to make really easy. Plus, in a cloud environment, like Amazon EC2 or privately held HDFS clusters, this makes setting up servers a breeze.
The difference between Puppet and Chef is their target audience. Although they are technically competing products, both companies have pretty much stated that their real competition is the rats net of batch/shell scripts that you’ve probably written, or even better yet the documented instructions like the following. We’ve all written these before. And they even sometimes work. Sometimes.
Vagrant
Another fun toy. So now, assuming you start using the Puppet/Chef to start requisitioning your servers, everything is great. Every server that gets started is always the same. Starts from the same image. Now you know that every server will run the same. Huzzah! But as every web developer knows, we don’t test enough for IE. Why? Because as a developer, I f’ing hate it. Because I don’t use it, I probably miss bugs. Same applies to servers. I’m missing bugs because I work in Windows or OS X, but deploy to a totally different environment.
Vagrant is a fun new tool that takes that really nice puppet script and image that you’d made, load it into a virtual machine, and run it in the background. That way, you have the exact same environment that the server has, but on your local machine. So, if you need to, you can ssh into it. You can update your puppet scripts and push changes to it. It also does port forwarding from your machine to your virtual machine, so that any exposed REST service or port is fully accessible via a web browser. (If you want to play with it, the best install guide I found is here).
Now, you can avoid the annoying statement from your coworkers that is “Well… it works on my machine.” Because I don’t care if it works on your machine. Now, I only care that it works on the production environment. You have it locally, so make sure to test it there.
Boxen
My new toys just got better. Your IT department can now set up your computer for your project within minutes by using a new product called Boxen. This is also based on Puppet and brought to you by the GitHub folks (who also brought you Hubot). This software was originally designed to install project specific files and programs on OS X, but since Puppet is very much a OS independent tool, I’m guessing it will work on Linux (Good luck Windows guys. Although Puppet might work, I doubt the tool will, but only time will tell.)
Overview
So, the tools are changing to help us stand up and deploy 1 to 1,000 servers with ease. Developers can run the exact same environment is working there. Now, we should wait and hope for Internet Explorer to give up on their web engine, much like Opera did (some say for performance reasons) and we might eventually get to a uniform presentation platform as well. Wouldn’t that be nice?
Learning New Technologies
Feb 13For some people, it’s like pulling teeth. I’ve spent all of this time learning Java (which most people still can’t use effectively) and now you want me to start over with something new? Ludicrous!
One of my coworkers recently posted a great comment, which came from Zemanta:
I agree, I can’t keep up, I just finished learning backbone.js and now I’ve found out on HN that it’s old news, and I should use ember.js, cross that, it has opinions, I should use Meteor, no, AngularJS, no, Tower.js (on node.js), and for html templates I need handlebars, no mustache, wait, DoT.js is better, hang on, why do I need an HTML parser inside the browser? isn’t that what the browser for? so no HTML templates? ok, DOM snippets, fine, Web Components you say? W3C are in the game too? you mean write REGULAR JavaScript like the Google guys? yuck, oh, I just should write it with CofeeScript and it will look ok, not Coffee? Coco? LiveScript? DART? GWT? ok, let me just go back to Ruby on Rails, oh it doesn’t scale? Grails? Groovy? Roo? too “Springy?” ok, what about node.js? doesn’t scale either?? but I can write client side, server side and mongodb side code in the same language? (but does it have to be JavaScript?) ok, what about PHP, you say it’s not really thread safe? they lie?? ok, let me go back to server coding, it’s still Java right? no? Lisp? oh it’s called Clojure? well, it has a Bridge / protocol buffers / thrift implementation so we can be language agnostic, so we can support our Haskell developers. Or just go with Scala/Lift/Play it’s the BEST framework (Foresquare use it, so it has to be good). of course we won’t do SOAP and will use only JSON RESTful services cause it’s only for banks and Walmart, and god forbid to use a SQL database it will never scale
I’ve had it, I’m going to outsource this project… they will probably use a wordpress template and copy paste jQuery to get me the same exact result without the headache and inhalfquarter the price.
This is hilarious, and very true. These are new technologies all of them. You can’t keep up with everything. But if you haven’t spent a week programming with one of them, my suggestion is to not shoot it down so fast. These are all tools. And although, as a craftsman, a builder may be able to do many things with a Power Miter Saw. Heck, it might be your go-to tool for most things that you do. Just know that it’s not the tool for every job. And fighting anyone who offers you a reciprocating saw because you don’t want to learn how to use it is silly. Same applies to programming. Get the tool, whether that is Ruby, Clojure, NoSQL database libraries, or just a simple new (to you) JavaScript Library like Backbone (here, have a tutorial). Play with it for a while. Read about it’s suggested use. You’ll find out really quickly that sometimes it’s really useful for some jobs, and not for others.
For example, here’s a great article about Functional Programming. Does it apply to someone writing a single server solution? Nope. So now you know that this doesn’t apply, and that it might not be the best tool for you. But if you are working on something that will horizontally scale, this is the stuff for you. See what I mean? Different tools for different people. Once you get the hang of trying them out, it gets easier to evaluate others. Which makes you a better programmer.


Recent Comments