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 com.sogeti.d2.services.system.hibernate; | |
import java.util.Map; | |
import java.util.TreeMap; | |
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 generateSorter(tableId, columnIndex, order) { | |
return function(firstRow, secondRow) { | |
var firstText = getTextForCell(firstRow, columnIndex); | |
var secondText = getTextForCell(secondRow, columnIndex); | |
var returned = (firstTextsecondText ? 1 : 0)); | |
if(returned==0) { | |
// getSortOrder returns a 1-based sort index for this column | |
var columnSortIndex = getSortOrder(tableId, columnIndex); | |
if(columnSortIndex!="") { | |
columnSortIndex = columnSortIndex-1; |
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 loadSignatures | |
slashPos = @filename.rindex("/") | |
backslashPos = @filename.rindex("\\\\") | |
defaultLocation = @filename\[0, \[slashPos, backslashPos\].max\] | |
# Parsing list of signature files | |
@signaturesFiles.each do |signatureFile| | |
if FileTest.file?(signatureFile) | |
loadSignature(signatureFile) | |
else | |
# Inserts full path and correct extension |
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 loadSignature(_signatureFileName) | |
sigFile = File.open(_signatureFileName) | |
if sigFile==nil | |
puts "Cannot open file "+_signatureFileName | |
else | |
sigText = "" | |
# parses file | |
sigFile.each do |line| | |
line.strip! | |
lineLength = line.size |
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
# Config class. It represents the config file, read from disk | |
class Config | |
#config filename | |
attr_reader :weight | |
#initializer def initialize(_filename) | |
# default weight for keywords (entered before signature) | |
@weight = 1 | |
@CONFIG_HANDLERS = { | |
"POIDS" => "WEIGHT", | |
"WEIGHT" => proc{|_weight| @weight = _weight.to_i}, |
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 Config | |
# ... il y a du code avant | |
# Find the appropriate signature for the given file | |
def find(_text) | |
processed = Signature.splitSentence(_text) | |
values = {} | |
@signatures.each do |sig| | |
values\[sig.compute(processed)\]=sig | |
end | |
sortedValues = values.sort {|a,b| -1*(a\[0\]< =>b\[0\])} |
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 Signature | |
# ... il y a aussi du code avant | |
def compute(_sentence) | |
returned = 0 | |
_sentence.each do |word| | |
if @keywords.include?(word) | |
returned+=@keywords\[word\] | |
end | |
end | |
returned |
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 createSignatureMetaData | |
# Metadata is the first line of the signature, from -- to \ | |
lineReturnPos = @signatureText.index($/) | |
# hard-coded (yuck !) management of the trailing "-- " | |
allMeta = @signatureText\[3, lineReturnPos-3\] | |
# text signature begins at line 2 | |
@signatureText = @signatureText\[lineReturnPos+1, @signatureText.size-lineReturnPos-1\] | |
# If there are metadata in the first line, it has to be processed | |
if allMeta | |
# If there is a parenthesis, it's the signature name |
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
<entry xml:lang="fr"> | |
<!-- Les éléments de base Atom --> | |
<!-- title is object's name --> | |
<title>Dorgem - Open Source Webcam Capture Application</title> | |
<link rel="alternate" type="text/html" href="http://dorgem.sourceforge.net/"/> | |
<!-- exemple d'id tag:blogmarks.net/marks/154--> | |
<id>BlogmarksBookmarkStore@2005-04-22T09:08:31+0200</id> | |
<issued>2005-04-22T09:08:31+0200</issued> | |
<modified>2004-06-22T21:18:34Z</modified> | |
<!-- Les éléments supplémentaires Atom --> |
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 User { | |
public static final String USER_SESSION_KEY; | |
public static User getUser(HttpServletRequest _request) { | |
HttpSession session = _request.getSession(); | |
User returned = (User) session.getAttribute(USER_SESSION_KEY); | |
return returned; | |
} | |
} |