Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Wednesday, July 19, 2017

Browse the web in 3D with WRoom

I've been quiet for a while as this is summer time and I have also been working on a new idea:  a 3D web browser.

This idea is not quite new as I've been thinking about this for a few years.  In the last few weeks, I did some testing and finally found a way to do it.  The main goal was to make it easy to create a virtual space without having to learn HTML and advance Javascripting.  Then I had an epiphany:  Forget about using Chrome, Edge or Firefox and just create something completely new.

WRoom was born, late at night, on a cheap Windows 10 tablet.  It's a big experiment, but it's fun to learn new stuff while making it.



Currently, only binaries are available at http://crombz.com/wroom for testing the concept online.  You can test WRoom on your computer by downloading the WebRoom.jar file.  Java 8 Runtime must be installed as you guessed it, it's a Java+JavaFX application.

Download the JAR and execute it (double-click on the file).  You'll be presented a basic browser interface with the default URL already entered.  At the time of writing this post, the only room that is available is at http://crombz.com/wroom... ;)

Current features supported:
- 3D virtual room rendering Doom-Style
- Overlays on the walls (Text, HTML, images)
- Custom textures of 256x256 (images are resized automatically)
- Web links (to display external websites)
- Embeded videos
- Background sound playback
- Actions: sound, doors, messages
- Teleporting point to other WRooms

Everything has been developped with Netbeans under Windows 10.

Ubuntu is able to run WRooms, but video playback do not seems to work, even with the JRE from Oracle...  This is a JavaFX issue and my be resolved in a near future.

Here's a demo of the version 0.0.5:


Try it and leave your comments here or on Twitter: https://twitter.com/patrickballeux

Sunday, March 15, 2015

PHP: Lower the Entry Process for your website

If you have a website that is using PHP on the server side, you may be struggling with the Entry Process reaching the top limit of your web host.

What is an Entry Process?  Basically, it means that a process is launched on your web server host each time a page is requested.  If you have a lot of traffic, this means that at some point, you may reach the Entry Process Limits imposed by your web host and your visitor will get a message that too many resources are being used.

This is really annoying but there is not much that you can do about it if you are hosting static html page.  On the other hand, this issue can be triggered by your dynamic web pages and can be improved by tweaking the rendered code to be faster.


If you are using PHP, as a lot of web developers are doing, you may have a webpage that does look like this:
<?php $title = "Crombz.com - The best website!";?>
<html>
<head>
<title><?php echo $title; ?></title>
</head>
<body>
   Hello, this is my webpage and the title is <?php echo $title; ?>
</body>
</html>
This is a regular case where you will embed in the HTML code some part of PHP code.  It does work nicely but has a major drawback:  The page will be rendered a bit slower than a pure HTML page.

Since a PHP webpage takes a bit more time to be served by your host, you do increase the chance of  reaching the Entry Process Limits if you have a lot of traffic.  Assuming that you are limited to 10 Entry Processes at the same time, if the time to render your PHP page takes 0.2 seconds, you will have a maximum of 5 visitors being able to view your page at the same time.

I have struggled this week with this issue on my website Crombz.com.   After reviewing the code, I realized that PHP had to parse a mix of HTML and PHP to be able to render the page properly.  After some experimenting and tweaking, I modified my code like this:

<?php
    $title = "Crombz.com - The best website!";
?>

<html>
<head>

<?php
    echo '<title>'.$title.'</title>';
?>

</head>
<body>

<?php
   echo 'Hello, this is my webpage and the title is .$title;
?>

</body>
</html>
I made sure that a single line was either a pure HTML code or a pure PHP code...  It has lowered the rendering time so much that even with 30 visitors, I am not reaching the Entry Process Limit of my web host.

Of course, your code will be a bit more complex but the benefits are that you will lower the chance of reaching the Entry Process Limits even with a high traffic.

I haven't tested rendering a webpage in pure PHP, but it would probably be faster than having mixed lines of HTML and PHP.

Happy coding!