Posted by: MikeW Date: 2015-07-31 10:38 Tags: java, java se 8, development, REST
My latest Java tutorial is now up on Oracle.com. This tutorial covers how to make a basic REST application using Grizzly, Jersey, and Maven. If you are new to any if these tools, this tutorial is a great way to try them out. You can launch the tutorial from here:
In the tutorial you create an application using the open source Grizzly web server and the Apache Jersey library to create a RESTful web service. The Jersey library is the reference implementation of the JAX-RS Java REST web service API. Jersey makes creating RESTful web services really easy and the tutorial takes you through the process step by step.
Finally, Apache Maven is a Java build tool that makes it really easy to create and manage projects. It also allows you to create new projects using well known tools and templates and automates the process of downloading required libraries. Finally, you use Maven to create create an uber jar file which stores all the required libraries for an application in a single file.
Posted by: MikeW Date: 2015-07-31 12:00 Tags: windows, windows 10
My Windows 10 upgrades have shown up 2 days after I requested them. Yay! That is not too bad, but I still thing there must be some way Microsoft could be more definitive on when your update will show up.
Also, I need to point out you can download a Windows 10 ISO from here. You just need a valid Windows license key to install. The only caveat is the image only does clean installs. So if you are ok with wiping your disk, you can install right away. So I hope you saved your old boxes or wrote down the numbers someplace, because now they become very useful.
Posted by: MikeW Date: 2015-07-29 14:51 Tags: windows, windows 10,
Microsoft has released Windows 10 today! All users rejoice!
But is it released? I got out my windows laptops and started the regular Windows patching process. On my Lenovo, I finally figured out how you request an update (it is a Windows icon on the right side of your start menu). Well, when you click on the little app and fill out the form Windows starts updating right? Wrong! lol.
All you do when you “request” an update is put your machine in a queue for Windows 10 updates. There is no ETA of when you might get your update. Could be hours, days, weeks, heck who knows. This is, of course, a feature to ensure you have a “good” upgrade experience.
What? lol. If I have can’t update today, I am already having a “bad upgrade experience”. Somehow I think giving the folks an indeterminate upgrade date is probably not going to go over well.
Anyway, I will update you again when I finally win the Windows lottery. :)
Posted by: MikeW Date: 2015-07-19 09:03 Tags: java, java8, lambda, streams
Are you interested in learning more about Java 8 lambda expressions and streams? If so, our free 3 week MOOC is live. Taught by Java Evangelist Simon Ritter, this course is just what you need to learn how to use lambda expressions and streams.
To sign up, go to this URL and enroll: https://apexapps.oracle.com/pls/apex/f?p=44785:145:0::::P145_EVENT_ID,P145_PREV_PAGE:4887,143
Posted by: MikeW Date: 2015-07-19 18:26 Tags: ruby, development, date, time
How do you get a rfc 3339 or rfc822 date in Ruby? Why do you want either one? lol. Well, you need these specially formatted dates for Atom or RSS2 syndication feeds. To get the properly formatted dates for current time, use:
Or if you have a date object named
dateVar you can use:
Posted by: MikeW Date: 2015-07-13 18:22 Tags: unix, linux, commandline
Ever want to run multiple SSH scripts but get annoyed by having to authenticate for each one? Well it turns out you can configure SSH to accept multiple commands over a period of time. The name I found on the net for this is SSH multiplexing. Command chaining would be a better name in my opinion. Anyway, this technique allows you to call several commands that use SSH but you only authenticate once! That’s right, authentication happens on the first command, no long waits for each step.
For example, I need to execute 2 rsync commmands to copy files to different parts of my web site. Here are the two commands.
rsync -vaz --rsh="ssh -l username" --exclude=bin/ --exclude=*.DS_Store /Users/username/www/blog/ example.com:~/blog rsync -vaz --rsh="ssh -l username" /Users/username/www/index.html example.com:~/index.html
For each command I would need to authenticate with SSH and each step would have to wait a few seconds for that to happen. So now I can replace this with a series of commands, but before I do that, a little configuration and explanation.
To get this to work, you need to create two things in your
- An empty file named
- An empty directory named
config file, enter the following:
host * ControlMaster auto ControlPath ~/.ssh/sockets/%r@%h-%p ControlPersist 600
The first line tells SSH that any host can use this command chaining feature. If you want to limit it to certain hosts it can be changed to just example.com:
The second line enables the multi command feature. It tells SSH that if an SSH socket alread exists for a host, it is ok to reuse it.
The third line tells SSH where to store the socket information. This is why we created a
sockets directory. The string
%r@%h-%p tells SSH to name the socket file
username@hostname-port. If the username you log in with is different then your login username, then you will need to change the name so it matches the remote host. For example:
Finally, the fourth line tells SSH how long to leave the socket open if the open socket is not closed. In this case a value of 600 seconds (10m) is specified. You can also use minutes:
60m as a unit of measure for this option.
With everything setup, let’s take a look at our
rsync commands. This time, we will wrap them in special SSH commands.
ssh -l remote-username -Nf example.com rsync -vaz --rsh="ssh -l username" --exclude=bin/ --exclude=*.DS_Store /Users/username/www/blog/ example.com:~/blog rsync -vaz --rsh="ssh -l username" /Users/username/www/index.html example.com:~/index.html ssh -O exit example.com
The first command sets up the shared socket. The
-l option specifies the login name. The
-N option tells SSH not execute a remote command. The
-f option tell SSH to wait in the background.
The last command closes the open socket for that host. The
-O option passes a command for SSH to execute on the open socket. In this case,
exit tells SSH to close the connection.
Well that is the short version, though not very short. If you need more information on this topic please take a look at the resources linked below from which this post was built.
Posted by: MikeW Date: 2015-07-07 22:35 Tags: movie, review
Ex Machina is a scifi thriller about AI and androids (the robot kind, not the phone kind). The basic premise is a brilliant, but reclusive, genius founder of a Google like company lives in a remote place in Alaska or Canada. He invites his top developer out to his estate to help him with a top secret project which turns out to be a female android. The developer dude tests out the android and drama ensues when the android tells him the evil genius is an evil genius.
This review does contain spoilers so if that is an issue, stop reading now.
So as you may have guessed I have a few issues with this film.
Most of the elements for the movie were just not believable for me.
First, I didn’t buy the whole evil genius lair in the woods. It just comes off as silly to me. Too hard to build. Too remote to be useful. The shear logistics are just dumb.
The evil genius dude seems more like a drunken hipster than some sort of software/hardware genius. At no point do I think the character is capable of making the female androids.
Finally, the female androids are over the top. This dude’s first attempt at an AI results in Blade Runner type androids? Please…
Posted by: MikeW Date: 2015-07-05 21:54 Tags: misc
The blog is back. It is still under construction, but basic functionality has been restored. The main difference is we now have full SSL support. Will be adding Atom and RSS feeds soon. The UI probably needs an update too. Anyway, more to come. :)