This file contains 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 filter[K](arr: List[K], f: K => Boolean): List[K] = arr match { | |
case Nil => arr | |
case list: List[K] => if (f(list.head)) list.head :: filter(list.tail, f) else filter(list.tail, f) | |
} | |
val listToFilter = 2 :: 5 :: Nil | |
listToFilter.filter(_ > 2) |
This file contains 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
import java.security.Principal; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.Hashtable; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.ResourceBundle; | |
import java.util.Set; |
This file contains 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
import scala.annotation.tailrec | |
import scala.collection.mutable.ListBuffer | |
case class Priceable(id: String,measure:String,value: Double) | |
val results=Seq( | |
Priceable("$APPL","PV",311.0), | |
Priceable("$APPL","Growth",3.0), | |
Priceable("$IBM","PV",100), | |
Priceable("$IBM","Growth",0.5), |
This file contains 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
select e.ename, e.sal, d.dname from emp e,dept d where e.sal in (select max(e.sal) from emp e group by deptno) and e.deptno=d.deptno |
This file contains 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
select empno, deptno, row_number() over (partition by deptno order by 1) sequence_num from scott.emp; |
This file contains 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
input_records = LOAD 'hdfs://quickstart.cloudera:8020/user/cloudera/pig_word_count/input.txt' as(tweet_text:chararray); | |
filter_words = LOAD 'hdfs://quickstart.cloudera:8020/user/cloudera/pig_word_count/filter_words.txt' as (filter_word:chararray); | |
input_records = FOREACH input_records GENERATE REPLACE(tweet_text,'([^a-zA-Z\\s]+)',' ') as tweet_text; | |
tokenize_words = FOREACH input_records GENERATE flatten(TOKENIZE(LOWER(tweet_text))) as word; | |
--INEFFICIENT BUT NECCESSARY to print filtered_word | |
cleanedData = JOIN filter_words by LOWER((filter_word)) FULL, tokenize_words by LOWER(word); | |
--REMOVE NON MATCHIN WORDS EXCEPT THE ONE IN WHICH THE FILTER WORD IS NOT NULL | |
filtered_data = FILTER cleanedData by ((word IS NULL and filter_word IS NOT NULL ) or word matches LOWER(filter_word) ) ; | |
grouped_words = GROUP filtered_data by filter_word; | |
--GROUP THEM BY group key and only count when the word is not empty, Since null is not counted so it works |
This file contains 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
//in bindings add | |
<searchRegion Criteria="" | |
Customizer="oracle.jbo.uicli.binding.JUSearchBindingCustomizer" | |
Binds="IteratorName" id="DummyName"/> | |
//in fragment use af:table add the following | |
filterModel="#{bindings.DummyName.queryDescriptor}" | |
queryListener="#{bindings.DummyName.processQuery}" |
This file contains 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
/** | |
* This method recursively deletes and organization and its permission objects/users | |
* Its descendants if any are there before deleting the organization | |
* @param orgUnit The orgUnit name | |
* @param delAdmMgr A delegated Admin Manager instance | |
* @param revMgr A Delegated review manager instance | |
* @param rvMgr A review manager instance | |
* @param admMgr A admin manager instance | |
* @return | |
*/ |
This file contains 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
package model; | |
import java.util.Map; | |
import java.util.logging.Level; | |
import model.common.AppModule; | |
import oracle.adf.share.logging.ADFLogger; |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |