Tuesday, April 24, 2018


   So a while back I had the need for a lossy image format that supports transparency and is widely use. I decided to try my hand at making my own solution. I settled to base the format on Jpeg since it is arguably the most widely used image format. The only problem is that it doesn't support transparency. I set out to essentially inject transparency data into the Jpeg format with pretty acceptable results. After using it for a while though I noticed some problems. There were artifacts sometimes present at the top edge of images. After some investigating this is caused by the image height not being a factor of 8 since Jpeg works on 8x8 chunks the transparency information would get mixed in with the color information causing it to have a slim but noticeable artifact. Version 2 fixes the problems as well as provides some performance improvements. The tool set provided though is different from the first version as their is more than just a converter, a viewer, and the library. This version also utilizes a valid Jpeg header and Magic making it view-able in some applications that natively support Jpeg  (like Google Chrome, Ms Paint, etc) just that the image will not appear as intended.


Download: MEGA


Inside the rar container are several executables and a DLL.

PrependTransparentJpgHeader.exe - Adds the proper Magic/Header information to normal Jpg file.    This is used after converting the Master to Jpeg.

TJPG.ico - The icon used for the format.

ToTransparentJpg.exe - A ease of use tool to convert from PNG straight to Tjpg without all the hassle of using the other files.

ToTransparentJpgMaster.exe - Used to output the image used to construct the Tjpg. The output image is in BMP format and can be converted via any tool/method you choose.

TransparentJPG.dll - The library to integrate TransparentJpg2 into your .Net programs.

TransparentJpgToPng.exe - Converts from Tjpg format to Png format.

TransparentJpgViewer.exe - Tool used to view Tjpg files.


Usage: You are free to use the ToTransparentJpg.exe if you want something quick and simple. But if you want more control you would either use the TransparentJPG.dll if you are a .Net programmer or use the provided tools in the following order.

1) Drag and Drop your Png image over ToTransparentJpgMaster.exe - It will produce a Bmp file that calculates and places the color and alpha in the proper place for when the Master is converted to Jpg. You are free to modify the Master in its Bmp state as you like.

2) Convert the Master Bmp to Jpeg anyway you choose - the reason this step is included is so people can use their own method of conversion with filters and smoothing and quality settings, as well as their choice of Jpeg encoder.

3) Turn the Master Jpg to Tjpg by Drag and Drop over PrependTranparentJpgHeader.exe - This will prepend the proper Magic/Header and save a new Tjpg file.

Here you can see some comparisons:


Wednesday, November 22, 2017

File Trimmer (subData)

Recently I was asked to make a program which copies files in a directory but for each file copied skip the first 0x1000 bytes. I thought yeah sure I can do that lol. I went ahead and worked on it and decided to add a feature. The ability to specify the size instead of a fixed value of 0x1000. The other requirement was that he wanted it to be a drag and drop application and because of that you cant really enter command line args via drag and drop so I thought I'd repeat what I've done before for one of my other programs. I used the file name of the executable to determine the length of bytes to skip.

So if I wanted to say skip 255 bytes I would rename the executable to TRIMxff.exe or TRIMxFF.exe

This has the added bonus of making copies of the TRIMx program all with different lengths to skip and when you want to just conveniently drag and drop your file over the respective one.

The processed files will appear in the same location as their originals with the string "TRIM_" leading the original file name.

DOWNLOAD: https://www.mediafire.com/file/9eh5hzmhm0wkrnm/TRIMx.exe

Friday, November 17, 2017

MonoGame 3.6 VisualBasic template for Visual Studios 2017

A while back while working on my game I was on Visual Studios 2015 I used a template that I found for VB since MonoGame dropped support for VB. Fast forward a little bit and I'm now on Visual Studios 2017 and MonoGame 3.6. I went to look for that template file since I lost it between reinstalling Windows multiple times but couldn't find it so I figured 'how hard could it be to just make the template', since the template I was using was converted from the C# template. Turns out it isn't hard at all.

Here is a download link to the template: http://www.mediafire.com/file/zga4e5a54m465pa/Windows.VB.zip
To install it just place the Windows.VB.zip file to "\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual Basic\MonoGame" creating any folders that are needed.

Monday, October 16, 2017

Localization Processor

A friend of mine who goes by the alias Robert J Stanley (No Relation) is working on his PHD and he deals with some of the most intense work I can think of or maybe because I don't understand it lol. He has to deal with aligning and sequencing genes, mutating bacteria and cells, testing on rats and much more I'm sure, He really is a workaholic lol. Having said that even with great people there comes a time when you wished you could do your work faster and/or better. He originally came to me asking for me to make a script to automate a certain program (ImageJ) which supposedly is a standard when it comes to doing what ever it is he is doing at the moment. He showed me the process of what he had to do and I thought at first it would be a pain to write a script for this program to do everything he wanted, so instead I told him I would make an entirely new program to do everything he asked and a bit more.

The Task:
1) So what he needed to do originally in ImageJ was to essentially greyscale 2 to 3 images.
2) Next he needed to isolate meaningful structures out of it by removing the background.
3) Then came the part where he would have to take those 2or3 images and overlap them.
4) Calculate the percentage at which the two overlap which would signify localization.
*There are more detailed steps that he had to do but I don't entirely remember.

So lets make a checklist to show the process of me making this program for him:

I will be using these 2 images to demonstrate.


1) First I needed to greyscale the images. I didn't see a need for this as the images provided were already only in 1 channel each.
Like the first image only had values in the red channel and image 2 only had values in the green channel, etc. These values were 0-255 so if you look at it simply by their values per channel then its already kind of a greyscale image. So I guess that is done.

2) Next what he had to do was isolate the meaningful bits of the image by removing the background. This was going to be pretty simple I thought. What I decided to do was go through every pixel and if the pixel had a value greater than 0 I incremented a counter and added that value to a variable. I also had a variable keeping track of the highest value it came across for later use. After the loop completes I divided that value by the counter to get a final value which represents the average intensity of all the meaningful bits (bits which weren't 0) in the picture. They then looked like this:


3) His next step was to overlap them. I simply did this by filling in all the green values (which were all 0s) in the red original image with values in the original green image, I say original because these were untouched images not the images I removed the background from in step2. This produced an image with areas of only red intensities, some areas of only green intensities and potentially ares where there was red and green intensities which would give shades of yellow and yellows which lean towards green or leans towards red. This wasn't a very good image in some cases as some of the intensities were very slight and result in images which weren't all that easy to spot localization.
Like so:

Even with overlapping the 2 images where I removed the backgrounds didn't look that much better:

I mean you can generally see where it potentially localizes (I say potentially because in all fairness I have no idea what i'm talking about lol) but its not very defined, lack of resolution I guess would be the technical statement here. So I decided to increase that. Now I can't just go in and arbitrarily change values without some kind of control. I needed something which is consistent and controlled which could be applied to all the images. Well I thought there is a gap between 0 and the average value I computed in step 2, and also a gap between the high intensity value I also found in part2 and the max value possible 255, lets stretch what ever the value is for each pixel linearly with those 2 gaps in mind. Doing this made it so that the lowest intensity value after removing the background mapped to 0 and the highest intensity found is mapped to 255 and any value in between is linearly and proportionately mapped somewhere between 0 and 255. I came up with the following formula Y = (X - A) / (H - A) where H is the highest intensity value obtained in step2 and A is the average meaningful intensity value obtained in step2. Y was then set to 255 if the resulting calculation was greater than 255.
After doing this the images were much more defined in terms of color, and structures that you couldn't see before popped out:


And the overlay composed from these two images were much more telling:

Now that I had the image finalized I had to use it to compute how much of it was potentially localizing. This took me the longest time as this was mostly statistics and boy do I hate statistics. I ultimately decided to take the average of 2 methods I designed after I computed a couple things for both methods to work with.
One thing I needed to calculate was a new average. Since I was going to analyze both images and hence 2 channels I couldn't use the individual averages obtained in step2. I decided to start off by setting the initial new average to the sum of the the average computed in step2 from both images and dividing by 2. This essentially gives me the average of the averages lol. I then iterated through all the pixels of the overlay shown in step3 and for every pixel which value is greater than or equal to the new average, add that value to a variable T for later use and increment a counter variable. A new channel average was calculated by dividing T by the counter variable . I did this separately for both the green and red channel. The finalized new average was then calculated by adding the new averages from the green channel and the red channel and dividing by 2. With these new averages (RedAverage, GreenAverage, RedGreenAverage) I was then able to compute using the two methods. Both methods share a condition and that being the pixel is only considered if its green intensity value is greater than or equals to the RedGreenAverage. We use green because that is the channel of interest. We want to see if the red overlays the green.

There is a variable called GT which gets added to.
There is a variable called RT which gets added to.
If green intensity is greater than or equal to GreenAverage and if red intensity is greater than or equal to RedAverage then add 2 to GT and add 2 to RT.
If green intensity is greater than or equal to GreenAverage and if red intensity is less than RedAverage then add 2 to GT and add 1 to RT.
If green intensity is less than GreenAverrage and if red intensity is greater than or equal to RedAverage then add 1 to GT and add 1 to RT.
If green intensity is less than GreenAverage and if red intensity is less than RedAverage then add 1 to GT.

There is a variable called GT2 which gets added to.
There is a variable called RT2 which gets added to.
Add 255 to GT2 (the reason we use 255 is GT2 stores the green values and green represents the protein or the interest and thus if its there at all it should be viewed at the most importance and so 100 percent which in this context is 255.
If red intensity is greater than 0 then add red intensity to RT2.

Finally I do ((((((RT / GT) * 100) - 50) * 100) / 50) + ((RT2 / GT2) * 100)) / 2

For this particular image I got ~%82 Localization.

All that is left was to make it do batch processing of multiple pairs of images and output all the percentages to a csv file and I was done. This program took me about 2 days to program and my friend checked a bunch of times for consistency and for any false positives throughout its development. He likes to state that this program is better than imageJ and while that maybe true for him in this particular use case. I wouldn't count imageJ out of the picture as it is much more featured and I like to think that the two programs just work differently is all.

Download: http://www.mediafire.com/file/u2325y0ggsr8h1v/LocalityProcessor.exe


Tuesday, August 8, 2017

JEDEC vs IEC standards

What is a kilobyte? To some it maybe 1000 bytes and others it maybe 1024 bytes. Why the difference? which one is correct? The computer world seems to be confused as to which convention to use. On one side there is the original JEDEC standard which specifies that 1024 bytes are in a kilobyte and 1024 kilobytes are in a megabyte etc. Then on the other there is the IEC standard which states that 1000 bytes are in a kilobyte and 1000 kilobytes are in a megabyte etc. What are the difference between these two standards and their practical uses.

Personally I follow the JEDEC standard because as a programmer it makes much more sense to me. If we look at numbering systems we will see the pattern that for each place value it is a power of the original base value. For example the first few place values of binary are 1,2,4,8,16,32, etc. If we take the smallest unit for typical computers (the bit) which is also base2 we can extend the pattern and see that 1024 is a place value. Which means using 1024 would be nice as it lines up when working with bits. The IEC standard on the other hand uses 1000 and isn't found as a place value in binary which will lead to inconvenient alignment issues.

Well then why do we have the IEC standard at all? I personally believe its because of marketing. When you buy a new hard drive which is say 1TB you are expecting to get the whole 1TB but on some operating systems like windows you might be confused to find that you only get about 931.323GB. This is because the labeling on hard drives use the IEC standard and windows uses the JEDEC standard. For marketing reasons the IEC standard is used on hard drive labels because 1000 definitely looks better than 931.323 and ignorant people just go with the flow. The IEC standard also accounts for the programmers by simply renaming kilo to kibi and and mega to mebi etc although I'd argue that they did so pointlessly. I do not see any real reason to make such a conversion. I also do not see why we have to cater to the consumer which have no idea how the technology works. File systems for instance and hard drive allocation tables under the hood goes by powers of 2. You might find that sector size of your hard drive is 512 bytes and event the Advanced format is at 4096Bytes, because it is power of 2 you will never have a sector that is 1000bytes in length or 4000bytes in length which will miss-align later once you get to kilobyte on the IEC standard (using kilo, mega, giga etc). Computers simply aren't base 10, and there simply isn't 10 bits to a byte. Maybe if there were 10 bits to a byte we can officially and nicely move over to IEC (and get rid of those weird kibi, mebi naming schemes).

Which is completely possible. The size of the byte as we know it now is 8bits but the byte has been 5bits, 6bits, 7bits in the past. Bytes have even gone higher than 8 bits with some systems using 20bits to a byte. The number of bits to a byte these days though have some preferences such as the number of bits have to be a multiple of 2, so essentially it has to be an even number of bits, and 10bits satisfies that. So until I personally see 10bit bytes I don't see any reason to use a standard other than the JEDEC standard. Both are correct but only one makes practical sense to me.

Tuesday, March 14, 2017

Differences In Image Formats

So I know a person who back in my Java 1 class thought it would be cool to show me a trick. Essentially the trick was (he thought) that he can convert an image from one format to another simply by changing its extension. Needless to say I wasn't impressed, in fact I got pretty angry. I told him "No you didn't convert the image, you only changed the extension". He continued to state that he did since it worked. Now just because the software you are using is smart enough to detect the actual format of an image or dumb enough to abandon standards to do that is irrelevant. In this post I will describe the basics of what makes an image format different from another.

Now the extension is the first difference which everyone sees and is arguably the first difference to be noticed. It is simply text appended to the end of the filename. In terms of image formats you might have BMP, PNG, GIF, JPG, TIFF, WEBP, etc...
The extension though is only related to the file name, it is NOT related to the actual data of the file. The file name doesn't reside as data in the image, if you look at the file in a hex editor you will not find the filename. The filename and extension is for allocation in the file system used. If you open the allocation table of your drive you then will see it there. So changing the extension doesn't even change a single bit in the image file.

The header of an image format or any file format specification is actually in the data. Changing this might or might not affect the use of the file depending on where in the header you mess with. There are several parts in the header and each format has a different type and number of headers but typically the Magic/Signature is the first thing you will see.

The Magic is the first few bytes which identifies what format the file is in and in some cases provide metadata. Parsing this will allow the ability to know the file's format but even more importantly its structure. Here you can see the Magic between the same image but one in JPG and one in PNG.

I'm not going to explain the entire header of these two formats but I will present them so that the difference can be seen.
JPG Header:

PNG Header:

Note: JPG has several different headers depending on options and type. You can see from the image I posted above that the JPG used here is of the EXIF type.

Now we can see that the structures of the image is completely different. A JPG decoder can not interpret a meaningful image if it tried to decode a PNG and vice versa.

Even if the headers were the same the inner workings of the two formats would be completely different which leads use to the encoding and decoding of the image data.

JPG works by use of huffman tables and quantization tables. These tables are computed and is what gives the image the compression and lossy factors. This is also what allows different encoded images to be decoded the same way.

PNG on the other hand uses compressed chunks. Chunks are used so that PNG can be presented in a streamed manner but the image is encoded typically using a compression algorithm of the lossless kind. This gives per-pixel integrity at the cost of usually producing a larger file size (than JPG).

Thursday, February 23, 2017


This is a tool I made for people who draw on paper and plan to scan their work onto the computer. Typically these scans look very unprofessional due to the paper gradient the drawing is on. for example this drawing I found on google:

Typically its line art which go through this process from what I see my friends do. The process can be done in photoshop or other editing tools but its tedius. I thought hmm, I can make a program which eases everything. The outcome looks like this:

The program has only one option to adjust which is the threshold. The threshold controls how light or how dark a pixel can be to be kept in the image or left out completely (turns it 100 percent transparent). Messing around with this might or might not enable you to get the results you want. Too High and it might keep artifacts or defects in your image which you wanted out, adjust it too low and it might leave out details which you might wanted to keep.

DOWNLOAD: ImageTransparencyInducer

Here are some other before and after examples:

Sunday, September 18, 2016

Learning any base numbering system

In previous tutorials I made, I showed how to work with binary (a base 2 system) and hexadecimal (a base 16 system). There are many things they share and principals in their systems which are true. Knowing these principals you can derive and learn any base system quickly and intuitively.

The first thing you must realize is the BASE of the system. This is the determining factor in knowing the place value for each digit. For example if we use the decimal system what we count with everyday we see that it is base 10. That means there are 10 distinguishing characters used in this system. These characters correlate to the digits and in actuality can be any character but for this example we will use the characters we are all familiar with which would be [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]. As you can see there are 10 distinguishing characters or digits.

Lets talk about place values now. Given any base system each place value to the next is calculated by (BASE ^ PLACE).

So in the base 10 system its like this:
...... 10000(or 10^4), 1000(or 10^3), 100(or 10^2), 10(or 10^1), 1(or 10^0).

so given the decimal(base 10) number 54,321 we can see that there are:
5x10000 or 5x(10^4) = 50000
4x1000 or 4x(10^3) = 4000
3x100 or 3x(10^2) = 300
2x10 or 3x(10^1) = 20
1x1 or 1x(10^0) = 1

if you add these all up (50000 + 4000+ 300 + 20 +1) you get 54,321.

Now lets try duodecimal(base 12).
Lets establish the characters [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B].
(where A can be thought of as 10 and B as 11)
now establish the place values.
.......20736(or 12^4), 1728(or 12^3), 144(or 10^2), 12(or 12^1), 1(or 12^0).
so given A53B7:
Ax20769 or Ax(12^4) = A0000
5x1728 or 5x(12^3) = 5000
3x144 or 3x(12^2) = 300
Bx12 or Bx(12^1) = B0
7x1 or 7x(12^0) = 7

if you add these up you get A53B7.

because every system is base based (lol didn't realize this pun until I wrote it) we can just divide the the bases to go from one base to another. using the remainder as the desired next digit in the resulting base's number.
One way is to do long division with the 2 different bases and help with base 10.
I'll get more into converting from any base to any other base in my next post.

Monday, June 20, 2016

VBES - Saving even more bandwidth with UTF8

So a while ago I came up with an encoding scheme which utilized UTF8's variable byte concept to essentially save bandwidth while chatting in instant messaging scenarios. After that I had thought of improving upon that idea even further but never got around to actually coding it, I had the idea down but I didn't have a solid working scheme much less code. The other day though I thought I'd work on it and after planning it out and finishing the encoder and then the decoder the next day I had come up and made an encoding scheme which meets all the requirements of my previous encoding scheme and performed better (in saving bandwidth). This new scheme implements the idea that some letters are used more often then others and so if I allocate fewer bits to those more likely used letters the final message should be pretty small. I broke up the letters, a few punctuation, a space and an escape for UTF8 fallback into groups of 4bits, 6bits, 8bits, and 9bits. It is completely backwards compatible with UTF8 which is nice in scenarios where VBES would produce larger messages, one can just used the UTF8 version instead and the message would still be decoded. Its a simple concept and I will be opting to use this for my future messenger app.

How it works:
* 0000
e 0010
t 0011
a 0100
o 0101
i 0110
n 0111
s 1000
h 1001
r 1010
d 1011
l 1100
c 1101

u 111000
m 111001
w 111010
f 111011
g 111100
. 111101

y 11111000
p 11111001
b 11111010
v 11111011
k 11111100
j 11111101

, 111111100
x 111111101
q 111111110
z 111111111

The * signifies that there is an escape and a UTF8 encoded character should fill the space.

Demo Encoder/Decoder: Download VBES Encoder Decoder

How much space does this save?
In the best case scenarios the size of the message is 50 percent of the UTF8 message plus 1 byte. So that is (X*.5)+1 bytes.

Where does this 50 percent plus 1 come from?
The half comes from the fact that the most optimized characters are 4 bits long which is half a byte which is half the size of the smallest possible letter in UTF8 which is a byte. The +1 comes from the fact that if a message consisted of all 4bit letters and fit perfectly into multiples of 8bits there would still require 2 more bits for the UTF8 marker. With those 2 included bits there now has to be padding and thus an entire byte has been added to the message.

How does this compare to the previous encoding scheme?
The previous encoding scheme worked on optimizing several characters and allocating 6 bits for each of those optimized characters. Because 6 is 75 percent of 8 and also had the 2 added bits for the UTF8 marker its best scenario efficiency would be (X*.75)+1.

How comes this scheme doesn't optimize capital letters?
By default this scheme will turn the entire input message to lowercase because only the lowercase letters are optimized and thus the message would save the most space this way but you can disable this behavior if you truly wish to send a message with capital letters. The capital letters each will be encoded using standard UTF8 and their placement will be signified with 0000 which is also used to signify the placement of other UTF8 encoded characters.

Source (VB.net):

Open/Free for non-commercial use.
For Commercial use please contact me.

Tuesday, April 26, 2016

Interesting Videos

On the internet there are many sources of information. This post will revolve around videos on YouTube which provided me with knowledge of some form of intellectual interest.

More to come....

Saturday, January 23, 2016

Introductory to Java

I have started school again recently and one of my classes (for Computer Science) is Java 1. I figure it might be a good idea to make a blog post for it to document and to help classmates who need it. I will cover things in the lessons and explain them in my own way (to help classmates if they so happen to need it) as well as some things I notice, advice, etc. I will try to use illustrations where possible and analogies where concepts are somewhat complex. Also keep in mind that I am not an expert by any means but I thought I would provide this in hopes of people will get at least a feel for how programming is, So while some information for example terms and such might not be completely accurate they should be close enough to use as a stepping stone to reach an understanding on your own that you will develop. Of course if anyone feels as though they need to make corrections or contribute the comment section is open.

[Week 01]
    This week it seems we talked about how a computer system works and how it operates on data. I wont get into much details about that because this is a Java class I don't think this is all that important to know since Java is a high level language. There is no need to worry about things as ALU, or registers etc because they are on a much lower level and programming in Java you will most likely never encounter a scenario where you need to worry about such things.

    Finally towards the end of the first week we got to some code. Although simple there were a couple things we were told not to worry about until later but I feel as though they should have been covered early on so that there is room for familiarity when we do get to them later. We were asked to make a "Hello World" program. This program is typically the first program beginning programs try to make. Keep in mind that I wont be providing code for any other assignments besides the "Hello World" instead I will try to create similar code which will demonstrate the same material.

    Now the code for Hello World will look like this:

    Now there are some other lines before the snippet shown but those wont be important throughout the whole class I believe unless we get into import etc.

We can look at this following code line by line.

Line 1 ("public class HelloWorld {"):
    This specifies that there is a class called HelloWorld. First we have the word "public" this is the access modifier. This states that the "class" can be accessed through the rest of the program. There are other access modifiers like private and such as well and they should be used according to your needs and where appropriate.
Click here to know more about Java Access Modifiers
The next part "class" is usually the Type specifier and will provide information on what kind of thing something is. There are many Types and one can make their own as well. Next we have "HelloWorld". This is a name. This can be anything the programmer wants to call it but typically this should be given a good meaningful name which correlates to it purpose. There are restriction in naming things. You cannot name something that is already taken by a reserved keyword. So words like "String" or "public" will not be allowed. Names also cannot contain any blank spaces in between and to make up for that we have something called CamelCasing which basically has you capitalizing the first letter of each word in place of putting a space. Finally on this line we have a open curly brace "{". In this case this essentially encapsulates the code that will be associated with the class called "HelloWorld", but it will be used to encapsulate code to anything and is used to define the scope. Some people have this placed on the next line but it doesn't really matter as Java is not a line oriented language and so this can be placed anywhere as long as it is directly before the code you want associated with the class also you should pick some convention and stick with it for readability for other people. This easily shows what code is apart of what.

Line 2 ("  public static void main(String[] args) {"):
    The first thing we see here isn't very important in that you can not do this and your program will still run exactly as if you did have it. Its the indentation (the long blank space). Indention is an important thing that one should learn to do as to make it easy for people reading your code to know what level things are at. The more to the right a line is the deeper that code is. The more left means its closer to the general level. Again without it your programs will still work but readability will be lacking and I wont be surprised of the professor took points off for it. "public" was already covered in line 1 and essentially serves the same purpose. "static" states that this is shared among all other instances of the class HelloWorld. You can have a million instances of HelloWorld but they will all use this one main function. "void" essentially means that this is a function which(to the coder) doesn't doesn't return anything back, functions that don't return anything are also called methods. "main" is typically the name of the entry point and where the program begins executing the programmers code. Next we have an open parentheses "(". This is the opening for parameters, just like in Mathematics where you would have a function for example f(x) aka F of x. In pretty much the same idea the parentheses is there to distinguish the function part from the parameter part. Next we have "String[]". In this part there are actually several things happening. First this part syntactically is another Type specifier which was covered above. It is essentially telling what kind of data x is. Here we can see the type is "String". A string can be just thought of as text, so basically a bunch of characters. Then we have the "[]" which specifies that the String is actually an array. You can typically use this along with any Type when you want to make an array of them. So in this case for example instead of just containing one String, this can contain multiple Strings. "args" is the name of the String[] from earlier. This is used for referencing later just like how the x in f(x) is referenced when defining a function, for example f(x) = x + 1. The function name is f, the parameter is x and the function returns basically what ever number you use as x incremented by 1. So if I put in 1 I get 2 and if I put 2 it results in 3. The closing parentheses is used to enclose the parameter portion of the function. Some functions will not contain any parameters and will only show the opening and closing parentheses like this "()". Finally for this line we have another open curly brace "{". This again is to encapsulate anything that is to be associated with (in this case) this function and defines that this is the begin of the encapsulation or defining the beginning of the scope of this function. Scope is the accessibility of something given what level they are on. Remember the indentation. Things on the same level can access each other or on anything that is on a level to the left (as long as it is only to the left, the moment something branches to the right again, anything within that scope that went right will not be accessible).

Line 3 ("    System.out.println("Hello, World");"):
    First we see there is a long blank. This you will see is about twice the length of the blank space from the previous line. This indentation is on another level/scope. This means that anything on this line can access other things on the same scope or anything to the left (in this case things with one indentation). Next we have "System" and is a built in class to Java and has many useful things programmers typically would use. "." is the next thing we see and it is to specify that we are going to reference something that is a part of "System". "out" is the built in output stream object. It is used to output to the console, it is apart of the System class. "println" is a function that is a part of "out". In this case you can think of "System" as some company, "out" is some worker at that company, and "println" is a job that worker knows how to do. Now we see an open parentheses which provides the same functionality as mentioned before. It is there to specify the parameters. In this case (although not shown here) println will be taking in a parameter of Type string. Next we see "Hello World" (including the double quotes). This is called a string literal. A String literal is a string that is used without being assigned to a variable and instead used directly as is. Strings are distinguished with quotes and double quotes. We then see a closing parentheses which indicates the end of the parameters. Finally we see ";" which is used to end the code statement. Because Java is not a line oriented language it needs something in place to indicate and separate statements from one another.

Line 4 ("  }"):
    This is to close the encapsulation or scope of the code block. In this case it closes the function main from earlier.

Line 5 ("}"):
    This is to close the encapsulation or scope of the class HelloWorld.


Comments: Comments are bits of text to note a line of code or note the functionality of a function or the entire program. It can also be used to relay other information as well. Comments can be denoted with two back slashes for small single line comments. Multi-line or block comments can be denoted by beginning with "/*" (without double quotes) and ending them with "*/" (without double quotes). Here are some examples of comments:

Variables: Earlier we talked about String literals and how it wasn't assigned to a variable. Variables are a way of storing things for later referencing/usage. The times we use things such as String literals is when we don't need to reference back to it multiple times and make any changes etc. You create a variable by first specifying an access modifier though not always necessary and can sometimes be skipped. Next you need to specify a variable Type. This can be any of the primitive types such as int, long, float, and double or be specified to a custom Type you made either by creating a class or structure of the same Type name. Next you give the variable a name. This has the same name restrictions as mentioned earlier. Next you can either assign a value to the variable with an equal sign "=" and then close it or just close it without assigning a value with a semicolon ";". Here are some examples of variables:

[Week 02]
    Week two had some basic math and data types. We did addition, subtraction, multiplication, division, and modulus. We also went through unary and binary operators as well as compound operators as well as increments/decrements. Constants were touched on although for me it begs the question "what about readonly" ? It turns out there is no "readonly" in java. Just a mushed together "final". Java seems to be pretty bad if you are trying to do math and with accuracy. For instance in Java it is stated that an integer can store a value between -2,147,483,648 and 2,147,483,647. Now at first one might not see anything wrong with that and I would agree but the problem lies in that there is no unsigned integers. Now this honestly isn't all that big a deal but it unsigned types have their uses. Say we know for a fact that we will never have to deal with negative numbers in our program but we need to store values between 2,147,483,647 up to 4,294,967,295(2^32 - 1). In Java to represent that number we have to instead resort to an 8 byte variable (long) to represent that number instead of the 4 byte variable (int). It is pretty wasteful to allocated twice the amount memory for a number that can be represented with 4 bytes. Of course computers these days have plenty of memory and that is why I said its not such a big deal but it is still a fault and I personally don't know why it was a design choice in Java. Now onto the real problem, lets say we have an integer. Remember that an integer has the specific range -2,147,483,648 to 2,147,483,647 so anything outside that range an integer type simply cannot store it. Lets look at this line of code:

As you can probably figure the answer is -4,000,000,000 but that is outside the range of integer. So one would expect to get an error but instead Java gives the answer 294,967,296. This is very bad in that if you are doing math related things you would get an answer and might unknowingly use the wrong answer thinking it was correct. This also gives us a difficult time when debugging in cases where the input value is unknown and this unwanted behavior is only present in certain inputs. Your program would compile fine, and maybe run fine most of the time but every so often it will give you the wrong answer and nothing to indicate that it did so. After a few tests I figured out the behavior of what Java does in these situations. If the number is outside the range of integer Java will wrap around to the other end of the range and continue the arithmetic from there. I figured this out by taking integer's lowest possible value (-2,147,483,648) and subtracting 1 from it and see where it lands. It lands on the integer's maximum value (2,147,483,647). So Java essentially doesn't underflow or overflows. Now I don't know why Java is designed like this but in this situation one would want some indication of when it underflows or overflows so we don't get wrong answers in our calculations. So in this respect this behavior is pretty bad. The same thing happens when we do 2,000,000,000 + 2,000,000,000. We know the answer is 4,000,000,000 but Java cant store that value in an int, it gives us an answer anyways (-294,967,296)..... How can adding two positive numbers result in a negative number... bad Java BAD! Go to your room!!!

    Now this next problem isn't really a problem and it isn't only Java but several other programming languages as well like C#. The problem here is with the modulus operator. With all positive numbers as parameters it behaves as it should but when you add a negative number into the mix things become off. This is because some languages' modulus and clock arithmetic behave differently. And thus in cases like:

Java and C# gives the answer -1 while clock arithmetic and several other programming languages will give you 2. If you think about it 2 makes sense in that you actually have something left over and that it shows that the number is 2 MORE than a multiple of 3 (-10 is 2 more than -12). It doesn't really make sense to have a negative amount left over, but then again depending on your definition here -1 also makes sense in that it shows that -10 is 1 LESS than a multiple of 3 (-10 is 1 less than -9).
So if you are doing modulus keep the scenario of negative numbers in mind and that remainder and modulus are not always the same thing or defined the same.

    So enough with ints what other variables are there.
First we can look at a boolean. A boolean stores one of 2 states. You can think of it as being one bit (although it does NOT take up only 1 bit in memory). Booleans in Java do not store numeric values it seems and only "true" or "false" states. Now lets take a look at a byte. A byte is a representation of 8 bits in memory. A byte is typically the smallest unit of data after a bit that people use. In Java it can store the values between (inclusive) -128 to 127 with a maximum of 256 possible states. As you can see this has the same fault as int mentioned above. Even though technically it can represent values up to 255 (because 0 is a state you cannot store the value 256) starting from 0 it is wasted on negative numbers when negative numbers aren't needed. Furthermore byte data is usually thought of as being a value between 0 and 255 so again I don't know why Java is designed this way.
Next you might say what if we double the number of bits/bytes. Wouldn't that allow me to store a larger number? And yes you would, for a 16 bit/2 byte type it is usually called a short. This stored the inclusive range of -32,768 to 32,767. And then if you double that to 32 bits/4 bytes you get int which we have discussed above. Finally for whole numbers of primitive types we have long. A long is a 64 bit/8 byte type. It can store the inclusive range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Besides whole numbers we can also represent fractional numbers. For this we have the floating point types first of which is float. Float is a 32bit/4 byte variable. It stores the value in a specific format as the sign (whether positive or negative), the exponent (power at which to raise to), and the fractional part (value to use in calculating the original number). Now because these numbers use exponents to represent their values their range can be from a very small to very large but at a price. Precision/Accuracy is forsaken due to rounding errors when trying to store a number that is too specific (large number of decimal places). Float types can store values between 1.40129846432481707 * 10^-45 to 3.40282346638528860 * 10^38 (positive or negative) or about 7 digits. We can increase the precision and accuracy by doing what we did with the whole number types and that is to double the number of bits/bytes. In doubling the size of a typical float we then get a 64 bit/8 byte floating point number the double. Now this can store even larger/smaller numbers ranging between 4.94065645841246544 * 10^-324 to 1.79769313486231570 *10^308 (positive or negative) or about 15 digits. Finally there is the char type which is used to represent individual characters. Char has a maximum of 65536 states and can store the numeric values of between 0 and 65535. To get around the unsigned short problem you can do arithmetic with char types if needed but it becomes unclear for others when reading it even thought a character and a number its typically (because of the type name) thought of as characters.

    Lets move onto operators.
In Java there are a couple operators although I personally wished there were a couple more to make out lives easier but essentially we have the following:

Now there are others but these are basically what people will use mostly.

Wednesday, December 23, 2015


While working on my game I needed to be able to see how many different colors there were in an image. I figured there were online tools to do such an easy task but everywhere I looked it either was inaccurate or didn't do what I wanted. So I went out and made a small app which counts the different colors used in an image as well as displays how many times each color was used.

Download: http://www.mediafire.com/download/ochli36xrsy4eq9/ImageColorCounter.exe

Usage: Drag image over application.

Source (VB.Net):

Saturday, December 5, 2015

Game Project

     For several months now I have been working on a project much different and much more interesting than any of my previous ones (in my opinion). It has been very challenging (probably because of the way I decided to do it) and presented many obstacles which I needed to over come. This project is essentially a game or more specifically a game engine (a very simple 2D game engine). I started this project about 2 to 3 years ago with the thought of making a Pokemon game just for friends and family to play. That project eventually saw a dark fate when I managed to mess up my computer and lost all my work regarding it. Jump forward a little bit and I have revived that project though it has been altered a bit. I changed it from GDI+ to DX. Got CPU usage from around 15 to 20 percent (8 threaded CPU) down to less than 1 (depending on configuration used). While I still do plan on making a Pokemon game for friends and family I have been working on a type of fighting game as that has presented me the most challenge. The Pokemon game will most likely be my second project relating to games and will most definitely recycle the work done on the fighting game. There are several other features and updates that I have presented since my initial version which was lost but I don't feel they are interesting nor important enough to mention.

     Typically because I do not know if this project will ever amount to anything (or ever completed) I refrained from posting this on here and instead posted updates on my Facebook but I have recently been kicked out and unable to use my Facebook account (because I refused to use my real name nor do I plan on giving it to them). To continue posting updates I will have to resort to posting on here.

     Updates will be posted in oldest last and latest first order. All updates will have a date attributed to them.

[System Tested]
CPU: Intel Core i7 2600K @3.411Ghz
RAM: 8GB DDR3 @ 1600Mhz
GPU: Nvidia GTX 680

[APR 22 2016]
Moving everything over to MonoGame. Will hopefully provide Windows and Linux versions.

[JAN 21 2016]
I have since made some addition/changes but haven't gotten around to posting until now. I have added a "ColorPalette Management System" and a "PixelData Management System" they are in place to eventually replace the current "Sprite Management System" but currently all three are present for testing and debugging. I have worked out how I want to go about storing game assets (graphics in particular and sounds). Sounds will be in AAC format as there are no royalties involved in the usage of AAC media (unlike MP3). Several other formats are supported but AAC is recommended for reasons stated. Graphics Assets will be stored in a custom format/scheme. The game will have "CPT" (Color Palette Table) files which represent the colors of a particular palette and then another format "PID" (Pixel Image Data) which contains the representation of each pixel in bytes. The images are restricted to an Indexed8 depth meaning each sprite can have up to 256 predefined colors (in the CPT file). The two formats are separate because some sprites may share the same palette in which case it makes sense to reuse a palette instead of making a redundant copy in memory. The idea came about when exploring the GIF animated image format. I added a SoftwareRenderOnly mode for whats it's worth. Finally I moved around some things to better organize the project and workflow.

[JAN 12 2016]
Fixed and optimized my XorUInteger and XorULong structures to use for the engine. They are attempts at cheat prevention (for the simpletons but I'm sure the pros will still get around it). It basically works as you would think the name implies. It XORs the value with a randomly generated token so that the exact value is never stored. It also comes with checks to make sure the token is valid and that the return value hasn't been tampered with.
Source XorUInteger: http://pastebin.com/UVY8feZK
Source XorULong: http://pastebin.com/NJdXe5Ay

[JAN 11 2016]
Added mouse tracking although it isn't complete. Will have to get mouse tracking to properly scale with the window (Right now it works properly when the window is it's native resolution but any smaller and the tracking goes whack).

[JAN 08 2016]
Added a bit to the audio manager. Its able to stop any instance of audio that has been played. During playback an Instance ID is returned and that ID is used to distinguish that audio instance from the rest. That same ID will be used to stop playback of that audio instance if that instance is still playing, if not nothing will happen. Instances start with ID 1, if an ID of 0 is obtained that means the audio instance failed to play (most likely due to missing audio from collection).

[JAN 06 2016]
Improved the fullscreen, now fullscreening from a maximized windowed to fullscreen works and unfullscreening goes back to maximized bordered if it was previously so. Maximizing from a normal boredered window also maximizes and unmaximizes back to a normal window. With the addition of the new GameTimer I found that resizing the window doesn't impact the game much and so I removed the bit where it blacks the screen and suspends the layout until resize has completed so now you can see the game being resized as you resize it. This also gives the plus effect that the game doesn't blacks out when you move the window around. I fixed a problem with the mouse cursor showing over the game when it was specified not to so not when you want to hide the mouse cursor it wont show up anymore. Deleted some unnecessary functions and cleaned up some variables.

[JAN 05 2016]
I implemented my new GameTimer which provides more accurate control over frame-rate which still provides the low CPU usage of the older GameTimer.
I added a third buffer to try and mitigate some stutter I see.
I also hope that this fixes the inconsistencies between FPS on Intel vs AMD machines but will need more testing.
Source for the new GameTimer can be found here: http://tizzyt-archive.blogspot.com/2015/10/ticktimer.html

OLD GameTimer ex:

NEW GameTimer ex:

[JAN 04 2016]
Game now knows when its in focus or not so to grab inputs or not. Changed a bit of the rendering logic so it doesn't have draw queues (was made irrelevant with the buffers but forgot to take it out).

[DEC 30 2015]
Implemented my sound system. I haven't done too much testing but I know that it works. Essentially it is just my previous sound engine code I made a while back. It can do multiple instances of sounds and so a bunch of sound effects going at once shouldn't be a problem. The loading method is similar to the loading method I use for loading graphic assets. What to work on next I wonder.

[DEC 26 2015]
In addition to scaling I have implemented full screen. Full screen is mapped to F11. I might change it to Alt-Enter sometime later.

[DEC 23 2015]
Messing around with different image formats again and I think I will settle for the old fashion GIF format (or more accurately some of its concepts). GIF has a maximum color palette of 256 colors and so each pixel only takes one byte to represent a color. With about 3000 character sprites loaded into memory I figure that will be about a little over 1GB of memory. Of course this is excluding other things like background and effects as well as sound and game logic but I think its much more manageable now memory-wise. I played a bit with vectors and while memory becomes no longer an issue with simple sprites the more complex ones (ones with many angles) seem to be about the same or in some cases worst (though sprites looked so crisp and sharp, its a shame I couldn't use them). I might still use vectors for some things (large but simple effects) but not sure yet, but surprisingly vectors are pretty resource hungry (because they have to be calculated each time where as with an image it only needs to be drawn I figure).

[DEC 22 2015]
After scaling was implemented I had to center the view port but doing so revealed that everything would render to the edges of the window. I went ahead and implemented a constraint on the view port effectively creating a letterbox effect that has the same aspect ratio as the render resolution.
Ex (16:9 ratio):

[DEC 21 2015]
Got to implement scaling so now changing the size of the window wont crop or letterbox anything, instead everything is scaled up/down relative to the window and internal rendering resolution.

[DEC 13 2015]
Finished/Fixed dead zone correction for EZPAD. Download and source updated below.
Changed a couple things in terms of graphics.
Found a weird behavior where a frame sometimes drew an image out of place and of unspecified size, fixed it by having 2 buffers instead of one (buffer isn't used here in the normal sense of back buffers).

[DEC 12 2015]
Decided to redo the XInput lib for ease of use, flexibility and usage more straight forward.
New one is called EZPAD, Download and source is provided below (VB.NET).
     Imports EZPAD
     Dim NewGamePad As New EZPAD(PLAYER.ONE)
Download: http://www.mediafire.com/download/5hfp8k9h4jb7fx7/EZPAD.dll
Source: http://pastebin.com/kPMtLLy6
Old XPadMonitor Source: http://pastebin.com/m9r0cmGa

Sunday, October 18, 2015

Millisecond Timer

   So a while back I discovered that windows can't do microsecond accurate timers (at least not in a straight forward way). Windows is not real time operating system so events are triggered differently for different computers. There are ways like the MicroLib I found on the internet a while back but it is very resource hungry using up almost 100 percent of one of my cores. This is because it is essentially polling a stopwatch and seeing if the number of ticks is equal to or greater than the specified Tick which is calculated per computer. I have tried to modify it to be less resource hungry but my attempts failed. I recently found some code which utilizes the windows multimedia api to achieve a more accurate millisecond but it was only accurate down to the millisecond and cant achieve for example 16.7 milliseconds. I then thought hey I can put the two together. This millisecond timer can achieve closer to the specified millisecond like 16.7ms which is the duration of a frame in a 60FPS game. Now this isn't perfect but I'd think this is as good as it gets (for me its exactly what I needed). If there are better methods/alternatives please comment or if you have any suggestions or improvements.

[UPDATE JAN 05 2016]
I got around to redoing my GameTimer. The previous one was very inaccurate. For example I would specify 240FPS but it would give me ~230FPS and when specifying some other rates it is also all over the place. This new one addresses those as well as keeping all the features of the old one.

Source (VB.NET):

Sunday, September 6, 2015

Transparent JPG

[Update 8] A new and improved version is out, located here:
TransparentJPG 2

[Update 7] TransparentJPG.Dll quality default is now 80 and smoothing default is now 20. Progressive mode for the JpegEncoder is enabled potentially resulting in smaller file sizes. TransparentJPG has an added parameter for subsampling detail level. Options are 0 low (Default), 1 (medium), 2 (High). 2TJPG.exe has the added parameter as well.

[Revert 1] Changed back to using the LibJpeg.Dll. Smoothing is available again. Updated source below as well as the TransparentJPG.zip download and Latest Builds. The source for the version that is not reliant on LibJpeg.Dll will still be provided for reference.

[UPDATE 6] Removed the dependency for the LibJpeg.Dll which means that smoothing feature which helped save some space is now gone :( . I did so because I was given a 6Kx4K image to convert to TJPG and the converter (2TJPG.exe) kept crashing. I debugged it and found that LibJpeg was the problem. I am guessing that lib doesn't support images with such large resolutions? Either way I had to address the issue so I went and resorted to using Microsoft's built in encoder. It is slightly faster now due to not implementing the smoothing feature but file sizes will be slightly larger. The TransparentJPG.zip below has also been updated and contains (2TJPG.exe, TJPGviewer.exe, TransparentJPG.Dll). So essentially encoding will be different but decoding stays the same. The converter has also been updated in that it no longer supports the "Smoothing" parameter.

[UPDATE 5] Changed the color of the background squares of TJPGviewer.exe to a lighter shade(Grey) as well as made them 3x3 instead of 4x4 making them look less obtrusive.

[UPDATE 4] Optimized the code for saving TJPGs as well as removed all dependencies to LockBitmap.Dll(Removed from package). Also removed the CType to Byte() since it seemed redundant to the Decode method. Also provided SRC to TransparentJPG.DLL below.

[UPDATE 3] Changed the default values for conversion tool to quality=75 and smoothing=25. Also added a Decode method in TransparentJPG.Dll to get the pixel data, width and height of TJPG file. Also cleaned up the LoadTJPG function so that it doesn't rely on the LockBitmap.Dll though other things still need it, I will get to them soon.

[UPDATE 2] Fixed an issue with the converter (2TJPG.exe) where it would error and crash when given file paths that are valid and saying they aren't. Fixed version is provided in the "Latest Builds" link below.

[UPDATE 1] Added averaging when applying the mask to make the other bits of the alpha "useful" as well as provide a bit of compensation for rounding errors that jpeg compression might have. This has no impact on the encoding and only the decoding so file sizes are not affected though there is technically an impact on the resulting image visually it isn't noticeable and so negligible.
Moved all newer builds to a new location so people can grab this independent of the package I provided below:
Latest Builds: https://www.mediafire.com/folder/o2r7is9fsb279/Latest_Build
TransparentJPG: https://www.mediafire.com/folder/kjqpmfazac24c/TransparentJPG

     While working on my game I needed a way to import images and in my game people can share these images among each other via P2P. These images are almost always going to be grouped with tens if not hundreds, if not thousands of other images so I needed to pick an image file that is small in size. My next requirement was that the images needed to have transparency as a capability. Jpeg while small in size isn't capable of transparency. PNG has transparency but is much larger in size due to it being a lossless format. Another requirement was it needed to be compatible, I needed to work with an already existing format that most computers already know how to use so it wouldn't add time and complexity over compatibility. There exists much better solutions today but they are all either proprietary or there are no libs for them in use for .net which I need.

     I first thought hey I'll just take the pixel data from an image and limit it to 6 bits per channel then compress the whole thing which gave rise to a format I called TZI. While TZI proved to be a more acceptable format to my game than PNG I thought why don't I try a lossy attempt.

     I looked at Jpeg and I already knew the complexity behind its compression so I wasn't going to mess with the inner workings of Jpeg. Instead I thought of a hack about way to add transparency as another level on top of Jpeg. I did this by simply creating a mask via the images Alpha channel. I then removed all transparency from the image. The mask was then appended under the original image (with the alpha turned off). What you get then is an image with no transparency on top and a greyscale image of the Alpha channel on the bottom. I couldn't stop there, people randomly running into this image and viewing it as a typical Jpeg would be confused and the image shown isn't even in its intended form. And so I had to change its header so that people don't mix it with Jpeg files (even though this is essentially what this is). To reconstruct the original intended image I made an application which views the TransparentJPG files.

     The image is loaded in memory. The alpha mask is applied and then the image is essentially cropped to half its height. There is actually more detailed aspects going on behind the scenes and the workings is a bit different from how I explained it but I figure just a gist of how it works is good enough and easier to understand.

Code (VB.Net):

Code-not LibJpeg.Dll reliant (VB.Net):

Converter and Viewer Tools: http://www.mediafire.com/download/2p3tkx4yty2d0ai/TransparentJPG.zip

Samples: https://www.mediafire.com/folder/n0p76oq8p1t0v/Samples

Now because of the added height as well as the transparency bit the images will never be smaller than their original non-transparent JPG version (with the same quality etc).

    Here is an exact representation of an image with its header unchanged after the mask has been generated:

    Intended Image:

    Here is another example of how the images are encoded without the header change:

    Intended Image:

Friday, August 14, 2015


[UPDATE 3] Removed the unnecessary function ClearBits() and its calls to result in >3x performance increase on adding bits (benchmark times updated).

[UPDATE 2] Changed out arithmetic operators for bit-wise operators as well as omitting the use of Math.Floor for a result of ~20 percent speed increase in setting bits (benchmark times updated).

[UPDATE 1] Fixed a bug where the 8th bit added is always set to True(1).

I previously made a class called TBitArray with the purpose of storing individual bits. At the time I didn't know that .Net already had a BitArray class which I could use so I made mine. I then thought well if I have an array I might as well make a list version as well. At the time I never got around to it. Then time passed and I started work on my encoding schemes. I needed to store bits that would resize as needed but I was lazy and instead stored each bit as a byte (yeah waste of space I know). This time I am working on a potential image format for my game. For this format everything is encoded and decode by bits and so again I needed something that would resize as needed. This time though I actually got to working on it. I know that one can resize the BitArray that is built into .Net but I did some benchmarks and well its VERY slow. So with speed and dynamic size in mind I set out to create a BitList class to make my life easier for this and potentially future projects. And I am sharing it here for those who may want to use it. I will provide the benchmarks first to show the difference. If anyone has any suggestions please leave a comment :)

As you can see BitList is much faster at adding bits when size is unknown and where size needs to be changed dynamically.
If you know exactly the number of bits needed please use the built in BitArray instead as you can see it is much faster at setting bits.

This class was made for my purpose of adding bits and not the constant manipulation of bits in memory. So if you need to constantly add bits this might be for you. The bit manipulation implemented is only for light use as it is slower than bit manipulation with BitArray, though slow it is still reasonably fast. Just use it where appropriate is all I'm saying.

Note: This class only implements the functionality that I myself needed, it does not provide other functionality that a typical List(Of T) has. If you need them you may implement them yourself or I might add this when my needs apply. I guess this is much closer the a queue then a list but too lazy to rename it lol. I could have also used a BitArray to store the lookup table but anyone who wants to do that is free to.

Code (VB.Net):

Saturday, August 8, 2015

Agar.io with keyboard support

So my little brother's friend found this 'mod' for Agar.io that allows one to play the game via the keyboard but he didn't know how to use it. I took a look and it linked to some survey site which automatically if anyone knew anything about these things online and running into surveys etc... its all crap. So instead I decided to make an app that allows one to play Agar.io with keyboard.

Download: http://www.mediafire.com/download/a36m97k2qaarmag/Agar.io_Key.exe

Info: made in .NET via VB. Uses E, S, D, F for movement, and R to enable/disable keyboard movement support (and shows/hides the mouse cursor).

Saturday, August 1, 2015

Cleaning up a Yamaha PSR-310 keyboard

So I recently got a used keyboard because I wanted to learn piano eventually. The one I got was very dirty and there were scratch marks, the keys were stiff as well as stuck, and the lowest C key didn't even work. I thought hey lets clean this up and thus started my overnight project (started at ~12:30AM).

First I had to disassemble the keyboard of course:

The thing was nasty inside:

Is that semen?

There was a bit of rust

So I got to sanding

The membrane was nasty as all hell, cleaned it with a dirty shirt, I think it has to go in the trash now

SOOOO much better :)

Rubber pads are nice and clean as well

Now to get to the keys

As you can see its pretty nasty on the outside too

Black keys are cleaned though still wet

Put the membrane back into the keypad frame

Placed the rubber pads on aswell

Now to address the original issue, Time for some lube

Lubed highest key and first key pair and assembled

Onto the second




Finally placed the key assembly back into the keyboard enclosure

Consequently the lowest C key now works AWESOME lol. Completed ~5:30 AM.

I used soap, bleach, and alcohol as cleaning solutions.
Cotton swabs for fine cleaning and lubricating.
Regret using toilet paper to clean, as well as using my dirty shirt.