float, int equality in Java

I saw a strange thing tonight. I was checking primitive types in Java. I was trying float, int equality to see when the “==” equality fails. It is supposed to be values over 2^23.

Guess what? It never fails.

When we try a equality check like;

aFloat == aInt

Java casts int to float first then executes the equality check.

aFloat == (float)aInt

Switching left values to right values of equality operator does not change this behaviour. This is the reference to this situation.

The following code exemplifies the situation.

public static void main(String[] args) {
	float f = 99_000_021;
	int i = 99_000_021;
	if(i == f) {
		System.out.println("int value:"+ i + 
			" and float value:"+ f + " are EQUAL!");
	}
}

Output is as follows:
int value:99000021 and float value:9.9000024E7 are EQUAL!

DB2 Decimal Division Example

Decimal is one of the most commonly used data type in DB2 database. The difficulty with DECIMAL arises when division is the case. You can come through errors such negative scale or unexpected values. I prefer to use FLOAT casting and recasting to refrain from this kind of errors.

CREATE PROCEDURE DIVISION_EXAMPLE (IN BALANCE_EUR DECIMAL(20,2),
IN EXC_EUR_TO_USD DECIMAL(12,5),
OUT BALANCE_USD DECIMAL(20,2))
RESULT SETS 1
LANGUAGE SQL 

P1: BEGIN
DECLARE V_BALANCE_EUR FLOAT;
DECLARE V_EXC_EUR_TO_USD FLOAT;
DECLARE V_DIVISION FLOAT;

SET V_BALANCE_EUR = BALANCE_EUR;
SET V_EXC_EUR_TO_USD = EXC_EUR_TO_USD;
SET V_DIVISION = BALANCE_EUR / EXC_EUR_TO_USD;
SET BALANCE_USD = ROUND(V_DIVISION ,2);

END P1

A few words about Troux

Troux is the most established tool within enterprise architecture. All its roots are in enterprise architecture. Troux experiences is built into this software. 

I prefer to define Troux if its differentiative aspects with other enterprise architecture tools;

Fastest results with quantitative knowledge especially for strategic decision

A Digest Review of IBM System Architect

IBM System Architect is one of prominent enterprise architecture tool in the market.

IBM System Architect  is composed of 3 main components

  1. IBM System Architect (Rich Client)
  2. IBM System Architect XT
  3. IBM System Architect Publisher

IBM System Architect is the extensive software among other tools. Any stakeholder in the organization can find the features s/he needed. Business Motivation Model for strategy development, business process management features consisting process simulation, technical landscape components (routers, servers, client machines with their OS), are just some examples to show how diverse features System Architect has.

System Architect can do anything for your enterprise architecture. Now remember the saying ‘Jack of all trades, master of none’. I think it is best for the organizations that are interested in thoroughly follow what is actual landscape of the enterprise architecture especially with IT point of view. 

System Architect has its own unified meta-model for all aspects of defining elements from high level to low level. It’s very good practice to keep everything connected. The downside of this approach is the meta-model is well established and it might not be very easy to adopt to a new meta-model customized for a specific organization.

Up till now;

We can classify the enterprise architecture tools with respect to concerns;

  • Strategy
  1. Troux
  2. Alfabet
  3. Casewise
  4. Mega
  5. IBM System Architect
  • Business
  1. Casewise
  2. IBM System Architect
  3. Mega
  4. Troux
  5. Alfabet
  • Technology
  1. IBM System Architect
  2. Troux
  3. Mega
  4. Alfabet
  5. Casewise
  • Adaptabality
  1. Mega
  2. Casewise
  3. Alfabet
  4. Troux
  5. IBM System Architect

 

Debug on IBM Data Studio

Most of the things are straightforward in IBM Data Studio. Two points can be considered which are system related configurations that you should work with your system administrator.

1. Debug Authorization: By default ordinary users do not have the privilege to debug on DB2 system. The error will have the following signature;

SQLCode: -552 SQLState: 42502 User does not have the privilege to perform operation set client debuginfo.

2. WLM Environment: Debug operations are executed on a WLM environment and by default it is WLMENV1 and most probably specific system has different names for WLM environment. System administration will guide you for definition of WLM environment.

Image

One time insert of your system specific WLM environment isn’t suffice for all time debugging and you would reset it every time you start debug. So insert following lines to your stored procedure code for WLM environment definition.

WLM ENVIRONMENT FOR DEBUG MODE DB2XXXXX
ALLOW DEBUG MODE

Alfabet Planning IT General Review as an Enterprise Architecture Tool

Software Ag has acquired Alfabet recently. Software Ag already had Aris. As a result two competing systems are in one owners portfolio now. Aris Enterprise Architect and Alfabet. Alfabet focussed on portfolio management of the organization. As a result IT originated experts has the tendency to focus on features of portfolio management, which has pointed earlier in the review of Casewise. It is usability and visualization is very high. Dashboard features will enable the high level IT management to control the IT and guide IT for the next steps to go forward. The customer portfolio of Alfabet is very impressive, from finance to logistics, production to transportation. Most impressive of all is Microsoft. A software company that plans its IT through Alfabet. It might be assumed to be an exchange but Alfabet uses Microsoft technologies to run its software. All Enterprise Architecture shows dependencies between objects of the organizational assets, the most visual and frienly one is Alfabet Planning IT, I know of (others were IBM System Architect, Mega, and Casewise).

So Alfabet visualize enterprise architecture related information in a very good way. In addition to that, I think what is more important think is it constitutes a collaboration between all stakeholders and it keeps the underlying repository alive. This can be one of the important reason if you compare ARIS Enterprise Architect and Alfabet Planning IT. 

  1. BPMN can be used. There is no process simulation. Generally 30% of features are available with respect to Business Process Management.
  2. Fully TOGAF compliant.
  3. Customized meta-model can be used. Complex meta-model updates need application rebuild.
  4. Alfabet Integration Framework enables the Planning IT to be connected to any Project Management software, which company already have.
  5. Planning IT uses MS SQL Server and MS Information Server and runs only on Internet Explorer at the time being. But it is said that on March 2014, html 5 version will be used and the system can be used in a wide range of browsers.

The remark for now is Alfabet Planning IT in conjuction with ARIS BPM is one of the best choices for Enterprise Architecture tool.

Casewise Products as an Enterprise Architecture Tool

Magic Quadrant

Magic Quadrant for EA Tools 2011

Ref:Gartner EA Tool Magic Quadrant 2011

Magic Quadrant for EA Tools 2012

Magic Quadrant for EA Tools 2012

Ref:Gartner EA Tool Magic Quadrant 2012
Casewise products are positioned one of the best tools for Enterprise Architecture by Gartner, Forrester, and Ovum. Most impressive of all in the reviews is from Ovum which states that “fully extensible repository”.

As said you can define your meta-model and you can facilitate the suite upon that meta-model of yours. Even more it comes its own meta-model PolDot. You can use it directly, or customize it, or build from scratch of your own. PolDot model is based on Zachman framework. On this point the practice of meta-model phase is follows. The users of the suite take 2-3 days of course of suite education. After that the consultants guide the modeling experts to build the meta-model about 10 days.

Eventhough I don’t have a hands on experience on Casewise modelling environment, according to the representation, the modeler can update the meta-model by himself/herself on the run. In Mega (another prominent Enterprise Architecture tool), if you update meta-model, Mega should be re-compiled accordingly for the customized meta-model by the experts of the Mega experts.

Casewise main focus is on Business Process Modelling and Analysis. It has an simulation environment which enables users to see the bottlenecks and effects of a new process or a change or a re-engineering of the process. For the activities and situations, the probability of an event can be defined. This focus of the tool on business processes, might have an impression on the customers for enterprise architecture tool some reluctance to the Casewise. According to my experience, enterprise architects from IT have a tendency to get more features of portfolio managements on all levels of their IT systems.

Other points ;

  1. What if meta-model need to be updated, after repository is structured a while after?
  2. TOGAF and Archimate said to supported, but there is no direct support. For instance you cannot say instead of PolDot, start with Archimate model and customized it. If you want to produce TOGAF default documents for different perspectives, you should define that documents manually.
  3. Casewise uses Oracle and MSSql as data storage.
  4. BPMN notation can be used to model business processes.
  5. Casewise modeler flyer states that, “Are the activities we are doing, and the investments we are making in the direct support of our business strategy and objectives?” Since my PhD thesis is highly related to this statement, I inquire how do they answer this question. First glance it is only visualization and linkage of the objective and activities by an experts and unfortunately there is no quantitative approach to validate that model.modeler flyer filteredRef: Casewise

IBM Data Studio on Linux (Ubuntu 13.10)

Download IBM Data Studio Client 4.1 for Red Hat, Suse from ibm site. IBM ID is needed to download. You can create one and use it for further downloads. I recommend Download Manager which is an Java Applet for download since the installation is 1.4 GB and http download might fail during this long download.

Extract ibm_ds4101_lin.tar.gz.

From terminal, run ./imLauncherLunix.sh. First install manager will be installed, after that Data Studio installation will start. The script will install the suitable version of the Data Studio for your system. I have 64bit system, I don’t need to define anything for that.

IBM Data Studio is built on Eclipse and eclipse command should be run. System already have eclipse in path word ordinary eclipse installation. Create a launcher for ease of use for IBM Data Studio.

create a file as follows named as ibmds.desktop on /home/username/.local/applications/ directory with content as follows.

[Desktop Entry]
Name=IBM DS
Comment=IBM DataStudio
Exec=/opt/IBM/DS4.1.0.1/eclipse
Icon=/opt/IBM/DS4.1.0.1/db2.png
Terminal=false
StartupNotify=true
Type=Application
OnlyShowIn=GNOME;Unity;
Categories=Database;IBM;
Actions=Window;
NoDisplay=true

From that directory drag and drop ibmds.desktop to the Applications bar.

Latex and TexMaker on Ubuntu

For latex compiler install texlive:

sudo apt-get install texlive-full

For latex editor install Texmaker:

sudo apt-get install texmaker

For additional packages install texlive essential packages from Ubuntu Software Center:

Image

Without those packages you may have some font errors like

! Font OT1/ptm/m/n/10=ptmr7t at 10.0pt not loadable: Metric (TFM) file not found

add-apt-repository error in dual boot machine

I was trying to add a repository. The error was

Please check that the PPA name or format is correct.

It is said that this bug is with Ubuntu 13.10 which deployed in a dual-boot machine.

How can it be related? Dual-boot and adding a repository. It is very interesting.

I’m not sure if it has nothing to do with dual boot or not. The point is ubuntu 12.04 didn’t have that problem, but 13.10 has. My solution was using add-apt-repository with proxy definition. I should note that the system wide proxy settings and apt.conf proxy definitions are present. Even though they are present, I used  add-apt-repository command with explicit proxy declaration.

sudo https_proxy='https://user:pass@proxy_server:proxy_port/' http_proxy='http://user:pass@proxy_server:proxy_port/' add-apt-repository ppa:webupd8team/java

Both proxy definitions should be present.

Bounded Rationality and Overrating History of Experience

Bounded Rationality, one of the important ideas I agree on. We have limited knowledge about the facts about our environment and may be less about ourselves and the relation between those. As a human being, our rational side brings us today, the most prevalent and eminent species in the planet we live on. Even though, each passing day our knowledge is increasing,  with respect to total knowledge -“omni-knowledge” -, it is limited. This is hypothesis and open to dispute. Let’s assume that’s a fact, for the sake of the proposal following. We have limited knowledge some of them learned, and some other from our own experience. The point we are making on this point is, the knowledge we are having especially that has the root of our history of experience is overrated. You have knowledge about a situation, for example “Every toss of a coin has the same probability of having head or tails”. You toss a coin and have a head. In the second toss, you more likely await it to become tail. In fact it has nothing to do with the previous experience you are having, it has the same probability to become head or tail. This was a simple example. When you bring this knowledge in more general terms, even if you have a knowledge about a situation, we tend to overrate our previous experience to be an important factor that we had a conclusion in a combination with the knowledge we have and the experience we had. The relation between knowledge and own experience is irrational. As a result in our decision we shadow our rationality through our own experiences.

Software AG – Enterprise Architecture Related Products

Command Central 9.5 said to enable ESB more scalable and more elactic. Command Central is a part of webMethods. It can start/stop and manage services running through webMethods.

Another new feature of webMethods  is mobile support. If you are using mainframe and want to carry your interfaces to mobile screens, this is a good option. webMethods can be integrated to mainframe. 3270 user interface is the client terminal of mainframe. 3270 simple features can be represented in a mobile devices, since 3270 is a simple interface. 3270 interface is carried to mobile interface to enable mobile devices.

Gartner places Software AG as the market leader of Enterprise Governance, Risk, and Compliance in short EGRC. Other leaders in EGRC category are: EMC(RSA), Thomson Reuters, SAP, MetricStream, Nasdaq OMX(BWise), and IBM. Even though MEGA is the at top of Enterprise Architecture tools, it falls into Visionaries square of the EGRC quadrant. (As of September 2013)

Complex Event Processing (CEP),  has new options to handle big data.

EntireX has new features for monitoring, measuring, and optimizing cross-system applications. 

Ref: TECHiques Issue 4, 2013

 

 

 

Code Sample – WalPrimes

The problem defined in here. There are solution codes also. The difference between this code and all the others is, there is no recursion, we are just counting. Since recursion will consume all your heap eventually on a long string, you won’t be able to see the end of the movie.

Note: int overflow containing operations are 0 and they are added to the walnum.

public class WalPrimes {
	
	public static void main(String[] args) {
		System.out.println(walNum("011"));
		System.out.println(walNum("1256700912856789"));
	}

	public static Integer walNum(String s) {
		int[] perms = new int[s.length() - 1];
		initialize(perms);
		int total = 0;
		while (perms != null) {
			total += checkWall(s, perms);
			perms = getNextPerm(perms);
		}
		return total;
	}

	public static void initialize(int[] perms) {
		for (int i = 0; i < perms.length; i++)
			perms[i] = 0;
	}

	public static int checkWall(String s, int[] perms) {
		int total = 0;
		int multiplier = 1;
		int series = 0;
		// no sign for first element;skip it
		// least significant digit is at the end
		// start from end
		for (int i = perms.length - 1; i >= 0; i--) {
			if (perms[i] == 0) {
				series += multiplier * (s.charAt(i+1) - 'a');
				multiplier *= 10;
			} else {
				series += multiplier * (s.charAt(i+1) - 'a');
				multiplier = 1;
				total += series * (perms[i] == 1 ? 1 : -1);
				series = 0;
			}
		}
		//take the first digit
		series += multiplier * (s.charAt(0) - 'a');
		total += series;

		if (total % 2 == 0 || total % 3 == 0 || total % 5 == 0
				|| total % 7 == 0)
			return 1;
		return 0;
	}

	public static int[] getNextPerm(int[] perms) { 
		//3 options to branch 
		//counting on base 3
		int carry = 1;
		for (int i = 0; i < perms.length; i++) {
			if (perms[i] + carry == 3) {
				if(i == perms.length - 1)
					return null;
				perms[i] = 0;
			} else {
				perms[i] += carry;
				return perms;
			}
		}
		return null;
	}
}

exFat with Mac – Linux – Windows

If you are operating on different operating systems, you probably come through the problem of external drives formats. NTFS format are default for majority of external drives. Recent Linux versions don’t have any problem with NTFS which is an Microsoft format, but you can only read NTFS drives on Macs. You can use third party programs or some do some scripting to enable write mode.  ExFat is another option which is a enhanced format of FAT32, with some drawbacks over NTFS. But it is faster and consumes less space for file management information.

Just 3 points should be keep in mind:

  1. Do not format the disk exFat more than 1024K block size. Mac won’t access it.
  2. Update fuse to access exFat from Linux. Default version pop-ups an error when you click on drive.
  3. Smart TVs cannot access exFat formatted usb drives.

EMFStore vs. CDO

These are the two main tools to maintain EMF models. I wasn’t decided which one to use, while I was still developing my project models. As the models became bigger and more complex, I had to start to facilitate a repository which also keeps the versions. I could not find a comparison of EMFStore vs. CDO. CDO features come integrated with Eclipse Modelling, but I was not sure. At some point http://ekkescorner.wordpress.com/category/cdo/ I encounter this selection, and model evolution attribute of EMFStore where CDO lacks. So I started to use EMFStore.

Taklitlerimizden Sakının (King Burger ®!!!)

Taklitlerimizden Sakının (King Burger !!!)

Taklitlerimizden Sakının (King Burger !!!)

Taklitlerimizden Sakının (King Burger !!!)

Taklitlerimizden Sakının (King Burger !!!)

Hatay’da gezerken karşılaştığım, bir hamburgerci.

 

Bir de değişik sektörleri bir araya getiren bir esnaf vardı. Onu çekmeyi o an akıl edemedim. Ama şöyle bir tabelası vardı: “Zafer İletişim ve TÜP” telekom hizmeti ve tüp satışını bir arada yürütüyor.