Saturday, March 12, 2016

Calendar In Powershell

I've added a new Repo on GitHub for making a calendar in PowerShell, much like the Linux command cal. I have omitted multi-language support and have opted to only implement the core functionality of displaying a calendar rather than also including the date of Easter.


https://github.com/crb02005/PowerShellFunctions/blob/master/calendar.ps1

Tuesday, March 8, 2016

Visual Studio Debugging

If you are a VB.NET developer for any length of time you probably will need to debug code. One of the tools I use is the Immediate Window. CTRL-ALT-I will open it. If you use the ? shortcut to print the value of a variable with multiple lines you probably get something like "Blah"+vbnewline+"someotherfield", but with the string formatter ",nq" you can get the following:

Blah
someotherfield

I hope this helps.

Monday, February 8, 2016

EVE Online

I recently started playing a popular space game. EVE Online.

If you've never heard of the game, I would suggest going to YouTube and look at a few videos.

Here is a trailer:


I had joined a corp and they wanted to get a list of all their player's assets. I created a PowerShell Script specifically for that purpose.

This one requires setting up your API key:

Skill Script:
https://gist.github.com/anonymous/0bc8bd3da21cd217fb70

This one shouldn't need any special permissions:

Sector Script:
https://gist.github.com/anonymous/998410deed0c0efb7e51
The script above lists the solar systems along with some interest data. Kills, Warps, and Corporation Ownership.
Note:

To view all just use:
$solarSystems.Values

Since it is PowerShell you can harness the Pipeline to find quite spaces and put them in a CSV file:


 $solarSystems.Values | %{if($_.ShipJumps -lt 3 -and $_.ShipKills -eq 0){$_}} | export-csv "your file path.csv"


If you decide you want to try it sign up for a free trial below:


Click on my Buddy link and sign up for a free trial:
https://secure.eveonline.com/trial/?invc=967f06ed-54cd-4294-8db7-500eed4154b5&action=buddy

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.

/give YOUR_PLAYER_NAME_HERE command_block COUNT_DEFAULTS_TO_ONE

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:

/fill X Y Z X Y Z ITEM_TO_FILL

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:

http://www.minecraftinfo.com/IDList.htm

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?

/summon CREATURE_NAME X Y Z







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:

http://www.bytecreation.com/blog/2013/10/13/raspberry-pi-ultrasonic-sensor-hc-sr04
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.

https://github.com/crb02005/RandomTablesCommon


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

https://github.com/crb02005/RandomTablesUniversal


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

https://github.com/crb02005/RandomTables


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.

http://www.w3.org/International/questions/qa-byte-order-mark.en.php