Configure the Ubuntu virtual machine in VirtualBox

Enable shared folders on the virtual machines

To be able to use shared folders between the host ( your workstation ) and the virtual machine.

  • Start the Ubuntu virtual machine in Virtual Box,
  • Select the virtual machine window on your workstation,
  • In the Devices menu of Virtual Box select Insert Guest Additions CD image…
  • Click the Run button,
  • Enter your admin password and click Authenticate,
  • Select the terminal window and press Enter,

  • Restart the virtual machine for the change to take effect,
  • In Ubuntu
    1. Open a terminal window,
    2. In the upper left corner of the desktop click the Search icon,
    3. Type terminal into the search box,
    4. Select the Terminal icon.
  • In the Terminal window create a directory for the mount point
    mkdir ~/host-share
    sudo chmod 777 ~/host-share
  • Mount the Shared Windows location. Get the Machine Folder name from the virtual machine’s Shared Folders tab in VirtualBox

    (If you shared the root of a Windows C: drive, the name is “C_DRIVE”.)

    sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) MY_MACHINE_FOLDER_NAME ~/host-share

Source: https://help.ubuntu.com/community/VirtualBox/SharedFolders

Make the mounting permanent

  1. Create the folder /opt/scripts
  2. Create a new file in the new folder mount_host_share
    #!/bin/sh
    # Mount the Host Share to see the host computer's file system
    echo MY_PASSWORD | sudo -S mount -t vboxsf -o uid=1000,gid=1000 MY_MACHINE_FOLDER_NAME ~/host-share
  3. Make the file executable
    chmod +x /opt/scripts/mount_host_share
  4. On the Ubuntu desktop click the Search icon and type startup, and click the Startup Applications icon
  5. On the Startup Applications Preferences window click Add,
  6. Enter the Name and this Command, and click Save
    /opt/scripts/mount_host_share

The shared drive appears in the File manager.

Relax the password requirement

The virtual machine is already protected by the operating system of the host, your workstation, so it is not necessary to enter the password every time you want to switch to the guest machine. To remove the password requirement

  1. Click the System Settings icon in the sidebar,
  2. Uncheck the Waking from suspend and Returning from blank screen checkboxes.

Configure the Windows virtual machine in VirtualBox

Enable shared folders on the virtual machine

To be able to use shared folders between the host ( your workstation ) and the Windows virtual machine.

  • Start the Windows virtual machine in VirtualBox,
  • Select the virtual machine window on your workstation,
  • In the Devices menu of VirtualBox select Insert Guest Additions CD image…
  • In the virtual machine start Windows Explorer,
  • Open the VirtualBox Guest Additions CD,
  • Start VBoxWindowsAdditions.exe,

The shared folders will be available in the virtual machine’s Windows Explorer as the D: drive

VirtualBox installation and configuration on Windows

Download Virtual Box from https://www.virtualbox.org/wiki/Downloads and follow the instructions to install it.

At the time of writing this was the section where the installer files were referenced

virtual-box-01-download

Run the downloaded installer file and accept all default values.

The installer starts the Virtual Box application.You can close it, we will use other tools to start it in the future.

To be able to launch 64-bit guest operating systems turn off Hyper-V in Windows Features

  1. In the Windows search box enter Windows Features and select Turn Windows Features on or off,
  2. Uncheck Hyper-V and click OK,
  3. Reboot the computer for the setting to take effect.

Create a virtual machine

To create a new virtual machine

Download the  OS image from the manufacturer’s web site.

  1. Start the VirtualBox application
  2. Click the New icon
  3. Enter a name, select the operating system type and version, and set the memory size,
  4. Set the initial size of the virtual hard disk
  5. Select the virtual machine icon and click the Start button,
  6. Click the Browse icon and select the OS image file in the Downloads directory,
  7. Click the Start button

Configure VirtualBox for each virtual machine

 Networking

To share the connectivity of the host computer with the virtual machine, mainly if you use VPN

  1. In Virtual box click Settings
  2. Select Network
  3. Attach the network adapter to NAT

Copy and paste

To enable copy and paste between the virtual machine and the host ( your workstation )

  1. On the General tab of the Settings page select the Bidirectional shared clipboard

Shared Folders

Specify the shared folder on your workstation

  1. In the VirtualBox menu select Preferences
  2. On the Shared Folders tab click the + icon
  3. To share the entire system drive, select the C: drive of your workstation

Configure the virtual machine OS

To configure the virtual machine operating system in VirtualBox, see Virtual machine configuration on the VirtualBox page.

VirtualBox installation and configuration on Macintosh

Download VirtualBox from https://www.virtualbox.org/wiki/Downloads and follow the instructions to install it.

At the time of writing, this was the section where the installer files were referenced

virtual-box-01-download

Run the downloaded installer file and accept all default values.

The installer starts the application.

 

Create a virtual machine

To create a new virtual machine

Download the OS image from the manufacturer’s website.

  1. Start the VirtualBox application
  2. Click the New icon
  3. Click the Expert Mode button
  4. Enter the name, select the operating system type and version, and set the memory size,
  5. Set the initial size of the virtual hard disk, and click the Create button,
  6. Select the virtual machine icon and click the Start button
  7. Click the Browse icon and select the OS image file in the Downloads directory,
  8. Click the Start button,

Configure VirtualBox for each virtual machine

Networking

To share the connectivity of the host computer with the virtual machine, mainly if you use VPN

  1. In VirtualBox select the virtual machine icon and click Settings
  2. Select Network
  3. Attach the network adapter to NAT

If your company use automated software installation and updates, set up a second network connection using the Bridged Adapter. This way the virtual machine will get an independent IP address in the same IP address range as the host machine.

  1. Select the Adapter 2 tab,
  2. Select the Enable Network Adapter checkbox,
  3. Select the Bridged Adapter in the Attached to drop-down,
  4. In the Name drop-down list select the fastest network connection of the host machine.

Copy and paste

To enable copy and paste between the virtual machine and the host ( your workstation )

  1. On the General tab of the Settings page select the Bidirectional shared clipboard

Shared Folders

Specify the shared folder on your workstation

  • In the VirtualBox menu select Preferences
  • On the Shared Folders tab click the + icon
  • Select your home folder on your workstation

Configure the virtual machine OS

To configure the virtual machine operating system in VirtualBox, see Virtual machine configuration on the VirtualBox page.

CloudExceptions::CloudException – 400: VPCIdNotSpecified: No default VPC for this user

When you launch a new EC2 instance in the AWS cloud from the command line or with other cloud management platforms, you may get the error message:

CloudExceptions::CloudException – 400: VPCIdNotSpecified: No default VPC for this user (RequestID: …)

This can happen when the specified Subnet Id is not a valid subnet in the selected availability zone (datacenter).

Start a new Spring MVC Java Web application development in NetBeans

When you create your first Spring MVC Java web application in the base installation of NetBeans follow the steps below

Create a project

  1. In the File menu select New Project
  2. Select the Java Web category, select the Web Application project, and click Next,
  3. Enter the name of the project and click Next,
  4. If this is the first Java web application you create in NetBeans, most likely there is no web server for Java is installed on your workstation. If this is the case, click the Add… button,
  5. Keep the GlassFish Server selected and click Next,
  6. Select the I have read… checkbox and click the Download Now… button,
  7. Keep the latest version selected and click OK,
  8. Make sure the I have read… checkbox is still selected, and click Next,
  9. Click Finish to register the domain on your workstation,
  10. The Context Path shows the address for your application. Click Finish again to continue.
  11. Select the Spring Web MVC framework and click Finish.
  12. If a library is missing from your workstation, a message pops up. Click the Resolve Problems… button for instructions,
  13. On the Resolve Project Problems window click the Resolve… button,
  14. Download the missing library to your workstation. In this case, navigate your web browser to http://www.java2s.com/Code/Jar/j/Downloadjavaeeendorsedapi70jar.htm
  15. Download the “javaee-endorsed-api-7.0.jar” library
  16. Create the folder C:\Users\YOUR_USER_NAME\AppData\Roaming\NetBeans\8.2\modules\ext\javaee7-endorsed
  17. Extract the “javaee-endorsed-api-7.0.jar” file into the new folder,
  18. On the Ant Library Manager window click the New Library… button,
  19. Enter “javaee-endorsed-api-7.0” into the Library Name field and click OK,
  20. Click the Add JAR/Folder… button,
  21. Navigate the to extracted JAR file at “C:\Users\YOUR_USER_NAME\AppData\Roaming\NetBeans\8.2\modules\ext\javaee7-endorsed” and click the Add JAR/Folder button,
  22. On the Ant Library Manager window click the OK button,
  23. On the Resolve Project Problems window click Close.

Start the application

  1. In the Project list right-click the web application project and select Run
  2. The Output window should display a similar message,
  3. Open a web browser and navigate to http://localhost:8080/MY_PROJECT_NAME, to display the index page. The server is case sensitive, so make sure the spelling of the project name is correct.

 

The application configuration files

With the default settings the index.jsp composes the index page. It is in the Web Pages/WEB-INF/jsp directory.

The web.xml file in the Configuration Files directory points to the first Java Server Pages file: redirect.jsp

The redirect.jsp file is located in the Web Pages directory

The Dispatcher

The dispatcher-servlet.xml file contains the mapping between the HTML file, controller, and view.

<property name="mappings">
  <props>
    <prop key="index.htm">indexController</prop>
  </props>
</property>

The bean section specifies the name of the view for the controller.

 <!--
 The index controller.
 -->
 <bean name="indexController"
       class="org.springframework.web.servlet.mvc.ParameterizableViewController"
       p:viewName="index" />

Web Application Build and Deployment

To generate a war file of your web application

  1. In the Project Files directory right click the pom.xml file and select Run Maven > Goals
  2. In the Goals field type
    compile war:war

    and click OK

  3. NetBeans creates the war file in the target directory.

 

Configure NetBeans for Java Web development

The base installation of NetBeans does not include the web development category.

 

To add the Java web development tools to NetBeans

  1. Start the NetBeans IDE,
  2. In the Tools menu select Plugins,
  3. On the Available Plugins tab select the Java EE Base plugin and click the Install button,
  4. If any of the installed plugins is missing the valid signature, you need to click the Continue button to allow the installation,
  5. For the plugin installation, you need to restart the NetBeans IDE,
  6. During the next start, NetBeans installs the new plugins,
  7. The Java Web category is now available.

Create the AWS credentials file from a Chef Data Bag

When a process on a server instance needs access to an AWS account, the user who will execute the AWS CLI commands needs to be able to automatically authenticate in AWS.

For automatic AWS authentication, the AWS CLI creates two files in the .aws directory:

  • config and
  • credentials.

The location of this directory depends on the operating system and the type of user.

  • On Linux, the location is ~/.aws ( the user’s home directory )
  • On Windows, it is located at C:\Users\USER_NAME\.aws
  • On Windows, if the file was created by SYSTEM, the location is C:\Windows\System32\config\systemprofile\.aws

Store the AWS key values

To create these files, you need to store the AWS Access Key and Secret Key. The safest place for these values is an encrypted data bag. To automatically generate the AWS files, create a data bag file and name it the same as the “id” in the following structure:

{
  "id": "MY_DATA_BAG_ITEM_NAME",
  "MY_PROFiLE_1": {
    "region": "MY_REGION_1",
    "aws_access_key_id": "MY_ACCESSKEY_1",
    "aws_secret_access_key": "MY_SECRET_KEY_1"
  },
  "MY_PROFiLE_2": {
    "region": "MY_REGION_2",
    "aws_access_key_id": "MY_ACCESSKEY_2",
    "aws_secret_access_key": "MY_SECRET_KEY_2"
  }
}

To create and encrypt the data bag see my post on Chef Data Bags

Create the AWS authentication files

  1. In your Chef recipe, first install the AWS CLI and reboot the server, so the new path entry will be available for the Chef process.
  2. The following Chef code will create the AWS config and credential files. The script
    1. opens and decrypts the data bag,
    2. loads it into a hash table,
    3. iterates through the hash items,
    4. skips the “id” item,
    5. stores the AWS key values in a temporary file,
    6. executes the “aws configure” command to generate the AWS config and credential files.
  # Iterate through the data bag and create the credentials file

  puts "***** Creating the AWS credentials file"

  # Load the encrypted data bag into a hash
  aws_credentials = Chef::EncryptedDataBagItem.load('MY_DATA_BAG_NAME', 'MY_DATA_BAG_ITEM_NAME').to_hash

  # Iterate through the items, skip the "id"
  aws_credentials.each_pair do |key, value|

    # skip the "id"
    next if key == "id"

    # Add the credentials to the .aws/credentials file
    puts "Account #{key}, Region #{value['region']}"

    batch "add_aws_credentials_#{key}" do
      code <<-EOF echo #{value["aws_access_key_id"]}> input.txt
        echo #{value["aws_secret_access_key"]}>> input.txt
        echo #{value["region"]}>> input.txt
        echo.>> input.txt
        aws configure --profile #{key} < input.txt
      EOF
    end

  end

 

Soundproof Enclosure for the Monoprice Select Mini 3D Printer

The Monoprice Select Mini printer is an open design, all noise making parts are exposed, and as the stepper motors move the head and the platform, the vibration transfers to the table it is sitting on. There are a few sound proof enclosure designs on the internet, but I have found one that looks cool and easy to assemble. The original design doesn’t use the lid as a platform, but as I found out, the lid on flexible legs and the soft foam insulator under the printer greatly reduces the vibration transferred to the table. My family doesn’t even notice anymore when the printer keeps working overnight on a large model. Without the enclosure, I always had to make sure the printer stopped before bedtime.

The enclosure provides significant noise reduction. I have used an iPhone app to measure the noise from 1 meter distance. The 6dB difference doesn’t look too much, but on the logarithmic scale that means half volume reduction.

  • Without the cover: 39 dB
  • With cover, door open: 34 dB
  • Door closed: 33 dB

I could not measure much difference in noise levels with and without the insulator on the door, but during night printing even a small reduction in noise level counts.

My version of the soundproof enclosure for the Monoprice Select Mini 3D printer is based on the great design announced by Daniel Smith at https://www.thingiverse.com/groups/monoprice-select-mini-owners/topic:16820
The original build instructions are at http://imgur.com/a/1571B

In this post, I will show the modifications I made to the original design. Read the original article for more information.

I re post the bill of materials in case the original article disappears:

The total cost of my version is about $150, though you can eliminate a few of the line items to bring the cost down if needed. Ended up not buying the web camera, as I can check on the progress anytime by walking to the printer. Maybe later I will buy it to create time lapse videos.

The extra items in the bill of materials above for my design:

  • Double sided 3M foam tape to attach the custom legs,
  • 8 thin wood screws to secure the blowers.
  • Elmers Glue and clear packing tape to secure the dome
  • 12 strong magnets to attach the insulator to the door if necessary.

The final product

The major differences are the transparent dome on the top and using the lid as the bottom of the box. The dome serves two purposes: Room for the tube at the top of the head, and provides a great view of the 3D object on the platform during the printing process. The lid provides the needed alignment when I put the box above the printer because the build platform almost hits the front and the back of the box.

Mark the openings

Measure twice, cut once told my father, and he was right. The original author already warned us, because the box sits above the printer upside down, it is very easy to cut the openings on the wrong side of the box.  I have started the process with a permanent marker and marked all openings on the box. Before cutting the material, I placed the box above the printer and verified the location of all of them.

The dome

When the head is at the highest position, the feeding tube needs more room than what the plastic box provides.

The transparent dome is the packing material of a large headphone. First I cut the opening for the dome with an electric jigsaw.

The air outlets

The distance between the hole centers is 15 mm, drill the holes with 8 mm drill bits.

Fan mounting holes

The original plan recommended Super Glue to mount the fans, I wanted a more secure hold, so I used thin wood screws to attach the fans to the box. To mark the location of the holes I inserted the screws into the mounting holes of the fans, painted the heads with the permanent marker and quickly pushed them to the planned location inside the box. After a few tries, I could see the screw locations on the walls. I enlarged the marks with a thick permanent marker and using a flash light copied the locations to the outside surface. To get the correct position I used small strips of the insulating material under the blowers because those will be on the surface of the insulator.

Speed controller

I drilled a hole for the potentiometer of the speed controller and used the nut to secure it below the power strip on the left side.

Power strip

Drilled four holes for the zip ties and cut a square opening with a Dremel tool for the plug.

 

Room for the build platform at the back

THe build platform almost touches the front and the back of the box. To make more room at the back I used the same Dremel tool to remove the ribs from the back of the box.

Printer power cable openings

To change the filament, replace the blue painter’s tape on the build platform, or remove a large object, I frequently have to lift the box. To easily position the box over the printer, I use the lid as the base under the printer. To be able to easily remove the box and place it on the floor, the power strip only provides power for the blowers and the LED strip ( I haven’t installed the camera yet ), I left the power supply of the printer outside of the box and plugged it separately into the wall outlet. I used a 5/8″ wood bit and the Dremel tool to enlarge the hole for the barrel plug.

I also drilled two holes for the cable tie to secure the power cord to the lid.

I also had to cut into the edge of the box where the printer power cord enters the box.

Easy lifting

To be able to easily lift the box, I have cut the tabs with the Dremel tool on the sides of the lid where the handles are.

Cool air for the printer

The printer also needs fresh air to cool the control board inside. The Monprice Select Mini has openings at the bottom, so I have cut holes into and elevated the lid with custom legs to provide the air it needs. I used a sheet of paper to copy the exact location of the opening to the lid. The lines are 15 mm apart, and I used an 8 mm bit to drill the holes.

I cut strips of the insulator to lift the printer because I had to pull it forward to provide enough room at the back for the platform. The left side of the printer is much heavier, so it needs more support there.

To provide room for the air flow under the lid, I had to print custom legs for the edge and the center to support the weight of the printer. The diameter of the legs is 30 mm. The height at the edges is 5 mm, under the printer 13 mm. I used the flexible TPU material for better noise reduction, and double sided 3M foam tape to secure them.

Assembly

Cut the insulator

I traced the box to cut the insulator. For the back and side walls make the insulator larger because the turns need extra material. You can cut the excess after you have pasted it in place.

Secure the dome

My dome has a 10mm flat edge around, so I used Elmers Glue and transparent packing tape to secure the dome from the inside of the box. The insulator provides the additional support. I put the blower wires under the insulator of the back wall. Cut an opening in the insulator for the speed controller, do not hide it, because it needs air for cooling. Cut into the insulator for the output of the blowers.

Cut into the insulator where the build platform needs extra room.

LED lights

Install the LED strip above the door and hide the wire under the insulator. Use the USB outlets of the power strip to power it.

Door insulation

I left the protecting paper on the insulator for the door. I use 12 strong magnets to be able to attach and easily remove the insulator from the door. I hold a magnet on the inside surface of the insulator, and another one on the outside of the door. I could not detect significant noise level differences with our without the door insulator, but during night printing every decibel counts.