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

< Previous (iOS Programming – Part 1) | (iOS Programming – Part 3) Next >

If you haven’t created your own project yet with XCode please go to the part 1 of this tutorial: iOS Programming – Part 1

In this part, we are going to analyse the files that were generated by XCode when we created our project.

I am assuming that you have some knowledge in C/C++ and also about terms normally used in programming languages.
Either way, I will try to provide you with links and/or explanations of terms that I will be using.

  1. At your left you can see the files created by XCode:
  2. In Objective-C there are two kind of files. Files with the extension .h are called header files. Files with the extension .m are implementation files.

Example01AppDelegate.h

//
//  Example01AppDelegate.h
//  Example01
//
//  Created by Alejandro G. Carlstein Ramos Mejia on 9/24/11.
//  Copyright 2011 Alejandro G. Carlstein Ramos Mejia. All rights reserved.
//

#import <UIKit/UIKit.h>

@class Example01ViewController;

@interface Example01AppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window; // Added
    Example01ViewController *viewController; // Added
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet Example01ViewController *viewController;

@end

#import <UIKit/UIKit.h> is the header of the library UIKit framework. The UIKit framework are a set of classes, objects, event handling, windows, views and controls that allow you to create and administrate your application’s user interface.

Share

< Previous (Operative Systems – Part 1) | (Operative Systems – Part 3) Next >

NOTIFICATION: These notes are published for educational purposes. Using these notes is under your own responsibility and risk. These notes are given ‘as is’. I do not take responsibilities for how you use them.

PDF Content:

  • Dispatcher
  • Scheduling criteria
  • Optimization criteria
  • Scheduling algorithm goals
  • First-come, first-served scheduling (FCFS)
  • Shortest-job-first Scheduling (SJR)
  • Shortest Remaining Time Next (SRTF)
  • Pre-empty Shortest-job-first (PSJR)
  • CPU burst
  • Priority scheduling
  • Round Robin (RR)
  • Time quantum
  • Context switch time
  • Multilevel queue
  • Multilevel feedback queue (MFQ)
  • Real-time scheduling
  • Flow of control
  • Fair scheduling
  • Work-conserving
  • Non-work-conserving
  • Organization of Linux kernel
  • Privilege modes
  • System calls

Operative_Systems_2

 

< Previous (Operative Systems – Part 1) | (Operative Systems – Part 3) Next >

Share

In this example you will see: Class, extends, flash.display.MovieClip, flash.display.MovieClip.graphics, haxe.Timer.delay, flash.Lib.current.addChild

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.

Actual Example:

Sorry, either Adobe flash is not installed or you do not have it enabled

Code example: Example_8.hx:

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

import flash.display.MovieClip;

class Rectangle2D{
	private static var DEFAULT_BORDER_COLOR = 0x000000;
	private static var DEFAULT_BORDER_THICKNESS = 1.0;
	private var x : Int;
	private var y : Int;
	private var width : Int;
	private var height : Int;
	private var background_color : Null<Int>;
	private var border_color : Null<Int>;
	private var border_thickness : Null<Float>;
	private var movie_clip : flash.display.MovieClip;

	public function new(x : Int,
											y : Int,
											width : Int,
											height : Int,
											?background_color : Null<Int>,
											?border_color : Null<Int>,
											?border_thickness : Null<Float>){
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
		this.background_color = (background_color == null) ? null : background_color;
		this.border_color = (border_color == null) ? DEFAULT_BORDER_COLOR : border_color;
		this.border_thickness = (border_thickness == null) ? DEFAULT_BORDER_THICKNESS : border_thickness;
	}

	public function draw(){
		movie_clip = flash.Lib.current;
		moveTo(x, y);
	}

	public function moveTo(x : Int, y : Int){
		this.x = x;
		this.y = y;
		resize(width, height);
	}

	public function resize(width : Int, height : Int){
		movie_clip.graphics.clear();

    if (background_color != null)
    	movie_clip.graphics.beginFill(background_color);

		if (border_thickness != null)
	    movie_clip.graphics.lineStyle(border_thickness, border_color);

		movie_clip.graphics.moveTo(x, y);
    movie_clip.graphics.lineTo(width,y);
    movie_clip.graphics.lineTo(width, height);
    movie_clip.graphics.lineTo(x, height);

    movie_clip.graphics.lineTo(x, y);

    if (background_color > -1)
    	movie_clip.graphics.endFill();

	}

}

class Shape2D extends MovieClip{
	private static var DEFAULT_BORDER_COLOR = 0x000000;
	private static var DEFAULT_BORDER_THICKNESS = 1.0;
	private var radius : Float;
	private var background_color : Null<Int>;
	private var border_color : Null<Int>;
	private var border_thickness : Null<Float>;

	public function new(x : Int,
											y : Int,
											?background_color : Null<Int>,
											?border_color : Null<Int>,
											?border_thickness : Null<Float>){
		super();
		this.x = x;
		this.y = y;
		this.background_color = (background_color == null) ? null : background_color;
		this.border_color = (border_color == null) ? DEFAULT_BORDER_COLOR : border_color;
		this.border_thickness = (border_thickness == null) ? DEFAULT_BORDER_THICKNESS : border_thickness;
	}

	public function drawCircle(radius : Float, ?x : Int, ?y : Int){
		if (x != null) this.x = x;
		if (x != null) this.y = y;
		this.radius = radius;
		beginDraw();
		graphics.drawCircle(x, y, radius);
		endDraw();
	}

	public function drawRectangle(width : Int, height : Int, ?x : Int, ?y : Int){
		if (x != null) this.x = x;
		if (x != null) this.y = y;
		this.width = width;
		this.height = height;
		beginDraw();
		graphics.drawRect(x, y, width, height);
		endDraw();
	}

	private function beginDraw(){
		graphics.clear();
		graphics.moveTo(x, y);

    if (background_color != null)
    	graphics.beginFill(background_color);

		if (border_thickness != null)
	    graphics.lineStyle(border_thickness, border_color);

	}

	private function endDraw(){
		 if (background_color > -1)
    	graphics.endFill();
	}

}

class Example_8{

 	static function main(){

		var rectangle : Rectangle2D = new Rectangle2D(100,100,100, 100, 0x334433, 0x44444);
		rectangle.draw();
		rectangle.resize(200, 200);
		haxe.Timer.delay(function(){rectangle.moveTo(0, 0);}, 2000);

		var shape2D : Shape2D = new Shape2D(100,100, null, 0x000000, 3.0);
		flash.Lib.current.addChild(shape2D);
		shape2D.drawCircle(45.0);

		haxe.Timer.delay(function(){shape2D.drawRectangle(100, 100);}, 2000);

 	}
}

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
  1. Right now, I am working in the introduction of the game by drawing the each scene.
    Later, I will see to find a way to animate them.
  2. I was checking for code and ideas. However, I think it is time for me to begin coding something.
    Sometimes over-preparation  is a way of procrastination. Tomorrow, I am going to do the first lines of code.
  3. I decided to begin working on the map editor first. It is one of the hardest part but after it is done, it would be a great help and experience.
  4. I meet an old friend. He is doing some 3D projects. I told to him about these projects I am doing and seems to be interested. I will send him an email.
  5. I have the drawings of the map editor done so far. Still there are things I need to think about. My objective is to build a very simple, easy to use editor. Especially when I don’t have to much space.
Share

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

Network Security

What do we considerate as network security? Network security is a system in which:

  1. There is a level of confidentiality. This means that only authorised system or personnel is allowed to access
  2. There is a level of integrity: This means that from the origin to the destination, the data is authentic and correct.
  3. There is a level of availability: This means that a system or personnel can use the information and/or resource.

In 1982, the International Organization for Standartization (ISO) along with the International Telecommunication Union, Telecommunication Standartization Section (ITU-T), created the Open System Interconnection (OSI) with the purpose of standardize networking.

This system is a systematic way for the definition of levels of security such as:

  1. Security against attacks
  2. Security mechanisms
  3. Security Devices

Security against Attacks

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