Welcome to AddressOf.com Sign in | Join | Help

BASIC SIG (March 1st, 2016) - ESP8266: IoT using BASIC!

What do you get with you take a microcontroller that costs between $2-$10 and set it up so that you can program it via the web with BASIC?  Let's find out!

As a requirement to meet at this location, I have to share: This event is not sponsored or endorsed by the by the North Richland Hills Library, The Maker Spot or the City of North Richland Hills.

BASIC SIG (February 2nd, 2016) - The basics of BASIC Pt.4

We will continue covering the basics of BASIC; in other words, introduction to programming using Microsoft Visual BASIC 14.

Additionally, I'm putting out an official call to arms for everyone to spread the word to every single person interested in developing in BASIC; whether experienced or new, hobbiest or professional and everywhere in between.  The focus, direction and attention for the future of Microsoft Visual BASIC is at another proverbial crossroads; meaning that this is *your* opportunity to have a voice.  More details to come as they develop.

As usual, please RSVP so I know how much pizza to order.

As a requirement to meet at this location, I have to share: This event is not sponsored or endorsed by the by the North Richland Hills Library, The Maker Spot or the City of North Richland Hills.

BASIC SIG (January 5th, 2016) - The basics of BASIC Pt.3

We will continue covering the basics of BASIC; in other words, introduction to programming using Microsoft Visual BASIC 14.

Additionally, I'm putting out an official call to arms for everyone to spread the word to every single person interested in developing in BASIC; whether experienced or new, hobbiest or professional and everywhere in between.  The focus, direction and attention for the future of Microsoft Visual BASIC is at another proverbial crossroads; meaning that this is *your* opportunity to have a voice.  More details to come as they develop.

As usual, please RSVP so I know how much pizza to order.

As a requirement to meet at this location, I have to share: This event is not sponsored or endorsed by the by the North Richland Hills Library, The Maker Spot or the City of North Richland Hills.

BASIC SIG (December 1st, 2015) - The basics of BASIC Pt.2

We will continue covering the basics of BASIC; in other words, introduction to programming.

As usual, please RSVP so I know how much pizza to order.

As a requirement to meet at this location, I have to share: This event is not sponsored or endorsed by the by the North Richland Hills Library, The Maker Spot or the City of North Richland Hills

BASIC SIG (November 3rd, 2015) - The basics of BASIC and BCX

(aka Beginning programming and C/C++ in BASIC)

We will be covering the basics of BASIC; in other words, introduction to programming.  Additionally, for those who are more familiar with the basics, we will be discussing BCX; a version of BASIC that is essentially C/C++ with a BASIC spin.

As usual, please RSVP so I know how much pizza to order.

As a requirement to meet at this location, I have to share: This event is not sponsored or endorsed by the by the North Richland Hills Library, The Maker Spot or the City of North Richland Hills.

BASIC SIG (October 6th, 2015) - ESP8266, C++ and Tix Clocks

The ESP8266 offers an extremely affordable and small solution for IoT projects and comes in several form factors.  This month we will be going through all the information that we are currently aware of, how to setup/configure a development environment and demonstrating an actual real-world project utilizing the ESP8266.

The project is what is called a TIX clock.  It's easier to explain in person or you can look it up in your favorite search engine. ;-)  With that said, this particular version of the TIX clock has been designed to be IoT (internet enabled/required) and utilzing your workspace/homespace wifi to keep the clock spot on accurate.  To be clear, it doesn't actually keep time itself.  It is also configurable using a web browser over wifi.  So the only wired connection is the power plug... we have two different ones to demonstrate.

So the agenda will go something like this:

1. Introduction to the ESP8266.2. Different form factors of the ESP8266.3. Setting up a development environment to utilizing the ESP8266.5. Discuss what a Tix clock is.5. Demonstrate the Tix clock.6. Discuss the additional electronic components that make the project work.7. Show some code.
8
. Discuss some C++'isms that are relevant to the Tix clock project / ESP8266.
9. General Q & A.

Also, I'm setting aside one ESP8266 as a gift for one lucky person to-be-determined at the meeting. :-D

As usual, please RSVP so I know how much pizza to order.

As a requirement to meet at this location, I have to share: This event is not sponsored or endorsed by the by the North Richland Hills Library, The Maker Spot or the City of North Richland Hills.

BASIC SIG (September 1st, 2015) - Raspberry Pi 2 with Windows 10

I’ve been working towards getting a new website, email, list server and separate Eventbrite account; however, time has run out and I absolutely must get this invite sent out… so here goes.

This month we will be digging into building an application, from start to finish, on the Raspberry Pi 2 running Windows 10. Once the basic version of the application has been completed, we will spend a little time experimenting with “what’s next”.

I also would like to have everyone that is working (or thinking of working on) projects to share what they are doing. I’ll get this started by sharing a few projects that I have in the works… one of them geared directly to hobbyist’s whom have little to no programming experience that would like to tinker with IoT. ;-)

Please RSVP so I know how much pizza to order.

As a requirement to meet at this location, I have to share: This event is not sponsored or endorsed by the by the North Richland Hills Library, The Maker Spot or the City of North Richland Hills.

BASIC SIG (August 4th, 2015)... has a new (real) home!

Announcing a real home for the BASIC SIG meetings; this means that the meetings will actually happen every month starting August 4th (every first Tuesday)!!!!

What makes this announcement even more AWESOME is where it actually is going to be...

Thanks to a grant from the U.S. Institute of Museum and Library Services and the Texas State Library and Archives Commission, the North Richland Hills Public Library has created a very special place for people like you and I... the hobbyist!  As part of this project, they've also set aside a portion of this space for meetings just like the BASIC SIG and, with a huge smile, I can say that the BASIC SIG is the first regularly scheduled meeting that will be taking place in this new space!!!!  To read more about this awesome new space, please visit http://themakerspot.org.

Yes, this means that the meetings will no longer be taking place at my home. I sigh, however, my wife rejoices. ;-) This does mean that more people can attend and that, as a whole, the thing is more real.

The August 4th, 2015 meeting will be:

Programming devices that cost less than $50 

In this session we will cover various devices that cost less than $50 ranging from Arduino, Netduino, Galileo, Rasberry Pi 2 and Windows Phone...

Pizza will be provided, please RSVP so we know how much to order.

Yes, the meetings up to this point have been hit and miss, so I want to share part of this has because we needed a location and that location has been a long time coming since it was "literally being built".  Also, as a requirement to meet at this location, I also have to state: This event is not sponsored or endorsed by the by the North Richland Hills Library, The Maker Spot or the City of North Richland Hills.

Checkers Solitaire is now OSS

The source code for Checkers Solitaire is now available on http://GitHub.com/DualBrain/CheckersSolitaire; go check it out, fork it, play with it, contribute, share, give me a pull request!

Lack of ideas as to what you can do to contribute... how about helping get it to work on Mono or separating the UI from the rest of the code in order to port to XAML and possibly WinRT.

Posted by CorySmith | 0 Comments
Filed under: , , ,

I'm Going Open Source!

Hmmm... not sure I really ever thought that I'd ever be the person saying those words, however, the day has finally come... hell has frozen over... open source is now in my vocabulary and I am embracing it wholeheartedly.  I'm definitely still a newb in the OSS space, very unfamiliar with the vernacular, tools are foreign, approach is "odd"; but I'm sure I'll get the hang of it over time.  In order to get started, I've resurrected a project that I made available here almost a decade ago (really, it's been that long?!?!?!) and published it to GitHub.

I have several other projects, some older, some newer that might be making their way to GitHub; most likely using the MIT license.  These include:

I'm also still weighing the pros/cons of making my tribute to GW-BASIC available as OSS.

Why the hesitation?  Well, you know, although it's not something new, it's new to me.  I'm going to start with things that I've already made available (with possible updates) since, ultimately, I've already "exposed my soul" with those projects anyway.  As for other projects, I'm definitely experiencing feelings of fear, uncertainty and doubt regarding how things will be received and responded to; however, it's something that I think it's time to do.  There are also huge upsides to going OSS, especially for "code sample" type of projects.  Key of those advantages are that people can collaborate and contribute, something that really isn't all that straight forward using any other approach.  Additionally, the potential for reach is pretty astounding (which is one of those things that also adds FUD).  So we'll see where this goes from here.

I do have to admit that this move on my part is definitely inspired in no small part to Microsoft's recent move with .NET in general toward OSS... 

BASIC SIG (September 2nd, 2014)

Arduino *AND* Raspberri Pi (Oh My!)

After discussing with several people, I came to the realization that since the format of this group is different than the typical presentation style meeting, we can easily handle BOTH!  Remember, this is a BASIC-themed hackerspace. It's not really about "presentations", more about being hands on.  Instead of "watching", it's about doing.  The only "rule" (if you want to call it that), is "if it can be done with BASIC, it should be done basic BASIC". ;-)

On one side of the room, we will be working on getting VB.NET through Mono working on a Raspberry Pi.

On the other side of the room, we will be getting an introduction to BCX to build for the Arduino along with everything that needs to be done to get an environment setup to do so.  We will also be learning more about what the Arduino is, playing with some simple electronics projects (along with covering some of the basics of electronics). Even if you don't have an Arduino, we will be looking at ways that you can still experiment (and learn) even without actual hardware.  If you do have the hardware, be sure to bring it along.  If you don't, just bring a laptop and you can still be involved.

There are also a few BASIC SIG group related things to discuss, so we'll knock those out at the start of the meeting so we can get to the fun.

I'll be ordering pizza once everyone has arrived (or I know you are definitely coming), so please RSVP (location, date, time, etc. included in the RSVP link).

See you there.

Posted by CorySmith | 0 Comments
Filed under: , , , , ,

Announcing the BASIC SIG.

If you are in the Dallas/Fort Worth area...

BASIC SIG

This is not your typical "user group"; instead think of it as more of a BASIC themed "hackerspace".  This is a hands-on oriented and user-to-user sharing/collaboration event.

To RSVP, https://www.eventbrite.com/e/basic-sig-july-23rd-2014-tickets-12353095441 

Posted by CorySmith | 0 Comments
Filed under: ,

Transition Physical Machine To Virtual

I'm writing more so as a reminder to myself...

What I am trying to do is transition an older machine, one that is "semi-retired" but still contains some stuff that I need every once and a while for work purposes and I'd rather not muck up my new installation with these tools.

So enter virtualization technology... wouldn't it be nice to somehow convert the physical machine to a virtual machine that can be stored and utilized from any newer machine that I choose... when and if the need should arise?

The tools that I've used thus far are:

I used the Disk2vhd tool to convert the physical disk to a VHDX formatted virtual disk; the nice thing about this tool is it is designed to be run on an active system utilizing "Windows' Volume Snapshot" capabilities.  What this really means is that it's smart enough to be able to image the drive even though files are in-use.

I then downloaded and installed VirtualBox on the target machine that I'd like to get this up and running on.  I then created a new virtual machine and hit my first problem... thanks to Visual Studio 2012+... Hyper-V is enabled by default in order to facilitate development and testing on Windows Phone devices.  Because of this, VirtualBox does not allow me to create a virtual machine that is 64-bit; which, of course, the original machine was.  The first step was to disable Hyper-V.  To do so, you could either go to Enable/Disable Windows Features and do it using a mouse... our, use the following command line (requires Administrator elevation)...

bcdedit /set hypervisorlaunchtype off

(Note: To enable later, use "bcdedit /set hypervisorlaunchtype auto".)

Once you have successfully executed the above command line, a reboot is required.  Now that this has been completed... of course, as you can probably guess, yet another "speed bump"...

In order for 64-bit virtualization technology to be leveraged, the BIOS (most likely culprit) needs to be entered and Intel Virtualization needs to be enabled.  On the target machine, a newer model Windows 8 Sony VAIO® Fit 15A / Flip PC, I had to press the "Assist" button pressing the "Power" button from a powered off state.  Now that this has been completed, YEAH!, I can finally create a 64-bit Windows 7 virtual machine in VirtualBox.

OK, I create a new machine, set the memory to what the original was (4GB) and leave the HD until later... as it turns out, I was not yet prepared to "use an existing disk".

Apparently the VHDX formatted virtual disk is not compatible with VirtualBox; here's where Windows PowerShell and Convert-VHD come into play.  The following command line can be executed to easily (albeit slowly depending on the size of the disk) convert between VHDX to VHD (or the other way around if you have the need)...

Convert-VHD nameofdisk.vhdx nameofdisk.vhd -Passthru

(and wait for this to complete)

Once done, I can then modify the settings of the virtual machine and connect the disk image with success.  In my case, the original machine was SATA, so I chose the SATA path instead of IDE.

I then started the virtual machine... after a bit of chugging along and several Windows updates... I now have a virtual machine that appears to match the original physical machine.

Posted by CorySmith | 0 Comments

Async/Await in a Console Application

Here's the situation, you want to be able to build a console application and still take advantage of the asynchronous programming model available in the latest versions of VB (2012/2013). 

 

No matter the reason behind why you may want to do this, the answer I give will still be the same; however, I'll provide my real-world reasoning behind my desire to have Async/Await from a Console Application... TESTING.  Many times it is a lot easier to do testing of API's from a Console Application; however, if your API's are Async/Await... thus the problem. 

 

To do so, you may be tempted to start by modifying the Sub Main() based on the tons of examples you've seen for several other types of projects. 

 

  Async Sub Main()   

    Dim result = Await WebUtilities.FetchUrlAsync("http://addressof.com")

    Console.WriteLine(result)

    Console.ReadLine()

  End Function

 

This, however, will not work.  Visual Studio will quickly alert you to this situation and you are left scratching your head.  You then will proceed (most likely) to search the web for a possible solution.  There are several out there that state that you need to setup some sort of synchronization context or some such and that you'll need to either use one that someone else has made or build one yourself.  There sure seems like there's got to be a simpler solution... 

 

  Sub Main()   

    Task.Run(AddressOf MainAsync).Wait()

  End Sub

 

  Async Function MainAsync() As Task

    Dim result = Await WebUtilities.FetchUrlAsync("http://addressof.com")

    Console.WriteLine(result)

    Console.ReadLine()

  End Function

 

Hmmm... that seems to do the trick.

 

The Task.Run method has several overloads, one of which takes the address of an Async/Await style method.  This actually kicks off the process of running that method asynchronously; however, if left to just calling this Run() method, the application would then exit immediately as nothing is keeping the Main method from completing.  To work around this problem, the Wait() method is executed upon the return of the Run() method.

 

To keep things straight, I named the target method MainAsync().  This is where I will place all of my code that would have normally been in the original Main() method.  From this point, anything I want to test; whether it be Async/Await or not, it "just works".

 

A couple of side notes:

 

It does have to be a function, but since I'm not actually needing to return a "result", we will be returning Task.  This is necessary for the Async/Await functionality to work.  The rule is either to return Task(Of [type]) or just Task.  Whenever you add the Async keyword to an existing Sub in other project types, this is only allowed on events and only in projects that have an understanding of this concept.  There is a ton of behind the scenes compiler magic that occurs and the only place where this should be done is where it's been "blessed" by the platform/compiler teams.  For all code that you write, stick to Function with either a result of Task or Task(Of [type]); keep it simple.

 

The return of the Run method occurs as soon as the first Await is encountered in the target method; so in the above example, it happens immediately.  The Wait() method will pause the execution of the Main() method until the total completion of the target method. 

Posted by CorySmith | 0 Comments
Filed under: , ,

Further Adventures in WinRT - Part 1

Working with WinRT, well, I'm just going to say it... sucks!  I'm past the "who moved my cheese" phase; so that's not why I'm making that statement.  It sucks because it is not completely thought out, requires that you have to jump through hoops that were solved by many other API stacks many years ago, and contains way too many conflicting stories, requires crossing too many API layers... in other words, it's either incomplete or not very well thought out.  With that said, there's not much I can do about it; if I want to target the Windows Store, I have no choice but to roll up my sleeves and attempt to trudge through the mess to accomplish the task at hand.

These adventures will be done in a scenario(s) / solution format.  So let's get started.

Background 

It doesn't matter if we have a desktop, tablet, Intel machine, ARM machine or even a Windows Phone 8 device; storage space is limited.  As an application author, I want to be a good citizen.  It's bad form to write to the storage device(s) blindly without regard to the amount of storage space that is left.  Windows, as a whole, (to the best of my knowledge) does not work very well when it runs out of space (temp files anyone).  A Windows server is nearly impossible to log into remotely if the disk free space has reached 0.  This should never happen and the authors of software should play nice.

Scenario

So we want to write something to the storage device.  We want to be a good citizen; so let's see if we actually have enough storage space without risk of bringing the system to it's knees.  How do we do this?

Adventure

As a .NET developer using a framework that has been around for over a decade, the following "just works".

Dim drive = New System.IO.DriveInfo(driveName)
Dim available = drive.TotalFreeSpace

Sorry... not available in WinRT.  After doing a bit of research, I was unable to determine any way of any kind to accomplish this task using the WinRT API.

WinRT is also "sandboxed"; meaning that it does a tremendous (or hideous depending on your view) job of isolating what can and cannot be leveraged on your device without your permission.  Even given permission, there is only so much that a WinRT application can do; which means that there is a ton of things that it can't.

So if it isn't in the WinRT API, your screwed... or are you?

Solution

As it turns out there appears to be a few "blessed" Windows API's that are allowed to be P/Invoked from a WinRT .NET application.  One of these is the Kernel32 GetDiskFreeSpaceEx function.  To utilize it, you'll need to create a "reference" to it by adding the following to a class.

Declare Auto Function GetDiskFreeSpaceEx Lib "kernel32.dll" (
  ByVal lpDirectoryName As String,
  ByRef lpFreeBytesAvailable As ULong,
  ByRef lpTotalNumberOfBytes As ULong,
  ByRef lpTotalNumberOfFreeBytes As ULong) As Boolean

So one way to get the free space is to use a reference to your application folder...

Dim available, total, totalFree As ULong
Dim appFolder = Windows.Storage.ApplicationData.Current.LocalFolder
If GetDiskFreeSpaceEx(appFolder.Path, available, total, totalFree) Then
  Return available
Else
  Dim err = Marshal.GetLastWin32Error
  If err = 5 Then
    ' Access Denied
  Else
    Stop
  End If
End If

Seems relatively straight forward and painless (once you figure out the Kernel32 declaration, understand how p/invoke, marshaling and the different method that "error handling" works in the Windows API --- or you just blindly copy/paste what someone else does and hope for the best).  Also, even though it's pretty obvious, you can see that it takes a few more lines of code to accomplish the same task compared to the .NET BCL (Base Class Libraries); appears to be one of those "one step forward, two steps back" kind of days.

Here's the problem, what if your documents folder isn't on the same storage device as your application? Even if your application has been given permission to read/write to the documents location, you can not pass the path to the documents location to get a result.. instead, you get an Access Denied message.

So I experimented further and found that passing "D:\" also fails.

Hmmmm...

I then attempted, as last ditch effort, "D:"... it works. WTF?!?!?! 

Is this documented anywhere? Not that I could find.  What a wonderful (WinRT) time we live in.  At least I can get done what I need to get done, moving on.

See you in the next adventure.

Posted by CorySmith | 0 Comments
Filed under: , , ,