Skip to content

MacLin : A technologic revolution

A blog of someone addicted to technology

Archive

Category: Software

The Java programming language is what most are calling “the new COBOL“, many companies have adopted it in their intranet, DB communication infrastructure and internal system such as employee management and payroll. It’s used have widely spread over the last few years and many school are making it their “default choice” for teaching programming principe and Object Oriented concept.

One domain among which Java is not widely spread is the embedded device market. Yes, I know that many applications can be developped for a smartphone and that the Squawk Virtual Machine is meant to be used on very small electronic devices. I also know that some Java specification are written and implemented for the real-time/embedded world, this article is very complete and interesting on the global subject of critical embedded application and Java. But when it comes to an experimented embedded developer to develop in Java, it may become extremely difficult by the simple fact that Java doesn’t have a simple way to do direct bit manipulation. An habit many embedded developer are used to…

My friend J-F Im, which happen to be one of my ex-team mate in the SONIA project, may have found a good way to reduce the hassle for embedded developer to adopt and use Java without losing their habit of using bits manipulation. He created a library called BitIO, bringing easy bit manipulation to the Java language. I did not try it and I must admit that its bean a while now that I’ve program something in Java since many of the work I have to do at Novariant is either related to a Linux driver (coded in C) or to the C++ application that run in Novariant’s ParaDyme embedded computer. But, knowing J-F Im, I’m pretty sure that the library he developed can be useful to a lot of peoples.

An earthquake is never something that is fun to live, it’s even more true for the people in Haïti right now. Every media is talking about it and even if it’s really a sad thing, I strongly believe it would be a good idea to move on… BUT, it certainly is a good thing to get our little internal voice to tell us that there is peoples with a worse day than the one we just had at work…. I wish the best to every people in Haïti and hope that everyone will stand for each other, instead of killing their neighbor as a desperate move for survival. A group is always stronger than an individual.

Now, lets move on to the main subject of this post. It was showed to me by a colleague today, he saw it on Cyberpresse.ca… that took it from CNN… that use the technology of Immersive Media.

Wikipedia have a description of the technology that is surely better than what I could summarize here, so why not simply quote them :

An immersive video is basically a video recording of a real world scene, where the view in every direction is recorded at the same time. During playback the viewer has control of the viewing direction, up down & sideways. Generally the only area that can’t be viewed is the view toward the camera support. The material is recorded as data which when played back through a software player allows the user control of the viewing direction and playback speed. The player control is typically via a mouse or other sensing device and the playback view is typically 4:3 window on a computer display or projection screen or other presentation device such as a head mounted display.

It’s an interesting technology, the video are interactive and let you see what you want while the video is still running !! Awesome !

Here is a video of what it looks like:

Seeing this today remembered me of a night passed at the SONIA lab with my friend J-F Im where he was trying to do stereoscopic vision with 2 development webcams … Awwwwh so good memories!

After having created the code for my last post, I began to search a way to improve it. In the version previously posted, I used a “double” and at the 1024th loop my Macbook is showing me an “inf” instead of a numerical value… which means that I have overflowed the value of a double. I then tried different thing, my goal was to get the “infinite” as far as possible. After some reflexion I decided to use the biggest value for Integer Unit and then Floating Point Unit. Using an “unsigned long long” I realized that the value would never become “infinite” but would stay constant at “18446744073709551615″ after the 63th execution loop. Using a “long double” I’ve been able to get the “infinite” to appear only after the 16383th execution loop with a value of “6E+4931″.

This bring me the interest of knowing the limits for the different types on my Macbook Pro. I search a bit on the net and found a simple piece of C code from “Alberto Bertogli” that simply display all the informations I was interested in.

max value of char: 127
min value of char: -128
max value of int: 2147483647
min value of int: -2147483648
max value of long: 2147483647
min value of long: -2147483648
min value of long long: -9223372036854775808
max value of long long: 9223372036854775807
max value of unsigned long long: 18446744073709551615
max value of signed char: 127
min value of signed char: -128
max value of short: 32767
min value of short: -32768
max value of unsigned char: 255
max value of unsigned int: 4294967295
max value of unsigned long 4294967295
max value of unsigned short: 65535
max value of double: 1.797693e+308
min value of double: 2.225074e-308
max value of double 10 exp: 308
min value of double 10 exp: -307
max value of long double: 1.18973e+4932
min value of long double: 3.3621e-4932
max value of long double 10 exp: 4932
min value of long double 10 exp: -4931
max value of float: 3.40282e+38
min value of float: 1.17549e-38
max value of float 10 exp: 38
min value of float 10 exp: -37
——————————————————-
sizeof char: 1
sizeof short: 2
sizeof int: 4
sizeof long: 4
sizeof long long: 8
sizeof double: 8
sizeof long double: 16
sizeof float: 4
——————————————————-
sizeof off_t: 8
sizeof size_t: 4
sizeof ssize_t: 4
name max: 255
path max: 1024

By executing this code I realized that the previously obtained “18446744073709551615″ was the maximum value of an “unsigned long long”. I then though that “6E+4931″ would be the maximum value of a “long double” but I was wrong, the limits for a “long double” is “10^4932″ and it’s easy to understand why I get the “infinite” after getting “6E+4931″ because by doing a multiplication by 2 and adding one (thats what the love code do) you get over the limit of a “long double” so … you get the “infinite”.


/*
 * limits.c
 * Alberto Bertogli (albertogli@telpin.com.ar)
 * 22/Oct/2002
 *
 * Shows the limits of data types.
 *
 * Try compiling it with "gcc -std=c99 limits.c -o limits"
 */

#include <stdio.h>
#include <limits.h>
#include <stdint.h>
#include <float.h>
#include <fcntl.h>
#include <sys/param.h>	/* for PATH_MAX and NAME_MAX */

int main(void) {
	printf("max value of char: %d\n", CHAR_MAX);
	printf("min value of char: %d\n", CHAR_MIN);

	printf("max value of int: %d\n", INT_MAX);
	printf("min value of int: %d\n", INT_MIN);

	printf("max value of long: %ld\n", LONG_MAX);
	printf("min value of long: %ld\n", LONG_MIN);

#ifdef LLONG_MIN
	printf("min value of long long: %lld\n", LLONG_MIN);
	printf("max value of long long: %lld\n", LLONG_MAX);
	printf("max value of unsigned long long: %llu\n", ULLONG_MAX);
#else
	printf("long long limits unavailable (compile with -std=c99)\n");
#endif

	printf("max value of signed char: %d\n", SCHAR_MAX);
	printf("min value of signed char: %d\n", SCHAR_MIN);

	printf("max value of short: %d\n", SHRT_MAX);
	printf("min value of short: %d\n", SHRT_MIN);

	printf("max value of unsigned char: %u\n", UCHAR_MAX);
	printf("max value of unsigned int: %u\n", UINT_MAX);
	printf("max value of unsigned long %lu\n", ULONG_MAX);
	printf("max value of unsigned short: %u\n", USHRT_MAX);

	printf("max value of double: %e\n", DBL_MAX);
	printf("min value of double: %e\n", DBL_MIN);

	printf("max value of double 10 exp: %i\n", DBL_MAX_10_EXP);
	printf("min value of double 10 exp: %i\n", DBL_MIN_10_EXP);

	printf("max value of long double: %Lg\n", LDBL_MAX);
	printf("min value of long double: %Lg\n", LDBL_MIN);

	printf("max value of long double 10 exp: %i\n", LDBL_MAX_10_EXP);
	printf("min value of long double 10 exp: %i\n", LDBL_MIN_10_EXP);

	printf("max value of float: %g\n", FLT_MAX);
	printf("min value of float: %g\n", FLT_MIN);

	printf("max value of float 10 exp: %i\n", FLT_MAX_10_EXP);
	printf("min value of float 10 exp: %i\n", FLT_MIN_10_EXP);

	printf("-------------------------------------------------------\n");

	printf("sizeof char: %d\n", sizeof(char));
	printf("sizeof short: %d\n", sizeof(short));
	printf("sizeof int: %d\n", sizeof(int));
	printf("sizeof long: %d\n", sizeof(long));
	printf("sizeof long long: %d\n", sizeof(long long));
	printf("sizeof double: %d\n", sizeof(double));
	printf("sizeof long double: %d\n", sizeof(long double));
	printf("sizeof float: %d\n", sizeof(float));

	printf("-------------------------------------------------------\n");

	printf("sizeof off_t: %d\n", sizeof(off_t));
	printf("sizeof size_t: %d\n", sizeof(size_t));
	printf("sizeof ssize_t: %d\n", sizeof(ssize_t));
	printf("name max: %d\n", NAME_MAX);
	printf("path max: %d\n", PATH_MAX);

	return 0;

}
#include <iostream>
#define END_OF_LIFE 74*365    // 74 years in days
							  // Accordingly to the Deathclock I'll die at 74

int main (int argc, char * const argv[]) {

	int dayPassedTogether;
	long double love = 1;

	for(dayPassedTogether = 1; dayPassedTogether <= END_OF_LIFE; dayPassedTogether++) {
		printf("Each day my love for you is incremented : %0.LE\n",love);
		love += love;
		love++;
	}

    return 0;
}

With all the Valentine’s Day and love floating around me these day, I felt like expressing it in all my geekiness. So, tonight I wrote a simple C++ code to express how I feel about a very special someone.

Damn theme … I don’t know how to make code appear correctly … I mean with proper indentation!

EDIT: Haaaa… I found a very nice wordpress plugin to help me :)

#include <iostream>

#define END_OF_LIFE 80*365    // 80 years in days

int main (int argc, char * const argv[]) {

	int dayPassedTogether;
	double love = 1;

	for(dayPassedTogether = 1; dayPassedTogether <= END_OF_LIFE; dayPassedTogether++) {
		printf("Each day my love for you is incremented : %0.f\n",love);
		love += love;
		love++;
	}

    return 0;
}

Yeah, I know… a strange title, but I could not find something better and it remembered me of François Pérusse. Like you surely already know, I have a Mac and its a very nice Macbook Pro. What is also very cool when you buy a Mac, its the OS and the tools that come with it. Mac OSX is very polished, I enjoy using it everyday and Leopard have bring one of my favorite feature from a Linux that I was really missing when I switched… the virtual desktop ! OSX call it space but its the same thing, I was used to organised my desktop by “type”. For example, all web related stuff goes on Desktop #1, music stuff on Desktop #2, chat windows on the #3 and so on. Anyway, on Tiger I had to use “Desktop Manager” to get a similar feature but it had some glitch.

The OS is really nice, but what make using a Mac a pleasant experience is enforced by the set of tools that comes with it. Apple give iLife with their Mac so the customer can have a very easy to use complete media platform. With iLife you can create your personnal website easily (even if I don’t use it, its easy to understand), create your own DVD with all the menu and stuff, manage your pictures and compose your own music. Yes, that’s right ! You can compose your own music using GarageBand.

I was currious to know how this software work so I played with it a little bit. Well, I’m really not a fan of techno music… but well the beat was easy to get and I still managed to create a 4 min song.

TechnoTestGB

If you are interested in knowing a bit more about iLife and to know how to use GarageBand, Apple have a lot of tutorial on their website.