Thursday, June 15, 2023

Doing something

 Kind of realized that some times, doing something can distract you from getting something done.

I had decided that I needed an interface then found the INumber generic interface. However, I still hadn't done the work to decide what I needed or how I was going to make it work.

So, lets do that now.

What is a number. It is a value, a quantity. Mathematicians have determined that these values have certain properties, main among them, that they can be discussed in a meaningful way separate from the object that they are describing the quantity of. Mathematically 19 oranges, is the same as 19 inches, is the same as 19 days, which is the same as 2013 math nerds (2013 is 19 expressed in base 3, will get to bases later) (and you can find 19 math nerds in the same place, though it usually a math class, or a comic con).

So, what does a number data type need. INumber says 50 some functions, and it is right to some degree. However, those functions tell us attributes of the number or defines ways to interact with other numbers, but the most important thing is the value. It is a data type and we need to have the data. What is the data with a number, well the value. So, how do you store the value? Well, that was some of what I wanted to explore with this project. With the OutrageousInt I started with, the value is an int. And yes, I'm wrapping an int in an unnecessary class, but this whole thing is in and of itself, unnecessary. I am doing it to try and learn something, and experiment with algorithms and maybe help someone else.

Now, does the value have any properties, or need any properties to ease calculation or interaction with other classes implementing INumber? Well, that is the question, but perhaps I need to start with a naïve implementation. Currently, I believe that my int version is finished or close to it, so maybe I need to create a unit testing project to be used on the OutrageousNumbers, and perhaps some sort of simple app to play with the numbers. 

Monday, June 12, 2023

Implementing INumber

 I thought it might be useful for some to describe my tool set. I am currently using Visual Studio Community 2022, I typically keep it up to date. I am using .NET 7.0 and C# 11.0. I use Git for version control. I'm using GitHub for storage of the repository and management of the project. I am also currently experimenting with GitHub Copilot for code suggestions and assistance.

My intention is to create a branch for each blog post or perhaps group of blog posts, depending on how tasks, or ideas get broken up. I will then try to check in every major step of the way. The banch for today is, ImplementINumber.

First I will add a Value. because a number has a value. This is not part of the interface, but may be used by the interface. I am using a property because it is a practice that I am used to and is common in the offices that I have worked in. Specifically using what is know as an auto property. Technically any data stored in a class is a field, a property is a set of methods that set the data and get the data. Using methods for access allows for validation and alteration as needed either on setting or getting the data. A standard property is written - 

private int _value;
private int Value
{
  get { return _value; }
  set { _value = value; }
}

I realize that I am explaining things in a haphazard manor. If you feel that I'm being too detailed feel free to skip any description, paragraph, post or the whole blog. If you feel that there is something that you need explained further, please feel free to ask, if I cannot answer I may be able to help you find the answer.

Returning to properties, the previous code snippet is a fairly standard property/field code snippet. If only there were a simpler way to write it that functionality in .NET would be able to replace with the structure above in the background. Well, there is -

private int Value { get; set; }

The backing field is assumed, as is the code for the get and the set. This format does allow for the declaration of the get or set, if it is needed. This is what is known as an auto property.

At this point Quick Actions can be used to create all the interface functions. It seems that there were some limitations on the Quick Actions. But there are other Quick Actions to add more for the interface. I may want to make value protected and not private. I may even end up making my own interface to add properties. But I will finish making the int number first.

I feel like I've lost the plot. I need to reset.

Saturday, June 10, 2023

Interface, IReallyBigNumber Or Something

In the last entry I talked about designing an interface for a number. So, what is an interface? I always struggle with how deep to go in answering some questions. I currently work in C#. C# is an object-oriented language, meaning that data is structured into classes. A class is a collection of data about a specific thing, and occasionally functions related to that class or contained data. Now one of the concept of object-oriented programming (oop) is polymorphism. Polymorphism is the idea that objects of different classes can be sent to a function of a specific class. One of the ways of supporting this is called an interface. It is like a class, but only has function declarations. Any function call that requires that interface will accept an object of a class that implements that interface.

So, what does a number need for it's implementation? One camp of oop says that all data fields should only be accessible/alterable through functions and methods. This ensures that all operations and changes to the data follow the rules of the class, this is especially important when creating several classes that are supposed to react is similar manners and be processable from the same functions. The argument being that none of the external services need to know what the internal data is or how it is processed.

So, bare minimum for a number is equals, add, subtract, multiply, divide, and compare (greater than, less than). There may be others that I may want / need to keep the coding internally. For the algorithms I am thinking I want to attempt, the basic parts may be enough to get it all working.

I had created a repository to hold the code I am trying, but decided that I had not started it right, so I dumped it and started a new repository. I will try and keep commit labeled in such a way to indicate what is being done and which blog entries they belong to. The current repository is OutrageousNumbers. I found a website that will check some of the most popular repositories for open source code for a name, after trying a couple I got frustrated and tried OutrageousNumbers.

While I was doing other stuff I decided to see if the "primitive" types had an interface, despite the fact that this whole project is about doing work that has already been done, I didn't feel like the interface should be repeated if an acceptable one was in use in the main parts of .Net. I found out that they don't seem to, but that in .Net 7 some Generic Math libraries were added including an INumber<Tself> interface. So, I do not need to create the interface and it already is more detailed than I was expecting to start at.

I think I will start by creating an Outrageous version of the int, not a large version, just to explore the interface and work with the many parts of that. I will check in the initial creation of the project and the class, and we will do more from there in the next installment.

Tuesday, June 6, 2023

Design Document

 When I can I try and do some programming for myself. It is not as often as I would like, as I have a family and can never keep a computer in good shape, but I do try it from time to time.

Sometimes I try and put forward a challenge. One I did previously came out of a project for work (a previous job). That team was big on testing, so I created a tool that could take two unspecified inputs and determine if they are equal. I created it in C# and .Net, and use that languages reflection capability to determine the parts of an object and compare them to the same part of the other if it exists. It is called GenericDeepEquality, the code is on GitHub and I have published a NuGet package, located here.

The current challenge I am undertaking is creating a library for Math with Big Numbers. Also, maybe, designing it to work for any base number system. This isn't to make the next great Math library, it's just to figure out how to do it and play with algorithms for mathematical functions.

So, now it time to work through some ideas to determine where I am going to start.

The main issue of a big number is the big number and how to handle it. In C# an integer is represented by an int. An int has the ability to represent a number between -2,147,483,648 to 2,147,483,647, That's a lot of number space, but it's not enough for the federal budget, for example, and there are applications that require much larger numbers, like cryptography.

Additionally, there are technically three main parts of a number variable, assigning the number a value, storing that value and displaying that value. Some might ask about manipulating the value, but with math, the operations usually produce new values, so that is different, also, that is a different part of the processes in general.

Terminology: As I am using it, not necessarily completely accurate to math.

  • digit - one "character" of a number. 19 has the digits of 1 and 9. Digit may seem to imply base 10, but I am using it in a more generic manner.
  • significant digit - a representation of the position of a digit in a number. Standard terminology has the "least significant digit" being the digit representing the zeroth power of the base in the number and the "most significant digit" being the digit representing the highest power of the base in the number. In 19, the most significant digit is 1 and the least significant digit is 9. 
  • base - The number of values available for a single digit. For example base 2 have 0 & 1, where as base 10 has 0, 1, 2, 3, 4, 5, 6, 7, 8 & 9.  A number can be written as the sum of a series of single digit numbers times a power of the base representing it's location in then number. 19 can be written as 1*101 + 9*100. 

Before we can do anything else we need to determine how we are going to store the value. Now, much like you can write a number larger than 9 by adding another digit to the left (10), we can create an array of ints, such that the following ints would represent the next significant "digit" in the number. So, an array of integer values (int being one possible type). Of course, now as I'm thinking about it, I should do them all.

So, what I'm thinking now is I need to create an interface, so that all of the different versions can be used in the same algorithms. Now I need to figure out what I need for a number interface.

I'm going to put this out there and come back to designing the interface.

Saturday, July 30, 2016

International Nodebots Day

Yesterday the local JavaScript user group had an International Nodebots Day event. I took my daughter. It was a lot of fun, I highly recommend doing that kind of thing with your kids.

My kid also gave me a conundrum this week. She had an idea for an app, that she was wanting me to make. I haven't programmed for Android, and I haven't programmed Java in a long time. So, I may be learning that too, or make a decision between that and this. So....

As for what I have done this week. Nothing, but I have gotten my tablet up and running again. So, I'm hopeful that it will continue to cooperate.

What I've Learned

What do you need to write programs? If it is a complied language you need a compiler. If it is an interpreted language you need an interpreter. Also, you need something to write the code in, like Notepad.

This is an advantage for Javascript as the interepreter is built in to most browsers and all of the major ones.

However, I would recomend and IDE if you are intending to code. An IDE, or Integrated Development Environment, tend to have certain functionality that is helpful for programming.

Of particular use is syntax highlighting and autocomplete. Syntax highlighting changes how the text is displayed. Keywords, variables, strings all show up in different colors, fonts, etc. This makes it easier to understand what is happening in the code. Autocomplete offers suggested words based on the meters typed so far, the words coming from the context of the code and keywords. This helps with spelling of variable names, for instance. In an interpreted language, such a misspelling would break the program and be difficult to find.

I'm not sure if this installment was as helpful as I would hope.

Sunday, July 24, 2016

Summer Break

So, I had started an update when the tablet I was working on decided to stop working. I decided to give it a couple days to run out of juice to see if it would reset. It did, then went back to a blank screen after I started the first app. So, boo.

The update I had started was about how little I had done. I need to make this a bigger priority, or decide it's not going to be a priority.

I still want to learn JavaScript, and I still think that this it's the way to keep me accountable, but is this the time to do it?

In fact I just showed to myself that it is trivial to move the script to it's own file, by copying the code to a separate file and removing it from the html file. I'm not completely happy with it because I have references to html objects in the code, it will be a rewrite to remove those.

What I have learned so far.

Some of this is stuff I have known, but it is stuff I have learned to this point.

There are two types of programming languages (plus machine language which is written in a form a computer can understand). Languages are either compiled or interpreted. Compiled languages are written in a human readable form and then compiled into a machine readable form one time, creating an executable that will be run when necessary. Interpreted languages are written in a human readable form and then interpreted at run time into machine readable form, and will be interpreted every time the code is run.

The advantage of compiled languages is the executable tends to be faster and smaller in memory. The disadvantage is that the program will have to be recompiled to target a different architecture (PC, Mac, mobile) which may also require some changes in the program as well.

The advantage of interpreted languages, also commonly called scripting languages, is that they can be run, often without change, on many platforms. The disadvantage, is the programs can be larger and slower and often are limited in their ability to access the hardware of the machine.

That was then. Now there are languages that are compiled and interpreted, like Java. Also some languages are transpiled, written in one language and the transpiled into another language, often JavaScript.

The advantage of a language that is compiled to a bytecode and then that bytecode is interpreted on the machine is speed closer to a compiled language and the ability to run on any machine. Disadvantages include a limit to access to the hardware.

Now, transpiling, is a completely different issue. Much like human languages, computer languages affect how you think and how you can express things. So if you need to do certain things, it might be easier to write it in a different language, then transpile it to the language needed. These are usually done with languages designed to transpile, for example CoffeeScript and TypeScript both transpile into JavaScript.

I did not think I would end up writing this much about languages alone, so I will try and put more of what I have learned in future updates. I am a little reluctant to make such a promise, though, for some reason (-cough- -cough- complex math -cough-).

Sunday, June 26, 2016

Update

Busy couple of weeks. End of school. Plus a little bit of loss of direction. Plus a lot of fear about the next steps.

I think some of it is a sense of accomplishment. I mean I accomplished a goal, that's all I need to do right?

So, things that have happened...

I tried out Cloud 9, which is a cloud based IDE. I think I like it. I even got some functionality out of it on a tablet. And it has GitHub connectivity built in. The git command are all done through a terminal, which means I have to learn those commands I bypassed using the GitHub desktop app.

Speaking of GitHub desktop app. It stopped working on my Windows 10 box. Getting nowhere troubleshooting that.

I have read some training stuff, but I don't know that I'm finding the right stuff yet. I have found a course that makes a to-do app. Maybe that will cover what I need.

I will try and get back on schedule. See you next week.

Sunday, June 5, 2016

Slow Week

I did not do much this week. I did add division to the operations done on my complex page. I also made the imaginary number (i) italics. It is how its supposed to be written.

I will probably focus on training materials this week.

Monday, May 30, 2016

JavaScript In My Learning Project

I have created a webpage with JavaScript on it!!!

Let me just say, I have learned a lot this week (read, so many mistakes, so many).

As I have stated previously, I have decided to use GitHub as a repository for my code. I am a big believer in versioning, and this also allows any who want to view what I have written. This means I have a profile page at WyerByter.

Then I found another advantage. GitHub has what are known as GitHub pages. The idea is that an individual, organization or project can have a webpage with information about themselves. So, I have set that up. My User page is http://wyerbyter.github.io/. With my learning website underneath at http://wyerbyter.github.io/my_first_website/. There you will find a link to my first page with JavaScript. Added. The page with the Javascript is doing basic math with complex numbers. I promise I will post something explaining complex numbers, they aren't as complex as you think. I will get to the fractal post as well, but I will do the complex numbers first as most fractals are done with complex numbers.

What did I learn? Well, a lot of git. I already knew that creating repositories was easy (that's so last week), but I found out that creating branches is just as easy. Committing code is also easy, just do yourself a favor and write commit comments that mean something (not something I learned this week, but a good rule of thumb). Pull requests are even easy to create, though not necessarily easy to complete. I realize that a lot of this may not make sense if you do not know anything about version control, so I have already posted a list of definitions

I also learned some interesting things about JavaScript. I put the code for this page within the html for the page, this means a loss of most of the intellisense that Visual Studio Code was giving me for .js files. Either that or I still have some to learn on setting up the environments for Visual Studio Code.

I learned that I can do Git commits directly from the Code application, which is convenient.

I also learned that if you specify the type of the script in the script tag, make sure you have it right, and "javascript" is not the same as "text\javascript" which is correct.

Also, spelling is important. Very important.

Sunday, May 29, 2016

Version Control Made Easy... Or Hard, Not Sure Which.

For those not familiar with version control, version control is something that it's used to keep track of a project and the changes that are made. This way previous versions can be gotten to if errors are introduced, to easy multiple people working on the same files, or for other reasons. In the situation that I am discussing this the files are primarily code files, but they don't have to be.

Most of my experience so far is with Microsoft's version control systems SourceSafe and Team Foundation Server (TFS). However, Git is slightly cheaper (free), with web based hosts that are also cheap (free) like GitHub. I am used to how TFS works, I am learning how Git works. The differences in Git leads to a slightly different vocabulary. And those that don't know version control won't know the terms anyway.

For convenience sake I will put several definitions here for those with questions.

A repository is a project and all associated files and all their versions.

A branch is an independent group of files, often a copy of all project files, but not necessarily. The master branch is the main branch of the repository and usually considered "the code" or "the source". Most other branches will be copies of the master branch allowing the code to be edited without effecting the master branch.

To clone a repository means to copy the entire repository to your local machine. This allows the code to be worked on with out needing to maintain a network connection.

To commit code means to persist the changes in the local repository, making them the "official" latest version.

To do a push is to sync a local repository with the main repository. This step is necessary due to the detached nature of the local repository in Git.

A pull request is a request to include changes that have been made in one branch in another.

A merge is the process of comparing changes made in two locations to determine which changes need to be included and which can or need to be dropped. It is possible for multiple people to make changes to the same file and those changes to conflict.

If you have any question please feel free to ask. I realize that this may not cover everything that some might want to know.

Sunday, May 22, 2016

Weekend Update

I want to clarify, my personal goal is to post something at least every weekend with what I have done that week. However, I expect some weekends I won't be able to work, so I am asking you to keep me accountable for every other week.

As for what I have done. I have created a webpage. Not a website, still thinking about that.

If you want to see it I have decided to host my code on GitHub. My First Website.

It's not pretty and it doesn't do anything but display some text, but enjoy.

As far as hosting goes, I am beginning to look for something. I have heard of SquareSpace, and Hover. Also, I have seen ads for Google. Please leave a comment with your favorite host, especially if they are friendly to code.

I hope to get that fractal post out this week.

Sunday, May 15, 2016

What I'm doing (Not the Fractal Post)

So what am I doing? Learning JavaScript, I thought I was clear on that. Oh, more detail. I'm not completely sure, I thought I was clear on that. I have at least one JavaScript book, particularly Thinking in JavaScript by Aravind Shenoy. I have access to Pluralsight. There are lots of sites online that have stuff.

The big idea is to create a website and iterate though several versions of the same basic program. The first a quick and dirty make it work. Then see if I can implement changes to ensure that blocking doesn't occur. Then maybe try and offload the calculations on the server. (Fractals, post coming, hint it's a lot of calculations).

In the end I expect to host it on the web so others can point and laugh. There are a number of things I have to figure out.

Saturday, May 14, 2016

This time I mean it!

Okay, so I'm going to try this again.

I have decided to try and get in to JavaScript development, specifically web and Node.js?

Do I know what I'm doing? No, I'm not even sure I know what I'm getting into.

Why JavaScript? Node.js d'uh. Clarification, I recently got my hands on a quad copter, and there is in the local developer community that has a meetup for robots. Robots need to be programmed, my quad copter can be programmed. This meetup for robots is Node.js based. Also, the local developer community has a Slack channel, and from that I have found that there is a demand in the area for JavaScript developers. I guess I'm just looking for something new and this presented itself. Plus, if I have something on the web, then I can say I did something? Right?

Now a little about my self. I have been a professional developer for over 12 years, and programming for much longer than that. I have programmed in Pascal, FORTRAN, COBOL, BASIC and Java. I have been paid to program in C++, C#, Visual Basic, VBA, SQL and even a little JavaScript (JSON).

As you can see, I have a broad experience with programming languages. I have gotten to the point where I can troubleshoot and even code simple things just by Googling the language or getting a book. Most of the time I find I just need the vocabulary, the syntax is very similar from language to language. Especially in the languages descended from C.

So the hard part is finding a project to do. I find I learn better if there is a goal in mind. But that is the issue, I haven't known what to do, but I'm giving up that and doing my favorite types of projects - fractals.

What are fractals? Well, that will have to be another post.

What are you using? That is a very good question. I'm not sure. I currently have Notepad++, Sublime, Atom and Visual Studio Code installed. If you have suggestions on what to use or tools or tips for the above applications, let me hear them in the comments. I will also need a domain registrar and (maybe) hosting, if I am to let you see my code. Again, any wisdom you have will be greatly appreciated.

The goal going forward will be at least one post every other week. We'll see how that goes!

Wednesday, January 25, 2012

Climate Change

The cold wind sliced through every layer that Charles had on, and he had on a lot. Charles looked over his shoulder in irritation.
"Damn it, Harvey! Couldn't you at least give me a warning?" Charles shouted angrily.
"You mean walking out that door two minutes ago wasn't enough, Chuck!?! At least you didn't have to go out in that shit!" Harvey shouted back.
"I'm sorry." Charles tried not to shout. "Our replacements should be here in a week or two, weather permitting. Can you believe people wanted to come here at one time?" Charles was trying to change the subject.
"The world was much different then. Before man made climate change," Harvey replied with a tired, depressed sigh.
"Well, the scientists are still insisting it was man made, this time. And that they can fix it, again," Charles responded, irritated again. He never could pick new subjects well. "Until then we have a job to do."
As if on cue a chime rang. Charles looked at Harvey, and Harvey nodded.
When the chime sounded again Charles spoke into a microphone, "Noon status report. All machinery and instruments functioning. Current temperature -19°C. Rio de Janeiro base out."

Friday, January 20, 2012

New Old Changed Same Focus

I am who I am. I feel bad that I haven't used this blog more. Lately, I've been thinking about trying some new things, again.

Tried my hand at writing when I was younger. Some things have recently conspired to make me think I might try it again.

I know, I'm crazy.

Sunday, February 6, 2011

Who I Am and What I'm Doing

I decided that the first thing I should do is some clarification. I don't have an "audience" yet, and as such cannot make any assumptions about the average reader. (Other than they may be imaginary.) As such, I should ensure that certain facts are put out their and maybe certain definitions are made.

My current job title is Software Developer, and that is along the lines of my preferred vocation. For a living, and for fun, I write code or programs. At it's most basic a program is a list of instructions for the computer. However, computers don't understand English, and writing in what a computer understands is very difficult and error prone. So, how it's done today is a programmer writes a file in an English like syntax, and then that file is processed into something that a type of computer can understand.

Now, most PC's use one of two brands of CPU's that speak very similar languages, even more so now that Apple has moved the Macs to Intel processors. However, other computer devices, like smart phones, use different processors that speak different languages. The languages I am referring to here are how the processor commands are encoded. Like the Western European languages, the alphabet is the same, but the words are different. The same string of 1's and 0's on one processor may mean something completely different on another, or nothing at all.

So, basically, you need several things to create a program. First, you need a developer (that would be me in this case). You need a target platform (I target Windows machines at work, and I am trying my hand at HP Palm WebOS at home). You need a compiler (in the case of WebOS, you can use javascript that is interpreted at runtime). And you need some way to write the code (this is one of the sticky ones when it comes to trying to do it on ChromeOS).

In my next post I will describe the search for an internet based text editor.

And please feel free to ask me any questions you may have about the software development process or what I am trying to do or what any of these might mean.

Saturday, January 22, 2011

Now I May Have A Focus

Ever have something happen to you that you did not expect? Something that as it was happening, or you were realizing it was happening, left you just gaping and repeating, "No way!". I know, me neither.

Actually, it has happened to me several times, a wife and two kids.

Another time that was close happened just this last month.

Google, you know them, in there continued plans to take over the world has designed an operating system based on their Chrome web browser called, oddly enough, Chrome OS.

Now the thing about Chrome OS is that it is designed around the idea that you do everything on the internet. This means that the computers that run Chrome OS don't need to have a powerful processor, or much storage. Most of it is done on the web, but you also need to be connected to the internet to do much of anything.

Now, why would I care about Chrome OS? I mean other than being a computer geek? Well, isn't that enough? OK, it is, but not really enough for a blog post like this.

The idea behind an operating system is to run a computer. In this case the focus is laptops, and there are plans to release Chrome OS notebooks later this year. Not even this explains the interest.

Well, Google is doing beta testing of their OS and have created a notebook for that testing. This notebook that they are using for the beta testing, they are giving away for free. Just go to the Chrome OS page and apply for the pilot program. There is only a limited number of them, and I don't know if they have any left.

Now, I applied for this program and have been given one. The notebook is call a Cr-48 (referencing an unstable isotope of Chromium). Back when the box arrived my wife indicated that it had arrived and my daughter thought it was a Christmas present that we had ordered for my wife that morning. I got home and started to open the box and saw the box art that I had glimpsed on some of the articles about the Cr-48. I was like, "No way!", and "My wife is going to kill me." I was afraid that she would not believe that I had not spent money on it, she did however.

After a small glitch initially, both my wife and I have enjoyed playing around on it. In fact I wrote this blog entry on it.

However, when I applied for it, I said that I was a developer and I wanted to try developing mobile applications on it. So, I am kinda trying to figure out how to write code on this thing.

I have found a solution that will work, I think.

My intention is to try and blog about my experiences.

My first one will probably be on choosing a text editor.

Thursday, September 9, 2010

Update

A lot has happened since my last post. Not just because of the delay.

I have been laid off and found a new job and became a dad, again.

I now work for Antech Systems as a Software Developer.

Wednesday, April 7, 2010

Well...

Still not posting.

Uhm, well, I guess I'm not always right.

Friday, September 4, 2009

Where is the Reset Button

Well, I missed my goal. I am hereby removing the weekly requirement, in the hopes that doing so will result in slightly more frequent posts.