TwitterFacebook

Create HTML5 template with C++ .

It’s a simple console C++ program that makes default html5 page with one table.

You can change the source code to create more template for your source code.


/* 
 * File:   main.cpp
 * Author: free-tutorials
 *
 * Created on May 20, 2013, 6:01 PM
 */

#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <fstream>
using namespace std;

int main(){

srand(time(NULL));
ofstream page("default-html5.html");
int rows, cols; int i,j;
int number=0;

cout<<"Input the number of rows:"<<endl; cin>>rows;
cout<<endl<<"Input the number of cols :"<<endl; cin>>cols;
page << " <!DOCTYPE HTML><html><head></head><body>";
page << " <html><html><head></head><body><table border='1' align='center'>";
for(i=0; i<rows; i++){
        page<<"<tr>";
for(j=0; j<cols; j++){
        page<<"<td>"<<number<<"</td>";
cout<<"Cell number"<<number<<endl;
number++;
}
}

page<<"</table></body></html>";

return 0;}

Best remote desktop apps for Windows 8

Remote desktop apps let you log on to your PC.

Read this article and you will see how it’s the best.

See now the list of this apps:

  • Remote Desktop
  • TeamViewer
  • Splashtop 2
  • PC Monitor
  • LogMeIn JoinMe

News about Windows 8.1

The release of Windows 8.1 will be a free download from the Microsoft App Store.

Known as Windows Blue will be available via downloadable preview on June 26th.

Microsoft says that it will divulge what users can expect in Windows 8.1 in the coming weeks.

Read more about this here.

Working with GLFW library under Fedora.

Today I will try to use GLFW library.

GLFW is a C library that lets you using an OpenGL context and window, display modes and inputs like keyboard, mouse, joystick and time.

GLFW supports Windows, Mac OS X and Unix, Linux and FreeBSD and any operating systems with the X Window System.

Also you can read more about this library here.

First install the library using root account.

# yum install libglfw-devel.i386

Now let’s see the source code.

First I includes all librarys I need.

/* 
 * File:   main.cpp
 * Author: free-tutorials.org
 *
 * Created on May 15, 2013, 2:54 PM
 */

#include <cstdlib>
// my c++ include headers 
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glfw.h>
using namespace std;

In the main function I start to see if the library is working.

int main() {
if( !glfwInit() )
{
    fprintf( stderr, "Failed to initialize GLFW Init \n" );
    return -1;
}

The next step is to set some settings, see:

// 4x antialiasing because I use NVIDIA FX5500
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); 

… and also testing the desktop settings.

// get infos about desktop 
GLFWvidmode desktop;
glfwGetDesktopMode( &#038;desktop );

The settings it’s show on console with cout function.

// show infos about your desktop
cout << "Width : " << desktop.Width << "\n";
cout << "Height : " << desktop.Height << "\n";
cout << "RedBits : " << desktop.RedBits << "\n";
cout << "GreenBits : " << desktop.GreenBits << "\n";
cout << "BlueBits : " << desktop.BlueBits << "\n";

Now I make the window context using fullscreen option.

if ( !glfwOpenWindow(
    desktop.Width,
    desktop.Height,
    desktop.RedBits,
    desktop.GreenBits,
    desktop.BlueBits,
    32,          // alpha bits
    32,         // depth bits
    0,          // stencil bits
    GLFW_FULLSCREEN
) ) {
    // error if failed 
}

I set the title of the window.

glfwSetWindowTitle( "opengl-shader test" );

I enable the keys.

glfwEnable( GLFW_STICKY_KEYS );

do{
    // draw something sexy 
 
    // Swap buffers need it 
    glfwSwapBuffers();
 
}

The next source code it’s close the window.

// When ESC key was pressed or the window was closed
while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS &#038;&#038;
glfwGetWindowParam( GLFW_OPENED ) );

}

Testing with time command to see how fast working.

$ time ./opengl-shader 
Width : 1280
Height : 1024
RedBits : 8
GreenBits : 8
BlueBits : 8

real	0m2.358s
user	0m0.341s
sys	0m1.240s

The netbeans IDE make the package in this path.

$cd /opengl-shader/dist/Debug/GNU-Linux-x86/package

I make RPM package for Fedora distro.

# rpm -ivh opengl-shader-1.0-1.i386.rpm 
Preparing...                ########################################### [100%]
   1:opengl-shader          ########################################### [100%]

I test my example and working well.

NASA migrates from Windows to Linux

According to article wrote by Lawrence Latif , N.A.S.A. will replace the Windows XP with Linux :

THE INTERNATIONAL SPACE STATION (ISS) will remove Microsoft Windows from its onboard laptops and run Linux exclusively.

The main reason can be :

…NASA has been using Linux on its missions for some time, including on its Mars Curosity rover, suggesting that the delay in shifting over to Linux on ISS was more to do with porting legacy applications from Windows.
Read more about this