Sunday, November 22, 2015

Minecraft: The Castle that commands and command blocks built

My middle son was playing Minecraft and wanted a command block. He didn't really know what they were or what they did but he wanted one. I did a little research and found you have to use a command to get a command block.


This gives the player listed the number of command blocks specified. If no number was specified it defaults to one.

If you wanted 47 diamonds you would do something like:

/give YOUR_PLAYER_NAME_HERE diamond 47

Once you have mastered that you can move on to the next phase.

Targeting the nearest player. Instead of targeting a specific player you can target the nearest with @p

/give @p command_block

That gives the nearest player a command block. Pretty handy.

If you place a command_block and put a button on it you execute the command with the press of the button.

I have made a command_button giver:

And the command:
*Note Previous Output user name removed.

So this is moderately interesting. You could use a dispenser for this but you would have to keep filling it up. This is a close enough to infinite item spawner.

You can also fill an area with an item. If you fill it with air you can clear a flat space to build a base. This is useful if you want a flat area to build on, but like the surrounding terrain, versus the super flat world.

Fill works thusly:


Why did I put X Y Z twice? It is a range. This range can be a single block if the numbers are the same or a column, or row, or a cube.

To build my castle I cleared a bit of terrain. To find the X Y Z press "F3" on your keyboard. It shows the position of you in XYZ, and the block in Block.

To hide the debug window press "F3" again. Through a bit of trial and error you will soon be an expert in three dimensional coordinates.

This page has a pretty comprehensive list of items:

An important item to remember is "air" that lets you clear a space. I cleared a big cube to start. Then I added walls. The only bit that wasn't added was the crenellations.

Using this fill command you can make gates open and close as well as drawbridges.

You can connect the blocks together for multiple effects using redstone wire. If you want a delay use a redstone repeater. 

Here is my close gate and remove the draw bridge.

You can even make a convertible castle:

Okay that was fun but what about making some monsters?


Wednesday, November 18, 2015

Using an ultrasonic sensor with a Rasberry Pi

I was helping a friend build a robot the other day and he was having difficulty with the ultra sonic sensor. I offered to test it on my Pi which a "B" model. I followed this guide:
and hooked it up using the single 1k resistor. I used a total of 5 DuPont connector wires and put the resistor between two.

I had to alter the timeout of the code to a full 1 second to get valid results. Also I had to adjust the GPIO pins used to the ones that I actually used to hook up.

It worked out nicely:

Monday, September 28, 2015

Random Tables Update IV

I was able to connect the Azure site to Google Domains and left it running for a week or two and it worked fine. I have since shut it down the Azure application and removed the Storage files from the cloud. The repos are available on GitHub per my previous post. Development has stopped for the common library and the Web Portal until bugs are reported. I may update the data packs at a later date, but have begun to work on other projects until demand increases.

Wednesday, September 9, 2015

Random Tables Update III

I have split the repo into three parts:

RandomTablesCommon - portable library imported as a submodule into the other repos.

RandomTablesUniversal - Windows 10 Universal app. It imports RandomTablesCommon as a submodule.

RandomTables - Web Application. It imports RandomTablesCommon as a submodule.

Since I split the modules I went ahead and got a domain name. I'll announce it once I have the site up. I am working on making the Web App work on the Azure platform. This means I had to add yet another string provider. I haven't committed my changes which add Azure features. I am still developing that piece.

Azure has blob storage, and many other cool features. Here is an article I've been reading about the topic:

Here is a NuGet package:

I had a chat with some friends of mine Monday and I might have some content contributors after I get the Web port on the web. After I get things stabilized I might shift focus to community building. Adding creative common content will make this product really useful.

Now time for a small bit about BOM.

Byte Order Mark (BOM) is optionally included on UTF-8 files.

This goes unnoticed until your JSON parser stops working. With my latest development for Random Tables I started yet another implementation of a string provider. The Azure Blob string provider uses a memory stream to read the file.

The Windows 10, and System.IO.readAllText seem to chomp the BOM and it worked flawlessly. Reading from the memory stream it is a bit more manual. BOM's are easy to forget until they "Byte" you.

Friday, September 4, 2015

Carl Burks' Random Tables Progress

I've made a bit more progress on my application.

I am working on adding a feature to support multiple data directories in the web version. This will keep things organized a little better and will make it easier to drop in content packs. I also registered a domain for this application and have researched hosting. After I finish adding the feature I plan to fork the code base and create a repo for each major part:

Portable Library
Windows 10 Port
Web Port

Further I will add a repo for the Creative Commons Share-Alike Attribution Non-commercial data pack.

Next feature will be to add logic for custom attribution display messages for the Web Port and corresponding parsing instructions to the Portable Library.

After these are developed I will hopefully setup the web facing application.

I will then split my time for this project between adding features, adding tables to the CC repo, adding content to the publisher packs which have given permission.

As a side note, Bing seems to hate searching for my name, "Carl Burks", doesn't show any links and shows a bunch of spammy unrelated content. I'm trying an experiment by adding my name to post title to see if that improves things.

Tuesday, September 1, 2015

Random Table Portable Library, Windows 10 Application, and Web Port in C#

Yesterday, I checked in a project I've spent a few weeks playing with:
This is a utility for rolling random tables with support for connecting dependent tables. If you don't see the purpose you might not have played a pen and paper role playing game. Let's say you were running a space type game and you wanted to see what space craft were near by you might have a table that looks like this:

Tables - Space Craft Encounters (1d6)
1-2   No Encounter
3       Shuttlecraft
4       Some kind of cargo freighter
5       Assault Craft
6       Roll on Unusual Space Craft Encounters

You would roll a standard six sided die and get a result. This is fairly straight forward roll a one or two and nothing happens. Roll a three and get a shuttlecraft. Roll a four and get a cargo freighter. Roll a five get an assault craft. Roll a six, you would need to look at another table and roll on that. Depending on your game system this can be a somewhat tedious process. It is also difficult to organize multiple publishers of books tables and connect them.

My software solves many of these problems. Currently only sample JSON files are included, but I am working on creating useful game system independent data-packs for my utility. I have also contacted several publishers and requested permission to create data packs.

I've contacted AEG, Steve Jackson Games, Fantasy Flights, Troll Lords and Green Ronin. So far I've heard back from AEG and Steve Jackson Games. Both companies were polite and helpful.

AEG indicated if I was not making any money then they were fine with creation.

Steve Jackson Games online policy indicates that they will only allow tables already published.

I plan on adding tables from both provided I have time. I will need to thoroughly research publicly available tables for SJG and that will take some time.

How can I get this program you might be asking yourself. Currently I have a common library that is used by the Windows 10 Application and the Web application. I've currently got some test coverage. Until bugs are reported I plan on spending time adding content in the form of JSON files. I have a few minor features I'm planning on adding, but the core application I believe covers most cases. The application is written in C#. Given time and interest I might make a port to another language. After some additional testing I might look for hosting and deploy the web app.

Sunday, June 14, 2015

Octodad: Dadilest Catch

I bought this game on Steam as an early father's day present to myself. Steam was running their summer sale and I had looked at the title of this game, but I hadn't watched the trailer once I did I knew I had to have it. It is an amazingly unique hilariously game which is also family friendly. I have added this to the list of games I've beaten. It was totally worth the price.

Saturday, June 6, 2015

New Phone

My BLU Android phone recently developed a screen crack, which set a new personal record for phone ownership length. I had only had the phone for two months before the screen cracked. Previously I had an ZTE which developed a problem with the touch screen on the exact same spot at this phone developed crack so I think it might be jeans when I sit down. Needless to say, I'm probably not keeping my new phone in my pocket when I sit down. Since I am not going to buy another Apple product any time soon (see proprietary USB cable rant) I looked for Android phones. If money was no object I'd probably have gotten an S6 or perhaps a G4 by LG, the G5 release date is too far in the future and I was getting glass slivers in my hand using my cracked BLU. Not being one to splurge on phones I selected a two generations back S4.

I'm glad it has an IR blaster. This should be standard until all TVs implement Bluetooth.

Apple Proprietary USB cable rant

When I had an Apple computer the USB cable which came with the keyboard had a little notch on it which only worked with Apple Keyboards. It made me and others angry:

Thursday, May 7, 2015

Controlling VLC via Python and some AHK

I've got an Arduino with an LCD. Previously I developed a Python application which connected via serial and showed songs playing and let me change the track and volume through the magic of CMUS. CMUS is a wonderful music program, for *NIX systems. If you are trapped in a Windows environment you might use VLC. With CMUS you can connect via "cmus-remote" and query the tracks accessing the necessary information. With VLC no such feature is available. I was able to get my display information by looking at the window titles using a modification of the post on StackOverflow:

I've put it in a function and modified it slightly from the post.

def getWindowsTitles():
    EnumWindows = ctypes.windll.user32.EnumWindows
    EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
    GetWindowText = ctypes.windll.user32.GetWindowTextW
    GetWindowTextLength = ctypes.windll.user32.GetWindowTextLengthW
    IsWindowVisible = ctypes.windll.user32.IsWindowVisible
    titles = []
    def foreach_window(hwnd, lParam):
        if IsWindowVisible(hwnd):
            length = GetWindowTextLength(hwnd)
            buff = ctypes.create_unicode_buffer(length + 1)
            GetWindowText(hwnd, buff, length + 1)
        return True
    EnumWindows(EnumWindowsProc(foreach_window), 0)
    return titles

This works fine for reading the Artist and Song if one is playing, but that doesn't let us change the track.

I tried several things to send input to VLC, but to no avail. Several input libraries wouldn't work, and I finally tried AutoHotKey. The Python Package which hooks in didn't seem to work with the current DLL, so I just made exes from the AHK scripts:

Example Next Track:

SetTitleMatchMode, RegEx
IfWinExist .*VLC media player

Sleep 1000
Send {Alt down}{l}
Sleep 100
Send {x}
Send {Alt up}

There are probably better ways of getting it work, but for now I'm content with this implementation.

Tuesday, May 5, 2015

Windows Host to Linux Guest Named Pipe on VirtualBox

It is fairly simple just open settings:

Then you can connect via PUTTY on Windows and cat to or from /dev/ttyS0 and see the results.

Friday, May 1, 2015

Arduino LCD Shield

Replacement Resistors

A while back my LCD Shield had an incident in my backpack and the blue contrast adjustment snapped off. I couldn't find it, it must have walked off. I was set to order a new one.  Ordered a new one from China, but I found the old broken screen and didn't have a replacement part, but I did have resistors. I found the perfect  a usable setting:
Fixed Contrast Replacement

I guess I'll have a spare once my other one gets in, but I was happy I made this one work again.