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.io.*; | |
import java.lang.reflect.Array; | |
import java.util.*; | |
/* | |
* Given a Long number N, write a function that calculates the highest number lower than N obtained by permute only one digit of N. | |
* If no permutation exists to return a lower value, return N. | |
* Example: | |
* N = 153 | |
* permuteToPrevious(N) = 135 |
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
$("#upload_btn").click(function(){ | |
var fileIn = $("#fileToUpload")[0]; | |
if (fileIn.files === undefined || fileIn.files.length == 0) { | |
alert("Please select a file"); | |
return; | |
} | |
var file = fileIn.files[0]; | |
var fotka = new FormData() |
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
class MathOpThree(object): | |
def sum(self, node): | |
if len(node.childrens) == 2: | |
print node.getTokenValue() | |
#node.setTokenValue(self.sum(node.childrens[0]).getTokenValue() + self.sum(node.childrens[1]).getTokenValue()) | |
node.setTokenValue(self.doMathOperation(node.getTokenType(), self.sum(node.childrens[0]).getTokenValue(), self.sum(node.childrens[1]).getTokenValue())) | |
return node | |
def doMathOperation(self, mathOpString, tokenValue1, tokenValue2): |
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 composeAST(self): | |
tokenPosition = -1 | |
for token in self.listOfTokens: | |
#tracks position of the current token we are inspecting | |
tokenPosition += 1 | |
# if we are dealing with numbers and have two ASTNodes on the childrenStack | |
# we should form a mini/subtree because by the time we have two "children" nodes | |
# we must have at least one "parent" node , which is enough for mini/sub tree | |
if token.type == "NUMBER" and len(self.childrenStack) < 3 : | |
numberToken = ASTNode(token) |
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
mathOpPlusMinus = 'PLUS', 'MINUS' , 1 | |
mathOpTimesDivide = 'TIMES', 'DIVIDE' , 2 | |
childrenStack = [] | |
higherChildrenStack = [] | |
parentStack = [] | |
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
astlist = [] | |
def composeASTWithList(self,util): | |
tokenPosition = 0 | |
if tokenPosition == len(self.listOfTokens)-1 : | |
return None | |
else: | |
util.append(self.listOfTokens[tokenPosition+1]) | |
util.append(self.listOfTokens[tokenPosition]) |
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 composeASTWithList(self,util): | |
tokenPosition = 0 | |
if tokenPosition == len(self.listOfTokens)-1 : | |
return None | |
else: | |
util.append(self.listOfTokens[tokenPosition+1]) | |
util.append(self.listOfTokens[tokenPosition]) | |
util.append([]) | |
self.composeASTWithList(util[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
package net.netm.portals.tapestry.kino.services.impl; | |
import net.netm.platform.auxiliary.backendbox.exception.BackendboxAccessException; | |
import net.netm.platform.auxiliary.backendbox.model.AvsPinResponse; | |
import net.netm.platform.auxiliary.backendbox.service.AvsService; | |
import net.netm.platform.client.tapestry.core.services.MsisdnSource; | |
import net.netm.portals.tapestry.kino.services.PinValidator; | |
public class PinValidatorImpl implements PinValidator { |
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 net.netm.platform.auxiliary.backendbox.exception.BackendboxAccessException; | |
import net.netm.platform.auxiliary.backendbox.service.AvsService; | |
import net.netm.portals.tapestry.kino.services.PinValidator; | |
import net.netm.portals.tapestry.kino.services.impl.PinValidatorImpl | |
import spock.lang.Specification | |
class PinValidatorImplTest extends Specification{ | |
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
''' | |
Created on Aug 6, 2012 | |
@author: Sasa Trifunovic | |
I should write test(s) so i could be sure every one of theme is working | |
as i intended them to do!!! | |
''' |
NewerOlder