Skip to main content

Posts

Selection Sort Algorithm in Java and Python

The next definition is from Wikipedia: "In computer science, a Selection sort is a sorting algorithm , specifically an in-place comparison sort. It has O(n 2 ) time complexity, making it inefficient on large lists, and generally performs worse than the similar insertion sort. Selection sort is noted for its simplicity, and also has performance advantages over more complicated algorithms in certain situations, particularly where auxiliary memory is limited." It mentions also they are variants of this algorithm: heapsort, cocktail sort, bingo sort. Also there is a table where n is the number of records to be sorted. The columns "Average" and "Worst" give the time complexity in each case. Name Best Average Worst Selection sort Now, here the code in Java (take in account that I will implement the same interface and use the same tool class and it was defined in Insertion Sort Algorithm ). package melg.algorithms.sorting; /** * @aut
Recent posts

Insertion Sort Algorithm in Java and Python

I've started to study more about algorithms. I think that it will be an excellent challenge and great experience. I found this course in MIT Open CourseWare website :  " Introduction to Algorithms (SMA 5503) " , and I'm studying from this resource and also I've bought the related book to this course. Well, I'm going to post entries related to algorithms in Java, Groovy and Python language (my new lovers :) ). For Java coding I'm going to create an interface to be implemented for all my algorithm classes. package melg.algorithms.sorting; public interface ISorting { long[] makeSorting(long[] array, boolean debug); String getStats(); } Also I'll use this tool class, in order to be used for debugging purpose: package melg.algorithms.sorting; public class SortUtilAlgorithm { /** * Prints in the console the items of the array object * * @param array * the array object. */ public static void showArray(long[] array)

My first serious Groovy class ..... decompiling java classes with closures

After I read the chapter 6 "closures" of the book Groovy and Grails Recipe, and I decided to use the power of closures of Groovy for resource (files) with other problem that I had, decompile in one step every class of jar library. Well, the purpose of this class is call an external java decompiler (jad) from a Groovy class and execute the command into directory where the jar file was decompressed. And by using the power of closures executes recursively into this directory until find the classes. Well, no more words, here the class package demo class Executor { // directory where the library(jar) was decompressed def path /** * Execute the decompilation of the classes into the directory defined in the path * @return */ def decompileClasses(){ def directory = new File(path) //make use of closures defined in the Object class directory.eachFileRecurse { def name = it.absolutePath //if the current resource hasn't a .class extension continues with

WebDynpro for Java: Tutorial of the Basic Usage of RoadMap Component

We will create a local Development component project of the type Web Dynpro as follow Our project will contain only 3 views with the purpose of show the basic usage of the roadMap object. After, we create our component controller RoadMap and the RoadMapView view as follow Now, we will create the 2 views more, the previous one will contain only the RoadMap Object (RoadMapView) used in all the project, the other ones show the flow between screens. Here the list of the 3 views: RoadMapView,  InitView, and ConfirmView. Now, we will add the component RoadMap object (it is on the Standar Complex Group) to the RoadMapView view, but first delete the default object added to the view, after we will need to add two steps (it could be more, depends of your logic) to our roadmap object. In order to do that we will use the Outline view of the NWDS. We add the two steps as follow The type steps to add at the RoadMap object will be ot the "RoadMapStep" type. The name of the steps are: Init

How to .. Integration Non-SAP J2EE-based Web Applications into SAP Portal with SSO Part 2

After we have configured our portal object, we must install the gateway application and modified the target application. 1. Deployment of the Gateway Web J2EE Application : We must to create an j2ee web application with the purpose to be a gateway from every application that want to validate the SAP Ticket Logon. I have created this application because of the problem with the sapssoext library provied from SAP, it can't be loaded from more than one classloader, then this new web application will be the unque application on the server that can load this library. This application could expose 2 or more services, it depends of you. I will mention 2 services: /SsoGatewayWeb/ssojson.dtx : under this URI will happen the vaidation of the SAP Ticket Logon sent by the SAP Portal, it returns a JSON string with the information retrieved from the ticket. /SsoGatewayWeb/sendsso2cookietest : this URI generates HTML content, it generates the string ACL of the certificate file. Both only acc

How to .. Integration Non-SAP J2EE-based Web Applications into SAP Portal with SSO Part 1

We are going to integrate Non-SAP J2EE-based Web Applications into the SAP Portal with Application Integrator and SSO. In this part, I will discuss the overall of these posts and configure the iView with Application Integrator Overview of Integration. To perform this integration must take into account the following steps: Deployment of the portal application for the creation of the system portal object Create and set the type of Application Integrator iView that will contain the applications to integrate. Installing SAPSSOEXT and SAPSECU libraries Deployment of the application gateway called SsoGatewayWeb Changing the target application. This integration has the following restrictions: It applies only for web applications based on J2EE Servlet. Depend exclusively on the sucessful load of the libraries supported by SAP (sapssoext and sapsecu) in both Windows and UNIX environments. The target application must have created a profile for the user id logged to the SAP portal, this sh

Show the user data of every response for the current Quick Poll in the campaign in a Flex Client, 3rd part

In this part, only we will focus in Flex client, also there are others parts, such as J2EE components, but here we don't consider here because they are out of scope of this blog. It includes to consider the following parts: Create J2EE Web Proyect, it will contain the flex client created with Flex Builder or Flash Develop IDE . Create EJB Project , it references to the java project created in the 2nd part of this blog. Here, you'll need to create a stateless session bean, and after to expose some method as Web Service. The NWDS has a wizard to do this taskes. Also, you could create a Web Services directly of the Java project by making use of the NWDS wizards. Create Flex Builder Project or FlashDevelop IDE, you create a flex client to consume the previuosly web services. Create Enterprise Project; finally we will add the web and ejb project modules, previously created, to this kind project for deployment our ear file on SAP Netweaver AS 7.0+. Now, you will review the MXM