This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @return an in-memory HSQL entityManager | |
| * @author Timoteo Ponce | |
| */ | |
| public static EntityManager createEntityManager() { | |
| Properties properties = new Properties(); | |
| properties.put("javax.persistence.provider", "org.hibernate.ejb.HibernatePersistence"); | |
| properties.put("javax.persistence.transactionType", "RESOURCE_LOCAL"); | |
| properties.put("hibernate.connection.username", "sa"); | |
| properties.put("hibernate.connection.password" ,""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Order{ | |
| void perform(){ | |
| } | |
| } | |
| class OrderA extends Order{ | |
| } | |
| @DependsOn(OrderA.class) | |
| class OrderB extends Order{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "test/unit" | |
| class Node | |
| attr_accessor :value, :left_node, :right_node, :parent_node | |
| def initialize(value=nil, left_node=nil, right_node=nil, parent_node = nil) | |
| @value = value | |
| @left_node = left_node | |
| @right_node = right_node | |
| @parent_node = parent_node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void close ( Process process ){ | |
| statement.close(process); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void close ( Process process ){ | |
| // statement.close(process,'0',1000,-1); | |
| statement.close(process); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_primes( limit ) | |
| list = Hash.new | |
| (2..limit).each do |i| | |
| list[ i ] = false | |
| end | |
| init = 2 | |
| while init <= limit do | |
| prime = init | |
| while prime <= limit do | |
| if prime > init then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_primes( limit ) | |
| list = Hash.new | |
| (2..limit).each do |i| | |
| list[ i ] = true | |
| end | |
| init = 2 | |
| while init <= limit/2 do | |
| if list[init] then | |
| index = init * 2 | |
| while index <= limit do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * | |
| * @author Miguel Peinado | |
| * @author Timoteo Ponce | |
| */ | |
| import java.net.*; | |
| import java.io.*; | |
| class Cliente{ | |
| public static void main (String[] args){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def migrate_script ( input_file_name , output_file_name ) | |
| input_file = File.open( input_file_name , 'r') | |
| loc = 0 | |
| File.open(output_file_name, 'w') do | output_file | | |
| input_file.each do | line | | |
| output_file.puts clean_line(line) | |
| loc += 1 | |
| end | |
| end | |
| puts "#{input_file_name} -> #{output_file_name} : #{loc} lines migrated" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # lines of code | |
| def count_files( base_dir ) | |
| file_names = Dir.glob( base_dir + "/**/*.{java,py,sh,pl}") | |
| puts "Counting LOC in [ #{file_names.length} ] files in folder : #{base_dir}" | |
| total_count = 0 | |
| file_names.each do |file| | |
| total_count += count_file file | |
| end | |
| puts "Total LOC: #{total_count}" |