Alejandro G. Carlstein Ramos Mejia Blog



This is the first time I am part of a corporate group photo. So, I decided to post it so my family can see it. Grin

Share

Up to know I though that posting things in a blog was to share my stuff in hopes to helps others that may be interested.

However, I found out how wrong I was. I think that a blog can be made more interesting by having interaction with people.

You are welcome to ask me questions. I will try my best to answer them.

Sometimes I would not be able to answer a question right away. I might be very busy or I will not know the answer, but I will try my best to make some time or find the answer.

Share

In this example, you will see: private static function, recursive fibonacci and dynamic fibonacci algorithm.

NOTIFICATION: These examples are provided for educational purposes. Using this code is under your own responsibility and risk. The code is given ‘as is’. I do not take responsibilities of how they are used.

example_3.hx:

/**
 * @author: Alejandro G. Carlstein R. M.
 */

class Example_3 {

	private static var fib_array : Array<Int> = [1, 1];

	static function main(){
		trace("main()");
		trace("Recursive Fibonacci (value: 5): " + recursive_fib(5));
		trace("Dynamic Fibonacci (value: 5): " + dynamic_fib(5));
		print_array();
	}

	// Recursive Fibonacci
	private static function recursive_fib(value : Int) : Int {
		if (value < 2)
			return 1;
		return recursive_fib(value - 1) + recursive_fib(value - 2);
	}

	// Dynamic Fibonacci
	private static function dynamic_fib(value : Int) : Int {
		if (value < 2)
			return 1;
		if (fib_array[value] == 0)
			fib_array[value] = dynamic_fib(value - 1) + dynamic_fib(value - 2);
		return fib_array[value];
	}

	private static function print_array() : Void{
		var iter = fib_array.iterator();
		while (iter.hasNext()){
			trace("Array Value: " + iter.next());
		}
	}

}

If you encounter any problems or errors, please let me know by providing an example of the code, input, output, and an explanation. Thanks.

Share

Prolog is a programming language which works around relations not functions.
Prolog is homoiconic due the structure of its clauses and database that provide it the ability to represent itself.
Note: A language is homoiconic when the language is self-defined. This means that if we run on the interpreter a copy of itself, it should work. Another behaviour of an homoiconic language is to lets the programmer to create, change, and run the code on the fly.
Prolog is not fully reflective, but close, Prolog seems like reflective language because  a program that can resolve a problem by itself by just using relationships, facts, rules, structures, and a database. A fully reflective language should be able to create relationships, rules, structures, and database by itself as needed to find a solution.

In Prolog, facts are clauses with an empty body, eg:

is_mother_of(Maria, Matias). /* Maria is_mother_of Matias */

Rules are clauses with a head and body (head():- body), eg:

/* A Person is_parent_of the Child if (Smile the Person is_mother_of the Child */
is_parent_of(Person, Child) :- is_mother_of(Person, Child).

Predicate are clauses using the same head with different bodies, eg:

/* A Person is_parent_of the Child if (Smile the Person is_mother_of the Child */
is_parent_of(Person, Child) :- is_mother_of(Person, Child).
/* A Person is_parent_of the Child if (Smile the Person is_father_of the Child */
is_parent_of(Person, Child) :- is_father_of(Person, Child).

Note: Every code written before ‘?-’ are facts and rules. Code written following ‘?-’ are queries, and all code after ‘?-’ are the results that prolog returns. eg:

is_mother_of(Marina, Marcos).   /* This is a fact */
is_parent_of(Person, Child) :- is_mother_of(Person, Child). /* This is a rule */
?- is_parent_of(Marina, Marcos). /* This is a query */
True /* This is a result. note that this comment will not show up */
?- is_parent_of(Marina, Lucia). /* This is a query */
False

Lets talk about unification.

Share

I decided to begin posting formulas that I may used for future projects and for educational purposes

Physics Formulas

Physics Formulas

Physics Formulas

Physics Formulas

Physics Formulas

Physics Formulas

Share

I am  working on the base case of the 3D printer. I am planning to make most of the parts such as the power supply reusable.

Modifying the case

Share

Problem

When using multiple JPA persistent units inside the file persistence.xml you can run into troubles when your entities have the same name. A exception message such a follow is an indicator of that there is a problem: “javax.annotation.processing.FilterException: Attempt to recreate a file …”

 

Solution

Set the following property from

<exclude-unlisted-classes>false</exclude-unlisted-classes>

to

<exclude-unlisted-classes>true</exclude-unlisted-classes>
Share

Problem

NetBeans 7.4 display an exception, send by Tomcat, that cannot be solved by just stopping Tomcat, cleaning and building the project. This issue happens because NetBeans keeps uploading a previous version of the project from its cache which is not being updated.

Solution For Windows Users

  1. On NetBeans
    1. Stop Tomcat
    2. Clean your project
    3. Exit NetBeans
  2. Go to “C:\Users\[USERNAME]\AppData\Local\NetBeans” (where USERNAME is your windows login username)
  3. Delete folder “Cache”
  4. Open NetBeans again. Build and test your project on the browser.
Share