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 net.srirangan.simplewebcrawler.tasks | |
import java.lang.String | |
import java.util.{List,ArrayList} | |
import org.gridgain.grid._ | |
import net.srirangan.simplewebcrawler.jobs.LoadUrlJob | |
class LoadUrlTask extends GridTaskNoReduceSplitAdapter[String] { | |
def split(gridSize:Int, url:String):List[GridJob] = { |
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 net.srirangan.simplewebcrawler.jobs | |
import java.lang.String | |
import java.util.{List,ArrayList} | |
import org.gridgain.grid.GridJobAdapterEx | |
import org.gridgain.scalar.scalar._ | |
import net.srirangan.simplewebcrawler.tasks.{LoadUrlTask,IndexKeywordsTask} | |
class LoadUrlJob(url:String) extends GridJobAdapterEx { | |
def execute():Object = { |
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 net.srirangan.simplewebcrawler.tasks | |
import java.lang.String | |
import java.util.{List,ArrayList} | |
import org.gridgain.grid.GridJob | |
import org.gridgain.grid.GridTaskNoReduceSplitAdapter | |
import net.srirangan.simplewebcrawler.jobs.IndexKeywordsJob | |
class IndexKeywordsTask extends GridTaskNoReduceSplitAdapter[String] { |
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 net.srirangan.simplewebcrawler.jobs | |
import java.lang.String | |
import org.gridgain.grid.GridJobAdapterEx | |
import org.gridgain.scalar.scalar._ | |
class IndexKeywordsJob(data:String) extends GridJobAdapterEx { | |
def execute():Object = { | |
println(data) | |
// .. actual indexing logic comes here |
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
public class UserContext { | |
private Long userId; | |
private String userName; | |
private UserAddress userAddress; | |
private CustomerInfo customerInfo; |
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
function justAFunction() { | |
console.log("functions can be declared"); | |
} | |
var justAnotherFunction = function () { | |
console.log("functions can be expressed as objects"); | |
}; | |
console.log("All functions are objects of type 'function'"); | |
console.log(typeof justAFunction); |
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
var logArguments = function () { | |
console.log(arguments); | |
}; | |
console.log("All functions can have dynamic arguments"); | |
logArguments("hello", "world"); | |
logArguments("hello", "world", 42, ["huh", "wtf!"], {hello:"world"}); | |
var logThis = function () { | |
console.log(this); |
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
(function (name) { | |
console.log(name + " functions can be auto-executed on definition") | |
})("Anonymous"); | |
console.log("JavaScript provides functional scoping instead of block scoping"); | |
(function () { | |
if (true) { | |
var x = true; | |
console.log("Is 'x' available inside the block? " + x); | |
} |
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
var forEach = function (list, action) { | |
for (var i = 0; i < list.length; i++) { | |
action(list[i]); | |
} | |
}; | |
var logItem = function (item) { | |
console.log(item); | |
}; |
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
var forEach = function (list, action) { | |
for (var i = 0; i < list.length; i++) { | |
action(list[i]); | |
} | |
}; | |
var map = function (mappingFunction, list) { | |
var result = []; | |
forEach(list, function (item) { | |
result.push(mappingFunction(item)); |
OlderNewer