Bastian Molkenthin - Sunshine2k

arrow News

2022/07/03

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.

I have been informed by a user about a fork of my CRC implementation in JavaScript that is now available as nodejs package, also with MIT license as my code, see here or here.


2022/06/07

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.


2022/04/14

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.


2022/01/01

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!


2021/12/23

Added a very minor update of my "Simple Test Environment" in C#.


2021/11/05

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


2021/10/28

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 :-)


2021/05/25

2021/05/19:
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.


2021/03/16

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!


2021/03/01

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 :-)


2020/11/29

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!


2020/10/06

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!


2020/08/24

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!


2020/05/25

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!


2020/02/01

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!


2019/12/17

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!


2019/10/05

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 !


2019/09/16

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!


2019/03/28

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.


2019/03/22

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.


2019/02/12

Enhanced my online CRC calculator by adding support for 64 bit CRC and binary string as input data!
Check it out here: Online CRC Calculator (Javascript)


2019/01/04

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 ;-).


2018/10/01

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!


2018/09/28

Updated my CRC article with little bug fixes and and extended description of reversed/reciprocal polynomials.
Link to article (Changelog)


2017/12/23

Updated the CRC implementation in C# to support 64bit CRC calculation - check it out here.
Because Javascript does not support 64 bit unsigned integers (it handles numbers in IEEE-754 double-precision (64 bit) which has less range than real 64bit unsigned numbers), I discarded the update of the online CRC calculator - this would mean too much effort, sorry for that!


2017/11/04

Added a demo how to multiply two unsigned 32 bit values using only 16bit multiplications, shifts and casts in C here.


2017/08/17

Added an visualization of the two-dimensional cross and dot product in Typescript here.


2017/07/14

Added an visualization and description on how to calculate the area of a simple polygon in Typescript here.

Btw, added an own section for Typescript(Javascript) to the site. As Java applets and Silverlight will not be supported by any browsers anymore, I guess that's the way to go to implement online visualization and demonstrations for upcoming articles.


2017/05/13

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.


2017/04/18

Added an article about implementing a fixed point number class and the main arithmetic operations.
Check out the article here: Understanding and implementing fixed point numbers. There you find also the links to the complete C# source code and an javascript based online playground for fixed point numbers.


2016/11/11

Updated my article about CRC calculation with some clarifications and added reverse table option to Online javascript CRC calculator.
Understanding and implementing CRC article
Online CRC Calculator (Javascript)


2016/10/08

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!


2016/08/12

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


2016/07/27

Fixed another bug in my Javascript-based CRC Online Calculator found by an attentive visitor! The byte values were expected to have exactly two digits after the "0x". That means that the CRC value of "0x01" and "0x0001" were not the same. This is hopefully fixed now :)
Online CRC Calculator (Javascript)


2016/07/09

Fixed another bug in my Javascript-based CRC Online Calculator found by an attentive visitor! When the input data was given as bytes, then the number of whitespaces had an influence on the result. E.g the CRC value of "0x31 0x32" and "0x31  0x32" (note the additional space character) were not the same. The fix now shall ignore all number and kinds of whitespace characters and take only the byte values into account.
Online CRC Calculator (Javascript)


2016/05/24

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.


2016/03/09

Caution: An attentive visitor found a bug in my Javascript-based CRC Online Calculator!
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!


2016/01/31

Added a new article about understanding and implementing Base64 encoding and decoding.
Check it out here!


2015/11/11

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.


2015/10/25

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.


2015/09/26

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!.


2015/05/30

Updated my Understanding CRC article with a new chapter about basic CRC math and common questions -> Read it now here!
Further, I have ported my Silverlight CRC calculator to Javascript! That's really nice, so check it out here: Online CRC Calculator (Javascript).


2015/03/27

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!


2015/02/25

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!


2014/11/29

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!


2014/09/12

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.


2014/08/29

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!


2014/05/07

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.


2014/02/14

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.


2013/12/26

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!


2013/09/26

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.


2013/08/12

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!


2013/04/27

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!


2013/02/14

Updated my HeaderIncludeTool to version 1.02 with some minor enhancements and bug fixes ;-) Check it here!


2012/12/29

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.]


2012/10/14

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!


2012/08/29

Just improved slightly my HeaderIncludeTool (version 1.01) - check it out!


2012/05/19

The article and applet on how to rasterize a triangle is finally finished - check it out!


2012/03/30

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!


2011/12/22

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!


2011/09/22

Added a short article about the rotation of a point around the x-, y- and z-axis. Check it out here! Enjoy!


2011/08/09

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!


2011/06/22

Two updates:
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!


2011/04/22

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!


2010/12/14

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!


2010/10/13

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!


2010/09/17

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 out!


2010/07/31

Coded my first crackme (finally). Nothing special - quite easy, but I think some beginners will definitely like it. Check it out here!


2010/07/18

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.


2010/06/08

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 ;-)


2010/04/14

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.


2010/03/07

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 site :-)



arrow News Archive


This site is part of Sunshine's Homepage