Sun, beer, volleyball, travel, bathing, swimming, longboarding, and of course… programming!
The applications is stand alone and can handle most images, although images with a lot of contrast seems to work the best. The current version works well, but I might want to tweak it at a later point to get be able to handle darker images better.
If you want to give it a try, you can find it at the GitHub Repo.
I have also got myself a longboard. It is much easier to start out with than I would have thought and it is so much fun! The thought is to use it as a means of transport, but at my current skill level I am most like better off simply walking.
After a couple months of moving, putting together IKEA furniture and reconfiguring servers and devices there is still one thing missing; a static IP. I am currently running OpenProject as my choice of project management tool. The challenge of using this is that it runs on Ruby, so it has to be hosted on one of my servers and these are placed in my apartment at the moment.
Normally, when having a static IP you would simply add a CNAME record for the IP and it would have been working as intended. At the moment this is unfortunately not the case. So how do we get around this?
In my case, only HTTP needs to be supported at the moment so the solution was making a simple PHP script handling the redirection. This stores the server IP on request and redirects everything else. It also handles subdirectories and GET requests correctly.
To use the script, create a folder with the desired name of your server(server1.your-domain.com) would be achieved by creating a folder named server1 in the root directory of your web host. Then all you have to do is extract the source in that directory and create a cron job on your server for updating the server IP. Remember to update your auth token in index.php.
Cron Job setup
Append the following content to your crontab:
Save and exit.
Manually update your server IP to your current public IP
Retrieve the server IP in a browser
Get your server IP in a terminal
$ echo Server ip is: $(curl -sL https://server1.your-domain.com/?action=get)
Get the code
You can download the source here: server-redirect.zip .
After some fooling around, I ended up with the following class for handling it. Although it requires your code not to crash, I found it very useful when handling exceptions and inspecting objects when I set up a new API recently.
The attached archive includes both the source and example usage of the script. So sum it up, what you need to get started is this:
As always, feel free to use it however you like.
I have been catching up on OpenGL 4.4 lately and realized that there are few working examples on the newer versions of OpenGL. The following code uses Assimp, GLFW and GLEW to load and render all supported Assimp formats and requires OpenGL 3.0 or above.
You will be required to set up an OpenGL context, I will presume that you have the knowledge to do that (if not, I can recommend this tutorial from opengl-tutorial.org).
To use the Mesh class, this is all that is required:
The combined source and example shaders can be downloaded at the bottom of this page.
As shown in the YouTube video in the post Fast collision detection in XNA, I made a quick way of doing near pixel perfect collision detection in XNA that does not get slowed down by rotating the object. This algorithm first checks the bounds of the object that scales based on the rotation of the content(as shown in Re-scaling a rectangle based on the rotation of it’s content), before checking for line intersection (see Determining if two lines intersect).
The whole idea is to generate lines around the object as this is much faster then checking pixel by pixel and can easily be rotated as they only consist of two points. This is done only once when first loading the image.
Once the outlining has been traced, we generate lines between them to give us the approximate outlining. In this case 5 segments has been used to better illustrate what is being done. The mesh we end up with should look something like the following.
subscribe via RSS