Updated the Understanding and implementing CRC article with a new chapter (7.4) describing how to calculate a CRC with an arbitraty width (size of polynomial), e.g. CRC-5 or CRC-11.
Also the CRC implementation in C# is updated to support CRC calculation for all CRC sizes in range [1, 64]. Check out the new version 4 of the C# CRC library here.
Added a new article about the implementation of a JSON parser from scratch. Ever wanted to write a simple parser?
Then read the article directly here: A practical approach to write a simple JSON parser yourself .
And do not miss the source code and demo application here: JSON parser library source and demo applications.
I wish you all merry christmas and a happy new year 2023!
Here some smaller updates.
Update of the Generic Tokenizer to version 1.0.1.
Changes: Added GetCurrentToken() to AbstractTokenizer() to provide a method to get the current token without comsuming it.
Update of my Simple Test Environment approach to version 1.0.2.
Changes: Added AssertEqualEnum(), AssertNotEqualEnum() and AssertException() methods.
Based on some user feedback, some typos in my ELF viewer console has been fixed and a new version 1.0.1 has been released.
Further, there are some small updates in the Understanding and implementing fixed point numbers article, mainly the improved description of SUNFP_ONE constant.
Also the Pan & Zoom demo playground article has been updated by several improvements.
Added a demo implementation of panning and zooming.
The demo constructs a global 2D world that is far larger than the window for display, so only a cutout (called "view port") of the global space is visible. The view port can be move around the world (called panning) and the size of the view port can be increated and decreased (called scaling or zooming).
The math behind is not difficult, but while implementing it the first time, it still took some time to get it correct. That's why I decided to create this little playground for myself - maybe it's interesting also for you.
Check it out here: Pan & Zoom demo playground.
Read some notes about the implementation and the math behing here: Pan & Zoom implementation notes.
Added a new article about the different possibilities how to represent a 2D line mathematically.
Read the article directly here: 2D line representations.
Or have a look at the article section in general here.
While writing the article, I noticed that some interactive playground would be quite useful and interesting, so I implemented a little online example in Typescript which allows the definition of a 2D line and provides all different mathematical line equations of the line.
Check it out here: 2D line representation playground.
Added a new article about writing a simple generic tokenizer. It comes along with my own implementation of a generic, versatile tokenizer that can be used as base for development of own tokenizers and parsers in C#. The complete source of this library as well as several demo applications are also available. Maybe it's a nice starting point to write an own tokenizer.
Read the article here: Writing a simple generic tokenizer article.
Or directly head to the source code and binaries of the libary and demo applications: Generic Tokenizer in C# .
I wish you all a happy and healthful new year 2022!
Added a very minor update of my "Simple Test Environment" in C#.
Added my own simplistic solution how to implement a basic unit test environment in C#.
It was implemented it in a very short time on some rainy evening, just for fun and targeted for my personal usage. Actually I have implemented the same functionality several times in the last few years now for some of my C# coding projects and was really tired of it.
Of course, I could have used NUnit or any other of the million (much more sophisticated, better, faster, more usable, more comprehensive, ...) frameworks, but I did not want any dependency to a foreign framework. So here you have the result of my minimalistic approach.
Go to it and download it here
I have restructured and cleaned up the site in general.
The menu on the left has an updated structure. Also on mobile devices, the site should look now a bit better. Internally, much of the html and CSS was cleaned up and refactored.
So the maintenance should be easier for me now - with the goal to have more updates on the site. I am working on a few small projects, let's see when I can release the first one :-)
Added the third part of the series of graphical effects: This time it's a text scrolling effect where the text slowly fades out and which has a perspective effect to create the illusion that the text also moves 'into" the screen..
Enjoy it here!
2021/05/25 - Update:
Updated the text scrolling effect demo which was added last week by a third implementation variant using texture mapping.
Added an article about the reflection of a vector at a plane.
An implementation example in Typescript visualizes the algorithm while the corresponding article provides a detailed mathematical derivation and description of the formula.
Enjoy it here!
Added my own sample implementation of Vector and Matrix classes for 2D and 3D in C#, along with tests for all provided functions.
It served me as my own playground to understand certain aspects of the common vector and matrix operations much better, so I decided to release the implementation together with the test application.
Check it out here!
May it be helpful also to you... and maybe I will enhance it somewhen with the 4D parts :-)
Added the second part of the series of graphical effects I ever wanted to code myself - just for fun: This time it's a moving star field simulation using 3D particles featuring the effect of a 'hyper space jump'.
Check it out here!
So finally I found some time to deal again with some graphics algorithm: This time it's about the projection steps in a 3D engine to transform camera coordinates to perspective coordinates and finally to screen coordinates.
At first, there is a theorical article explaining the derivation of the formulas and the mathematics behind - Check out the article section here! [Direct link here!]
Furthermore, I coded a simple C# demo application to get a deeper understanding of the projection pipeline process and which allows to modify parameters on the fly. Check out the demo visualization here!
Added a new article about understanding and implementing an own simple big (unsigned) integer library. It explains in an easy way how to store arbitrary precision numbers and how to implement the most important arithmetic operations. If this sounds interesting for you, go and read it online here! [Direct link here!]
Along with the artice, I have implemented several variants of the big unsigned integer library together with a small command line test application that is of course freely available with the complete source code.
Check out the big integer library demo and source here!
Somewhen around 2014/2015, I started coding a simple raycasting demo in C#. Raycasting is rendering technique to create a 3D view of a 2D map and can be seen as the most basic form of raytracing.
However, even after restarting a second time, I was never really satisfied with the result and somewhen lose interest.
Now, after lying around on my hard drive for around five years in which I was never again motivated to continue development, I release "it as it is".
You find it under following link - Check the Raycasting Demo V1 in C# out here!
Added the first part of a series of graphical effects and algorithms that I ever wanted to dive into myself. At least I hope that it will be a series and not only a one-time update!
I have chosen Typescript using the HTML5 canvas element as it promises to me fast development and good basic functionality for the things I want to implement. Further I hope for long support in browsers so that they can be viewed in future (unfortunately Java applets are completely dead in the mean time...)
It won't be super complex projects, so I do not plan to add articles along with series. I just wanted to code some simple graphic effects myself (I have a long list!) just for fun in my spare time without needing to incorporate myself into a topic for days or weeks... It shall be fun!
The first part is a fireworks simulation using 2D particles - Check it out here!
Implemented an algorithm in Typescript to calculate the intersection point of two line (segments) in 2D. Comes with a detailed description of the algorithm that uses some vector analysis in parametric form and the perp dot product.
--> Check it out!
Beside this, I created an article about the two-dimensional perp dot product, explaining its definition, properties, relation to the dot product and cross product as well as its geometric interpretation.
--> Be sure to check it out!
I wish you all a merry christmas and a happy new year 2020!
Added a new article about two different example implementations of the C dynamic memory allocation functions, explaining the algorithms and my sample implementation in detail. If you ever wanted to know how they could be implemented -> check out the article right now here!
Of course, the C source code of these implementations with a test application implementing various test cases is free available -> check it out here !
Added an example how to access the serial (Com) port using Windows API in C. Provides a simple component to open, read/receive and write/transmit (synchronnously and asynchronously) to the COM port along with a simple demo application. If you begin yourself getting hands on serial port access in plain Windows, that's a good point to start and play around!
Check it directly out here!
Added an option to the Online ELF viewer to view the section header table, program header table and symbol table in compact mode.
Check it directly out here!
The source code of implementation in Typescript is of course also available here.
Corrected following point in my article Understanding and implementing CRC article:
In the reciprocal CRC model, the final XOR value must not be reflected, contrary to my previous statement. Note that in the source code, this was already correctly implemented.
Enhanced my online CRC calculator by adding support for 64 bit CRC and binary string as input data!
Added an online ELF viewer to investigate ELF files (ELF header, section header table, program header table, symbol tables and note tables) in a browser - Check it directly out here!
The source code of implementation in Typescript is of course also available here.
Removed my guestbook as the provider went down. Let's see if I'll add a new one ;-).
Added a tool: ELF viewer console.
Simple console application coded in C# to read the most important information from 32/64 bit ELF files. Supports ELF header, section header table, program header table, symbol tables and note table.
Check it out here!
Updated my CRC article with little bug fixes and and extended description of reversed/reciprocal polynomials.
Link to article (Changelog)
Updated the CRC implementation in C# to support 64bit CRC calculation - check it out here.
Added a demo how to multiply two unsigned 32 bit values using only 16bit multiplications, shifts and casts in C here.
Added an visualization of the two-dimensional cross and dot product in Typescript here.
Added an visualization and description on how to calculate the area of a simple polygon in Typescript here.
Added an mathematical article about the derivation of the two-dimensional dot product and its geometric interpretation.
Check out the article here: Derivation of the dot product in R2.
Added an article about implementing a fixed point number class and the main arithmetic operations.
Understanding and implementing CRC article
Added a new article about generating all possible permutations of a given set. Presents three different algorithms with examples. Implementation with source code of eight different algorithms in total available for download.
Check it out here!
Added a little demo how to use the TaskbarList3 interface using plain Windows API in C/C++ to set the progress info on the taskbar, handle taskbar buttons or set an overlay info. This should serve as a good starting point for everybody how wants to modify the taskbar of its application this way.
Windows TaskbarProgress Example
Another small issue found by an attentive visitor: In the article 'Software Rasterization Algorithms for Filling Triangles' inside the function fillTopFlatTriangle(), the new scanline was calculated after the call to draw it - this is not perfectly correct for very narrow triangles (the order was correct in fillBottomFlatTriangle() though). Fixed in the article and in the source code archive.
In several cases, a zero inside the result CRC is missing, thus e.g. the printed result was 0xC6FF2F8 instead of the correct one 0xC6FF02F8. Note that the Silverlight variant is not affected!
Root cause was a bug in the conversion from the numerical CRC value to the printed result string. This is fixed with this update - sorry for any inconvenience caused!
Added a new article about understanding and implementing Base64 encoding and decoding.
Check it out here!
Fixed a bug in my recursive parser algorithm reported by a user. The handling of plus and minus operator had an incorrect order. Updated the article and also the linked source code.
Added licensing information to my site. All content of this site is now licensed under the MIT license.
Still I'm always interested about you - the visitors. So if you (re)use content of my web site -> feel free to drop me a line about who you are and for which project you use it. I would be pleased.
Updated the article about parsing algorithms for mathematical expressions. Hopefully the chapter about the creation of a syntax tree directly from the normal infix expression is more clear now. Check it out here!
Also the guestbook is fixed and works again - so leave some comments!.
Updated my Understanding CRC article with a new chapter about basic CRC math and common questions -> Read it now here!
Well, actually I started to continue the development of SunPEView (I have so many ideas!). However, I noticed that the completion of the next version would would take forever because I have too less time.So after some hours I decided to stop...
... and to release the current development state as version 0.7.1.0
... and to release the complete source code as free download! (Be aware that it's not cleaned up but just zipped as it is ;-)
Hopefully some of you find it interesting and maybe it extends your knowledge. Drop my a line if you reuse parts of it! Maybe in future I will come back to it and proceed its development again...
-> Get the source code here!
New article about understanding and implementing various CRC (Cyclic Redundancy Check) algorithms. Explains the basic idea of CRC and evolves step by step different algorithms and discusses their implementations. You think that's awesome?
-> Read it now here!
Additionally, an online CRC calculator is available as Silverlight application: Check it out here!
New article about three different (self-developed) algorithms to calculate the difference of dates in days. Read it now here!
Additionally, try them out online as Silverlight application to get the difference of dates: Check it out here!
After having tried out Perl, I checked out something new again - this time Silverlight! My first impression is quite good: I can use C# as language, there is a pretty good development environment for free (Microsoft Visual Web Developer Express), the GUI can easily be created using a visual designer and the applications run easily in a browser - without security issues (at least for now) compared to Java applets. So if you're interested, give it a try - it's worth to check it out.
My first silverlight application is a demonstration of my implementations of various (perfect) maze generation algorithms: Depth First Search (Recursive and Iterative), Hunt and Kill as well as Eller's algorithm. The size of the maze and well the starting cell is configurable. Also the mazes are not generated instantly but there is also a step-by-step generation possible to visualize the working of the algorithms. Curious?
Check out my Maze Generator in Sliverlight here!
Update 2014-09-17: Moved silverlight to its own site.
Added a new fancy tool called WindowsUpTimes. It's a little console application which shows the start and shutdown times of Windows. Technically it uses the EventLog API to access the system event log to extract this information. Actually no big deal, but I just needed such a tool for myself and just wanted to share it :)
Check it out here!
I have done my first steps in ... Perl!
As first exercise I ported 'My Simple Playlist Generator' written in C# to a Perl commandline tool. Interested? Look here: Look here.
Released version 0.7.0.0 of my PE Viewer tool SunPEView!
Extended support of resource directory (e.g. show save bitmaps, cursors and icons to file, but also many more); support for Base Relocations, Exception and TLS directory. Fixed some bugs, better error handling and many more...
Look here: SunPEView.
Added a new article (with Java applet and source) about the relation of a given point to a given line in the two-dimension case. It contains algorithms how to detect if the point is on the given line, if it's one the line segment or if the projected point onto the line is on the line segment. Pretty interesting, isn't it?
Check it out: Point on Line algorithm article.
I wish everyone a happy new year 2014!
Released the first (alpha!) version of my new PE Viewer tool SunPEView! Currently it's only version 0.6.0 and unstable, but is more or less working. Try it out and stay tuned for updates! Look here: SunPEView.
Furthermore, I have noticed that all of my applets were not be able to be executed in newer FireFox versions due to more stright security settings. I have now signed all applets so that you get a warning during loading, but at least you can exeucte them at all. Note that I did not update any zip files, so when downloading the archives for offline use, they will be most probably not being exeutable in Firefox, unless you lower your Java settings in the Java console.
Fixed two typos in articles:
In the rotation derivation article, changed x-z-plane to x-y-plane in the last chapter. Second, the wrong derivation x4 = x1 + ((y2 - y1) / (y3 - y1)) * (x3 - y1) in the triangle rasterization article was corrected to x4 = x1 + ((y2 - y1) / (y3 - y1)) * (x3 - x1). Thanks to the two reporters for pointing them out!
After many years I have written a new RCE article... Yes, you read right, no joke! I felt it's time to dive into PE files again - because reversing is fun!
It's about to insert a messagebox at the entrypoint of a .NET PE file the hard way - using a hex editor. (Sounds familar to you? ... it's actually the same as the original 2002 tutorial for standard PE files, just for a .NET file).
On the way to our goal some parts of the .NET file structure are discussed and analyzed....
Sounds interesting -> check it out now!
Updated my HeaderIncludeTool to version 1.02 with some minor enhancements and bug fixes ;-) Check it here!
Added a new article along with an applet (and source code) about the hough transform to detect lines in image.
Check it here!
Enjoy it and a happy new year!
[Actually the package was released on 28th, but updated today. So if you already got the package yesterday, please download it again - a small bug was fixed.]
Well finally I updated my website layout! Well, maybe you think now 'Hm looks the same as before, doesn't it?'
This is correct, also no additional content was added, but I have thought of internally cleaning up my site for some time and finally I have pushed myself to do it. Biggest change is probably the fact that I switched from a frame-based website to an CSS-style website! Also the structure was tighted up, dead links removed and so on... Be aware of the fact that older links might not work anymore because the directory structure was also improved.
Hope you like the renovation of my site and stay tuned for updates!
Just improved slightly my HeaderIncludeTool (version 1.01) - check it out!
The article and applet on how to rasterize a triangle is finally finished - check it out!
Added a little C# tool 'HeaderIncludeTool'.
It parses C source files in order to build a header include dependeny tree. Might be useful if you want to find a cycle in your include hierarchy. Can run as wizard-like GUI application as well as console app. Of course, source is available...
Curious? Check it out here!
Finally I finished the article about testing if a point is inside a given triangle featuring two different algorithms: One algorithm uses the so-called perp-Dot-Product to check the point againt the three edges of the triangle. The second one uses barycentric coordinates for triangle representation and evaluates the final equations using Cramer's Rule.
Check out article, applet and source!
I wish all my visitors Merry Christmans and a Happy New Year!
Added a short article about the rotation of a point around the x-, y- and z-axis. Check it out here! Enjoy!
After my beloved Nokia 3200 finally broke down after 7 years of permanent use (having only the second battery which has been still been in perfect quality), I had to get a new one and came up with a Nokia C2-01. Yes it's not a smartphone (of whcih I am NOT a fan of), but a simple-to-use old-school mobile phone and I am completely satisfied with it.
Nevertheless, I use this of an occasion to continue with J2ME coding. I remembered that I had a lot of fun coding the three games for my phone back in 2k4. The C2-01 has more processing power and also supports a newer MIDP/CDLC version so I decided to code even better games. I know it will take some of my limited time, but hey.... it's fun!
As first project (to set up my development environment and refresh my knowledge about midlets), I just hacked a small midlet to read the properties (like size of the screen, supported MIDP version etc.) of my mobile phone. Well, I think it's quite useful so.... here it is!
First I fixed some bugs in my SearchStr tool (which I personally use quite often) and also improved the commandline arguments. Go and get version 1.1!
Second the final version of my StoneBreak game is released. More levels, more special effects, less bugs, designed for different resolutions, a level editor for offline gaming and ... for everything the source code is available! Awesome? Right! Check it out now!
Ops, the durations without any updates grow and grow... Sorry for that! You know, spare time is short and valuable. But finally I started a new game that I always wanted to code myself - a little breakout clone which I called Stonebreak. I chose Java as language to make use of the Graphics2D class - and although it's not finished yet, it looks quite nice and makes fun. Go and check out the first version yourself!
After some time I was really motivated and had fun to code a
cool graphics algorithm again. Well, the choice was made and the
result is my implementation of the famous Bresenham algorithm for
rasterising lines, circles and ellipses. I hope you like it and
learn something from the applet and my code - so go check it out.
Moreover, I did some little changes (e.g. deleted some old links) and I noticed that nobody leaves a message in my guestbook - so if you like my site, articles and/or sources, drop me some lines. I would really like it. Keep on coding!
By the way, this reminds me of something: in the last time several visitors pointed me to several broken links on my site - thanks a lot to those and I am always pleased to get informed about non-working files on my site!
Finally I finished a piece of code and the belonging article at
which I have worked really some time. At the time I
developed my Online
Calculator I though about other approaches how to parse and
evaluate mathematical expressions. While I stuck at that time at
the recursive (and easiest) approach, I have implemented now other
algorithms. The result is the article describing the a) recursive
approach b) postfix and stack approach and finally c) syntax tree
creation from infix notation. Have fun while reading!
Hi folks, today I publish a little commandline (which I coded
for myself) to search for strings in files or directories. Turned
out to be quite handy sometimes. Of course the C source is also
available. Check it
Coded my first crackme (finally). Nothing special - quite easy,
but I think some beginners will definitely like it. Check it out
First of all, I fixed a lot of broken links. Many zip files were stored on another server (a free one) than the actual site, but this one was closed down - now everything should work now.
Second, a guy named Gergely found a bug in my polygon filling
implementation - look at this screenshot. The problem were horizontal
lines - in that case the endpoints were not correctly handled.
Fixed that problem - thanks for the hint.
Finally I managed to update my study site with information about my diploma
thesis... although I finished my thesis nearly one and a half year
ago! Shame on me! Good things come to those who wait
Probably some of you have heard about the so-called Birthday
Paradox or Birthday Problem. I personally find it quite interesting
(with a surprising result) and decided to summarize my own notes
and thoughts. I do not only present the probablity calculation, but
also tried to give some logical notes. In fact, it is quite
difficult to explain this problem to others cause there is very
similar question (with a different solution) with which it is easy
to get mixed up.
So I hope you like it - click here to get to the Birthday Paradox Article.
So folks, I found some time for coding and implemented the 14-15 Puzzle as a Java applet. Of course, you can play it online yourself, but I think more interesting is the automatic solver which solves a puzzle instance in front of your eyes step-by-step! Moreover, you can generate random puzzles using two different algortihms and check if they are solvable or not. Curiuos? Check it out here including my notes about the theory of the 14-15 puzzle.
Mr.reCoder advised me of some really nasty mistake. The
readme.txt file I have been including in every download archive on
my site for several years - well it contains a nasty spelling error
*shame on me* : Of course, the URL to my site is www.sunshine2k.de
and NOT www.sunhine2k.de (not the missing 's')! I am too lazy to
correct this in every zip archive, but I have corrected it for
future releases. Please keep that in mind or better - bookmark my
This site is part of Sunshine's Homepage